Commit 2b0c0b2a 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 d8917f55
......@@ -59,26 +59,32 @@ double gettime (void) {
void scanscan (void) {
int r;
long long totalbytes=0;
double prevtime = gettime();
int counter=0;
while (1) {
for (counter=0; counter<2; counter++) {
long long totalbytes=0;
int rowcounter=0;
double prevtime = gettime();
DBT k,v;
memset(&k, 0, sizeof(k));
memset(&v, 0, sizeof(v));
r = dbc->c_get(dbc, &k, &v, DB_NEXT);
if (r==DB_NOTFOUND) {
double thistime = gettime();
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;
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);
if (r==DB_NOTFOUND) {
break;
}
assert(r==0);
totalbytes += k.size + v.size;
rowcounter++;
}
}
assert(r==0);
totalbytes += k.size + v.size;
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[]) {
argv=argv;
setup();
scanscan();
scanscan();
shutdown();
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