Commit b2dd143d authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Clean up scanscan. Addresses #820.

git-svn-id: file:///svn/tokudb@4420 c7de825b-a66e-492c-adef-691d508d4ae1
parent d9e9792d
...@@ -59,26 +59,32 @@ double gettime (void) { ...@@ -59,26 +59,32 @@ double gettime (void) {
void scanscan (void) { void scanscan (void) {
int r; int r;
int counter=0;
for (counter=0; counter<2; counter++) {
long long totalbytes=0; long long totalbytes=0;
int rowcounter=0;
double prevtime = gettime(); double prevtime = gettime();
int counter=0;
while (1) {
DBT k,v; DBT k,v;
memset(&k, 0, sizeof(k)); memset(&k, 0, sizeof(k));
memset(&v, 0, sizeof(v)); memset(&v, 0, sizeof(v));
r = dbc->c_get(dbc, &k, &v, DB_FIRST);
if (r!=DB_NOTFOUND) {
totalbytes += k.size + v.size;
rowcounter++;
assert(r==0);
while (1) {
r = dbc->c_get(dbc, &k, &v, DB_NEXT); r = dbc->c_get(dbc, &k, &v, DB_NEXT);
if (r==DB_NOTFOUND) { if (r==DB_NOTFOUND) {
double thistime = gettime(); break;
double tdiff = thistime-prevtime;
printf("Scan %lld bytes in %9.6fs at %9fMB/s\n", totalbytes, tdiff, 1e-6*totalbytes/tdiff);
r = dbc->c_get(dbc, &k, &v, DB_FIRST);
prevtime = thistime;
totalbytes=0;
counter++;
if (counter>0) return;
} }
assert(r==0); assert(r==0);
totalbytes += k.size + v.size; totalbytes += k.size + v.size;
rowcounter++;
}
}
double thistime = gettime();
double tdiff = thistime-prevtime;
printf("Scan %lld bytes (%d rows) in %9.6fs at %9fMB/s\n", totalbytes, rowcounter, tdiff, 1e-6*totalbytes/tdiff);
} }
} }
...@@ -87,7 +93,6 @@ int main (int argc, char *argv[]) { ...@@ -87,7 +93,6 @@ int main (int argc, char *argv[]) {
argv=argv; argv=argv;
setup(); setup();
scanscan(); scanscan();
scanscan();
shutdown(); shutdown();
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment