Add the --timer option to the wordcount test program.

FossilOrigin-Name: a89fdf87553f01c150729c570796b5078a9b069d
This commit is contained in:
drh 2013-11-21 19:27:45 +00:00
parent 2b53e00f73
commit d2b637c2af
3 changed files with 36 additions and 7 deletions

View File

@ -1,5 +1,5 @@
C Remove\sa\stest\sfrom\ssqlite3VdbeMemFromBtree()\swhich\swas\sunnecessary,\sand\nafter\sthe\srecent\sOP_Column\srefactoring,\sunreachable.
D 2013-11-21T19:05:04.606
C Add\sthe\s--timer\soption\sto\sthe\swordcount\stest\sprogram.
D 2013-11-21T19:27:45.727
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 8a07bebafbfda0eb67728f4bd15a36201662d1a1
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -1088,7 +1088,7 @@ F test/without_rowid1.test aaa26da19d543cd8d3d2d0e686dfa255556c15c8
F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99
F test/without_rowid3.test eac3d5c8a1924725b58503a368f2cbd24fd6c8a0
F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a
F test/wordcount.c c80f378f26fbf6ada602c4313ae88fc47439263e
F test/wordcount.c a42341b7a01229782b9bd97ff2eeebae830adbea
F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688
F test/zerodamage.test 209d7ed441f44cc5299e4ebffbef06fd5aabfefd
F tool/build-all-msvc.bat 1bac6adc3fdb4d9204f21d17b14be25778370e48 x
@ -1140,7 +1140,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
P d4ccf0f5c656c8f0e1c32d5f7971b131f42c3cbd
R 66dccb4d546e53b7ddedb9ff6684fbe4
P 23667f3ba09b7e839d76c42669dc9247a91262c8
R 6f7d4c37e1e4a4d7b173a8698f60d4e6
U drh
Z 06ed94041404ba9e41a5bfcb0e125483
Z be6cc4796ccce786831080c9b4f10bd9

View File

@ -1 +1 @@
23667f3ba09b7e839d76c42669dc9247a91262c8
a89fdf87553f01c150729c570796b5078a9b069d

View File

@ -29,6 +29,7 @@
** --commit NNN Commit after every NNN operations
** --nosync Use PRAGMA synchronous=OFF
** --journal MMMM Use PRAGMA journal_mode=MMMM
** --timer Time the operation of this program
**
** Modes:
**
@ -80,6 +81,21 @@
#include <stdarg.h>
#include "sqlite3.h"
/* Return the current wall-clock time */
static sqlite3_int64 realTime(void){
static sqlite3_vfs *clockVfs = 0;
sqlite3_int64 t;
if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0);
if( clockVfs->iVersion>=1 && clockVfs->xCurrentTimeInt64!=0 ){
clockVfs->xCurrentTimeInt64(clockVfs, &t);
}else{
double r;
clockVfs->xCurrentTime(clockVfs, &r);
t = (sqlite3_int64)(r*86400000.0);
}
return t;
}
/* Print an error message and exit */
static void fatal_error(const char *zMsg, ...){
va_list ap;
@ -186,6 +202,7 @@ int main(int argc, char **argv){
int doTrace = 0; /* True for --trace */
int showStats = 0; /* True for --stats */
int showSummary = 0; /* True for --summary */
int showTimer = 0; /* True for --timer */
int cacheSize = 0; /* Desired cache size. 0 means default */
int pageSize = 0; /* Desired page size. 0 means default */
int commitInterval = 0; /* How often to commit. 0 means never */
@ -203,6 +220,7 @@ int main(int argc, char **argv){
int rc; /* Return code from an SQLite interface */
int iCur, iHiwtr; /* Statistics values, current and "highwater" */
sqlite3_int64 sumCnt = 0; /* Sum in QUERY mode */
sqlite3_int64 startTime;
char zInput[2000]; /* A single line of input */
/* Process command-line arguments */
@ -234,6 +252,8 @@ int main(int argc, char **argv){
showStats = 1;
}else if( strcmp(z,"summary")==0 ){
showSummary = 1;
}else if( strcmp(z,"timer")==0 ){
showTimer = i;
}else if( strcmp(z,"cachesize")==0 && i<argc-1 ){
i++;
cacheSize = atoi(argv[i]);
@ -259,6 +279,7 @@ int main(int argc, char **argv){
if( zDbName==0 ){
fatal_error("Usage: %s [--options] DATABASE [INPUTFILE]\n", argv[0]);
}
startTime = realTime();
/* Open the database and the input file */
if( sqlite3_open(zDbName, &db) ){
@ -449,6 +470,14 @@ int main(int argc, char **argv){
sqlite3_finalize(pSelect);
}
if( showTimer ){
sqlite3_int64 elapseTime = realTime() - startTime;
printf("/* %3d.%03d", (int)(elapseTime/1000), (int)(elapseTime%1000));
for(i=0; i<argc; i++) if( i!=showTimer ) printf(" %s", argv[i]);
printf(" */\n");
}
if( showSummary ){
sqlite3_create_function(db, "checksum", -1, SQLITE_UTF8, 0,
0, checksumStep, checksumFinalize);