Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
d8218152
Commit
d8218152
authored
Jul 28, 2008
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use trace memory. addresses #1042
git-svn-id:
file:///svn/tokudb@5390
c7de825b-a66e-492c-adef-691d508d4ae1
parent
18438739
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
23 deletions
+7
-23
db-benchmark-test/scanscan.c
db-benchmark-test/scanscan.c
+7
-23
No files found.
db-benchmark-test/scanscan.c
View file @
d8218152
...
@@ -7,30 +7,11 @@
...
@@ -7,30 +7,11 @@
#include <sys/resource.h>
#include <sys/resource.h>
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
#include "rdtsc.h"
const
char
*
pname
;
const
char
*
pname
;
enum
run_mode
{
RUN_HWC
,
RUN_LWC
,
RUN_VERIFY
}
run_mode
=
RUN_HWC
;
enum
run_mode
{
RUN_HWC
,
RUN_LWC
,
RUN_VERIFY
}
run_mode
=
RUN_HWC
;
int
do_txns
=
1
,
prelock
=
0
,
prelockflag
=
0
;
int
do_txns
=
1
,
prelock
=
0
,
prelockflag
=
0
;
u_int32_t
lock_flag
=
0
;
u_int32_t
lock_flag
=
0
;
int
do_rdtsc
=
0
;
#define NTRACE 1000000
int
next_trace
=
0
;
unsigned
long
long
tracebuffer
[
NTRACE
];
static
inline
void
add_trace
()
{
#if USE_RDTSC
if
(
next_trace
<
NTRACE
)
tracebuffer
[
next_trace
++
]
=
rdtsc
();
#endif
}
void
print_trace
()
{
if
(
do_rdtsc
==
0
)
return
;
int
i
;
for
(
i
=
0
;
i
<
NTRACE
;
i
++
)
if
(
tracebuffer
[
i
])
printf
(
"%llu
\n
"
,
tracebuffer
[
i
]);
}
void
parse_args
(
int
argc
,
const
char
*
argv
[])
{
void
parse_args
(
int
argc
,
const
char
*
argv
[])
{
pname
=
argv
[
0
];
pname
=
argv
[
0
];
...
@@ -51,7 +32,6 @@ void parse_args (int argc, const char *argv[]) {
...
@@ -51,7 +32,6 @@ void parse_args (int argc, const char *argv[]) {
else
if
(
strcmp
(
*
argv
,
"--prelockflag"
)
==
0
)
{
prelockflag
=
1
;
lock_flag
=
DB_PRELOCKED
;
}
else
if
(
strcmp
(
*
argv
,
"--prelockflag"
)
==
0
)
{
prelockflag
=
1
;
lock_flag
=
DB_PRELOCKED
;
}
else
if
(
strcmp
(
*
argv
,
"--prelockwriteflag"
)
==
0
)
{
prelockflag
=
1
;
lock_flag
=
DB_PRELOCKED_WRITE
;
}
else
if
(
strcmp
(
*
argv
,
"--prelockwriteflag"
)
==
0
)
{
prelockflag
=
1
;
lock_flag
=
DB_PRELOCKED_WRITE
;
}
else
if
(
strcmp
(
*
argv
,
"--nox"
)
==
0
)
{
do_txns
=
0
;
}
else
if
(
strcmp
(
*
argv
,
"--nox"
)
==
0
)
{
do_txns
=
0
;
}
else
if
(
strcmp
(
*
argv
,
"--rdtsc"
)
==
0
)
{
do_rdtsc
=
1
;
}
else
{
else
{
fprintf
(
stderr
,
"Usage:
\n
%s [--verify-lwc | --lwc | --nohwc] [--prelock] [--prelockflag] [--prelockwriteflag]
\n
"
,
pname
);
fprintf
(
stderr
,
"Usage:
\n
%s [--verify-lwc | --lwc | --nohwc] [--prelock] [--prelockflag] [--prelockwriteflag]
\n
"
,
pname
);
fprintf
(
stderr
,
" --hwc run heavy weight cursors (this is the default)
\n
"
);
fprintf
(
stderr
,
" --hwc run heavy weight cursors (this is the default)
\n
"
);
...
@@ -135,9 +115,7 @@ void scanscan_hwc (void) {
...
@@ -135,9 +115,7 @@ void scanscan_hwc (void) {
if
(
prelockflag
&&
(
counter
||
prelock
))
{
if
(
prelockflag
&&
(
counter
||
prelock
))
{
c_get_flags
|=
lock_flag
;
c_get_flags
|=
lock_flag
;
}
}
add_trace
();
while
(
0
==
(
r
=
dbc
->
c_get
(
dbc
,
&
k
,
&
v
,
c_get_flags
)))
{
while
(
0
==
(
r
=
dbc
->
c_get
(
dbc
,
&
k
,
&
v
,
c_get_flags
)))
{
add_trace
();
totalbytes
+=
k
.
size
+
v
.
size
;
totalbytes
+=
k
.
size
+
v
.
size
;
rowcounter
++
;
rowcounter
++
;
}
}
...
@@ -145,7 +123,6 @@ void scanscan_hwc (void) {
...
@@ -145,7 +123,6 @@ void scanscan_hwc (void) {
double
thistime
=
gettime
();
double
thistime
=
gettime
();
double
tdiff
=
thistime
-
prevtime
;
double
tdiff
=
thistime
-
prevtime
;
printf
(
"Scan %lld bytes (%d rows) in %9.6fs at %9fMB/s
\n
"
,
totalbytes
,
rowcounter
,
tdiff
,
1e-6
*
totalbytes
/
tdiff
);
printf
(
"Scan %lld bytes (%d rows) in %9.6fs at %9fMB/s
\n
"
,
totalbytes
,
rowcounter
,
tdiff
,
1e-6
*
totalbytes
/
tdiff
);
print_trace
();
}
}
}
}
...
@@ -251,6 +228,13 @@ int main (int argc, const char *argv[]) {
...
@@ -251,6 +228,13 @@ int main (int argc, const char *argv[]) {
extern
void
print_hash_histogram
(
void
)
__attribute__
((
__visibility__
(
"default"
)));
extern
void
print_hash_histogram
(
void
)
__attribute__
((
__visibility__
(
"default"
)));
print_hash_histogram
();
print_hash_histogram
();
}
}
// if tokudb has tracing enabled (see trace_mem.h) then this will dump
// the trace data
if
(
1
)
{
extern
void
toku_print_trace_mem
();
toku_print_trace_mem
();
}
#endif
#endif
return
0
;
return
0
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment