]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add test case 'cgt_pager_1', intended for use with callgrind to detect performance...
authordan <dan@noemail.net>
Sat, 7 Aug 2010 05:15:22 +0000 (05:15 +0000)
committerdan <dan@noemail.net>
Sat, 7 Aug 2010 05:15:22 +0000 (05:15 +0000)
FossilOrigin-Name: b5d46f1ea08db2b88d2205bc283b9262ad970b55

manifest
manifest.uuid
test/threadtest3.c

index e52daaa123601079d794204b577d2be4bdcede71..ac5dfd9e0df2c6372e7ea196a33761bd6723dd3b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Further\senhancements\sto\scomments\sin\spager.c.
-D 2010-08-06T17:18:01
+C Add\stest\scase\s'cgt_pager_1',\sintended\sfor\suse\swith\scallgrind\sto\sdetect\sperformance\sregression\sin\sthe\spager\smodule,\sto\sthreadtest3.c.
+D 2010-08-07T05:15:23
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -632,7 +632,7 @@ F test/thread2.test e08034b83fe9693ade77049732518e5b3d2d700d
 F test/thread_common.tcl 2aa6f2fdcd4d6e461169c3e5ca098eebf643b863
 F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
 F test/threadtest2.c ace893054fa134af3fc8d6e7cfecddb8e3acefb9
-F test/threadtest3.c f7e21a9bcddff1499d46a1fc68d1ba31e4063be4
+F test/threadtest3.c 58df1e3c060f534fd7fb0702331b0acc41c381d8
 F test/tkt-02a8e81d44.test 58494de77be2cf249228ada3f313fa399821c6ab
 F test/tkt-26ff0c2d1e.test 888324e751512972c6e0d1a09df740d8f5aaf660
 F test/tkt-2ea2425d34.test 1cf13e6f75d149b3209a0cb32927a82d3d79fb28
@@ -843,7 +843,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 7bd8ba084e75bcd5c744e1d4a1812df3a4d91887
-R 8a9a6e1ca5d584d1153bedf7c51336b6
+P 876162c7e036af1cb447409b685afc72c0061a32
+R 27f96e8eaa225660cd3eee27494507ba
 U dan
-Z 9aa10a3fe3170bea3315ad90ad87b34f
+Z 3bc5778d1d89a64090d5ae07cc0b0720
index 4ff4fab4ca45a15acc8ea1a1a386e25fdd8884c7..6c2974f53e1b120487d7fa5ca08c170775496a9a 100644 (file)
@@ -1 +1 @@
-876162c7e036af1cb447409b685afc72c0061a32
\ No newline at end of file
+b5d46f1ea08db2b88d2205bc283b9262ad970b55
\ No newline at end of file
index 57404faa678c948afd65fa95c622fc7df17d6031..6373926c13fdbae0f3a128ba49b8de08461c4401 100644 (file)
@@ -517,6 +517,7 @@ static void opendb_x(
           pDb->db, "md5sum", -1, SQLITE_UTF8, 0, 0, md5step, md5finalize
       );
       sqlite3_busy_handler(pDb->db, busyhandler, 0);
+      sqlite3_exec(pDb->db, "PRAGMA synchronous=OFF", 0, 0, 0);
     }
   }
 }
@@ -1219,6 +1220,58 @@ static void walthread5(int nMs){
   print_and_free_err(&err);
 }
 
+/*------------------------------------------------------------------------
+** Test case "cgt_pager_1"
+*/
+#define CALLGRINDTEST1_NROW 10000
+static void cgt_pager_1_populate(Error *pErr, Sqlite *pDb){
+  const char *zInsert = "INSERT INTO t1 VALUES(:iRow, zeroblob(:iBlob))";
+  i64 iRow;
+  sql_script(pErr, pDb, "BEGIN");
+  for(iRow=1; iRow<=CALLGRINDTEST1_NROW; iRow++){
+    i64 iBlob = 600 + (iRow%300);
+    execsql(pErr, pDb, zInsert, &iRow, &iBlob);
+  }
+  sql_script(pErr, pDb, "COMMIT");
+}
+static void cgt_pager_1_update(Error *pErr, Sqlite *pDb){
+  const char *zUpdate = "UPDATE t1 SET b = zeroblob(:iBlob) WHERE a = :iRow";
+  i64 iRow;
+  sql_script(pErr, pDb, "BEGIN");
+  for(iRow=1; iRow<=CALLGRINDTEST1_NROW; iRow++){
+    i64 iBlob = 600 + ((iRow+100)%300);
+    execsql(pErr, pDb, zUpdate, &iBlob, &iRow);
+  }
+  sql_script(pErr, pDb, "COMMIT");
+}
+static void cgt_pager_1_read(Error *pErr, Sqlite *pDb){
+  i64 iRow;
+  sql_script(pErr, pDb, "BEGIN");
+  for(iRow=1; iRow<=CALLGRINDTEST1_NROW; iRow++){
+    execsql(pErr, pDb, "SELECT * FROM t1 WHERE a = :iRow", &iRow);
+  }
+  sql_script(pErr, pDb, "COMMIT");
+}
+static void cgt_pager_1(int nMs){
+  void (*xSub)(Error *, Sqlite *);
+  Error err = {0};
+  Sqlite db = {0};
+
+  opendb(&err, &db, "test.db", 1);
+  sql_script(&err, &db,
+      "PRAGMA cache_size = 2000;"
+      "PRAGMA page_size = 1024;"
+      "CREATE TABLE t1(a INTEGER PRIMARY KEY, b BLOB);"
+  );
+
+  xSub = cgt_pager_1_populate; xSub(&err, &db);
+  xSub = cgt_pager_1_update;   xSub(&err, &db);
+  xSub = cgt_pager_1_read;     xSub(&err, &db);
+
+  closedb(&err, &db);
+  print_and_free_err(&err);
+}
+
 int main(int argc, char **argv){
   struct ThreadTest {
     void (*xTest)(int);
@@ -1230,6 +1283,9 @@ int main(int argc, char **argv){
     { walthread3, "walthread3", 20000 },
     { walthread4, "walthread4", 20000 },
     { walthread5, "walthread5",  1000 },
+    { walthread5, "walthread5",  1000 },
+    
+    { cgt_pager_1, "cgt_pager_1", 0 },
   };
 
   int i;