/ Check-in [b0f58d24]
Login
Overview
Comment:In kvtest.c: do not show the --cache-size setting on fopen() runs. Show progress for the (potentially slow) "export" command.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | kvtest
Files: files | file ages | folders
SHA1:b0f58d2470e08b9c217afd19fcfde3e6d1007d1d
User & Date: drh 2016-12-29 15:26:50
Context
2016-12-29
16:18
Fix kvtest.c so that it compiles using MSVC. check-in: e2bbeae7 user: drh tags: kvtest
15:26
In kvtest.c: do not show the --cache-size setting on fopen() runs. Show progress for the (potentially slow) "export" command. check-in: b0f58d24 user: drh tags: kvtest
14:44
Improvements to the kvtest.c utility. Added the --cache-size option. Additional reporting of version and settings at the end of "./kvtest run". check-in: f6fcac6a user: drh tags: kvtest
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/kvtest.c.

201
202
203
204
205
206
207

208
209
210
211
212
213
214
...
237
238
239
240
241
242
243

244
245
246
247
248
249
250
...
476
477
478
479
480
481
482
483



484
485
486
487
488
489
490
  z = (const char*)sqlite3_value_blob(argv[1]);
  if( z==0 ){
    rc = 0;
  }else{
    rc = fwrite(z, 1, sqlite3_value_bytes(argv[1]), out);
  }
  fclose(out);

  sqlite3_result_int64(context, rc);
}

/*
** Export the kv table to individual files in the filesystem
*/
static int exportMain(int argc, char **argv){
................................................................................
    "SELECT writefile(printf('%s/%%06d',k),v) FROM kv;",
    zDir
  );
  rc = sqlite3_exec(db, zSql, 0, 0, &zErrMsg);
  if( rc ) fatalError("database create failed: %s", zErrMsg);
  sqlite3_free(zSql);
  sqlite3_close(db);

  return 0;
}

/*
** Read the content of file zName into memory obtained from sqlite3_malloc64()
** and return a pointer to the buffer. The caller is responsible for freeing 
** the memory. 
................................................................................
  tmElapsed = timeOfDay() - tmStart;
  if( nExtra ){
    printf("%d cycles due to %d misses\n", nCount, nExtra);
  }
  if( eType==PATH_DB ){
    printf("SQLite version: %s\n", sqlite3_libversion());
  }
  printf("--count %d --max-id %d --cache-size %d", nCount-nExtra, iMax, iCache);



  switch( eOrder ){
    case ORDER_RANDOM:  printf(" --random\n");  break;
    case ORDER_DESC:    printf(" --desc\n");    break;
    default:            printf(" --asc\n");     break;
  }
  if( iPagesize ) printf("Database page size: %d\n", iPagesize);
  printf("Total elapsed time: %.3f\n", tmElapsed/1000.0);







>







 







>







 







|
>
>
>







201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
...
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
...
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
  z = (const char*)sqlite3_value_blob(argv[1]);
  if( z==0 ){
    rc = 0;
  }else{
    rc = fwrite(z, 1, sqlite3_value_bytes(argv[1]), out);
  }
  fclose(out);
  printf("\r%s   ", zFile); fflush(stdout);
  sqlite3_result_int64(context, rc);
}

/*
** Export the kv table to individual files in the filesystem
*/
static int exportMain(int argc, char **argv){
................................................................................
    "SELECT writefile(printf('%s/%%06d',k),v) FROM kv;",
    zDir
  );
  rc = sqlite3_exec(db, zSql, 0, 0, &zErrMsg);
  if( rc ) fatalError("database create failed: %s", zErrMsg);
  sqlite3_free(zSql);
  sqlite3_close(db);
  printf("\n");
  return 0;
}

/*
** Read the content of file zName into memory obtained from sqlite3_malloc64()
** and return a pointer to the buffer. The caller is responsible for freeing 
** the memory. 
................................................................................
  tmElapsed = timeOfDay() - tmStart;
  if( nExtra ){
    printf("%d cycles due to %d misses\n", nCount, nExtra);
  }
  if( eType==PATH_DB ){
    printf("SQLite version: %s\n", sqlite3_libversion());
  }
  printf("--count %d --max-id %d", nCount-nExtra, iMax);
  if( eType==PATH_DB ){
    printf(" --cache-size %d", iCache);
  }
  switch( eOrder ){
    case ORDER_RANDOM:  printf(" --random\n");  break;
    case ORDER_DESC:    printf(" --desc\n");    break;
    default:            printf(" --asc\n");     break;
  }
  if( iPagesize ) printf("Database page size: %d\n", iPagesize);
  printf("Total elapsed time: %.3f\n", tmElapsed/1000.0);