From: drh Date: Tue, 31 Jan 2017 15:29:05 +0000 (+0000) Subject: Add the "stat" command to kvtest.c. Also add the --variance option to the X-Git-Tag: version-3.17.0~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9dc7ad1d7e1286fe0d3d30117adae154c6abf6de;p=thirdparty%2Fsqlite.git Add the "stat" command to kvtest.c. Also add the --variance option to the "init" command. Add the tool/kvtest-speed.sh script used for doing performance testing on key/value access patterns. FossilOrigin-Name: b63deed600b1a457a6960ebad5645f4de9c56e5d --- diff --git a/manifest b/manifest index 8e4b6f544a..e0848cf122 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\stypo\sin\sa\scomment. -D 2017-01-31T15:27:04.928 +C Add\sthe\s"stat"\scommand\sto\skvtest.c.\s\sAlso\sadd\sthe\s--variance\soption\sto\sthe\n"init"\scommand.\s\sAdd\sthe\stool/kvtest-speed.sh\sscript\sused\sfor\sdoing\s\nperformance\stesting\son\skey/value\saccess\spatterns. +D 2017-01-31T15:29:05.242 F Makefile.in 5f415e7867296d678fed2e6779aea10c1318b4bc F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da @@ -899,7 +899,7 @@ F test/json101.test c0897616f32d95431f37fd291cb78742181980ac F test/json102.test bf3fe7a706d30936a76a0f7a0375e1e8e73aff5a F test/json103.test c5f6b85e69de05f6b3195f9f9d5ce9cd179099a0 F test/keyword1.test 37ef6bba5d2ed5b07ecdd6810571de2956599dff -F test/kvtest.c dc6e5e9066fa5e19f7368c7dfbe8c6b9642a706f +F test/kvtest.c 7a3c38ee56b9cc45dc5a5edc50fd9bc9425659a9 F test/lastinsert.test 42e948fd6442f07d60acbd15d33fb86473e0ef63 F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200 F test/like.test 0603f4fa0dad50987f70032c05800cbfa8985302 @@ -1475,6 +1475,7 @@ F tool/fuzzershell.c dbf6c26eef936ec78cb0707570de3a4308b2507e F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4 F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5 F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce +F tool/kvtest-speed.sh d6c7c2b5787f44c3be2ed01c8463223032ee598b F tool/lemon.c 5ccba178a8e8a4b21e1c9232944d23973da38ad7 F tool/lempar.c db1bdb4821f2d8fbd76e577cf3ab18642c8d08d1 F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9 @@ -1548,7 +1549,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P eacfdcf25796ea29b5e63499c3d7397498305ad9 -R 08311637f9a8170c29c38d1bfabeb653 +P bd22bf9cbe028e9811ca3afaadafd90312cb0fc9 +R 561f5ef3a58c98c17f69cad51ae91935 U drh -Z 855f1082721037fd6fefeb16ca2ac959 +Z 35fd92fc5491c4b603aa832f4a4ebf7a diff --git a/manifest.uuid b/manifest.uuid index 61e2f28112..69a91341ca 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -bd22bf9cbe028e9811ca3afaadafd90312cb0fc9 \ No newline at end of file +b63deed600b1a457a6960ebad5645f4de9c56e5d \ No newline at end of file diff --git a/test/kvtest.c b/test/kvtest.c index 765a7ee968..2a108aa470 100644 --- a/test/kvtest.c +++ b/test/kvtest.c @@ -67,13 +67,19 @@ static const char zHelp[] = "\n" " Generate a new test database file named DBFILE containing N\n" " BLOBs each of size M bytes. The page size of the new database\n" -" file will be X\n" +" file will be X. Additional options:\n" +"\n" +" --variance V Randomly vary M by plus or minus V\n" "\n" " kvtest export DBFILE DIRECTORY\n" "\n" " Export all the blobs in the kv table of DBFILE into separate\n" " files in DIRECTORY.\n" "\n" +" kvtest stat DBFILE\n" +"\n" +" Display summary information about DBFILE\n" +"\n" " kvtest run DBFILE [options]\n" "\n" " Run a performance test. DBFILE can be either the name of a\n" @@ -251,6 +257,7 @@ static int initMain(int argc, char **argv){ int i, rc; int nCount = 1000; int sz = 10000; + int iVariance = 0; int pgsz = 4096; sqlite3 *db; char *zSql; @@ -275,6 +282,11 @@ static int initMain(int argc, char **argv){ if( sz<1 ) fatalError("the --size must be positive"); continue; } + if( strcmp(z, "-variance")==0 ){ + if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]); + iVariance = integerValue(argv[++i]); + continue; + } if( strcmp(z, "-pagesize")==0 ){ if( i==argc-1 ) fatalError("missing argument on \"%s\"", argv[i]); pgsz = integerValue(argv[++i]); @@ -296,9 +308,9 @@ static int initMain(int argc, char **argv){ "BEGIN;\n" "CREATE TABLE kv(k INTEGER PRIMARY KEY, v BLOB);\n" "WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<%d)" - " INSERT INTO kv(k,v) SELECT x, randomblob(%d) FROM c;\n" + " INSERT INTO kv(k,v) SELECT x, randomblob(%d+(random()%%(%d))) FROM c;\n" "COMMIT;\n", - pgsz, nCount, sz + pgsz, nCount, sz, iVariance ); rc = sqlite3_exec(db, zSql, 0, 0, &zErrMsg); if( rc ) fatalError("database create failed: %s", zErrMsg); @@ -307,6 +319,65 @@ static int initMain(int argc, char **argv){ return 0; } +/* +** Analyze an existing database file. Report its content. +*/ +static int statMain(int argc, char **argv){ + char *zDb; + int i, rc; + sqlite3 *db; + char *zSql; + sqlite3_stmt *pStmt; + + assert( strcmp(argv[1],"stat")==0 ); + assert( argc>=3 ); + zDb = argv[2]; + for(i=3; i&1 | tee summary-kvtest-$NAME.txt +mv cachegrind.out.[1-9][0-9]* cachegrind.out.$NAME +cg_anno.tcl cachegrind.out.$NAME >cout-kvtest-sql-$NAME.txt + +# Second run using the sqlite3_blob object +rm cachegrind.out.[1-9][0-9]* +valgrind --tool=cachegrind ./kvtest run kvtest.db $KVARGS --blob-api 2>&1 | tee -a summary-kvtest-$NAME.txt +mv cachegrind.out.[1-9][0-9]* cachegrind.out.$NAME +cg_anno.tcl cachegrind.out.$NAME >cout-kvtest-$NAME.txt + +# Diff the sqlite3_blob API analysis for non-trunk runs. +if test "$NAME" != "trunk"; then + fossil test-diff --tk cout-kvtest-trunk.txt cout-kvtest-$NAME.txt & +fi