]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Modify speedtest8.c so that it can use the logging from test_osinst.c when HAVE_OSINS...
authordanielk1977 <danielk1977@noemail.net>
Sat, 12 Apr 2008 16:03:37 +0000 (16:03 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Sat, 12 Apr 2008 16:03:37 +0000 (16:03 +0000)
FossilOrigin-Name: 7622d74ad6088de4d94cb727b60ac4a042c52016

manifest
manifest.uuid
src/test_osinst.c
tool/speedtest8.c

index b4a3c266cd16e7634acb949019446344502e503a..69eaa0297a21df54abf1037169b03d81f9fadf5e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\sall\sinstances\sof\ssprintf()\sfrom\sthe\sFTS\smodules.\s\sTicket\s#3049.\s(CVS\s4996)
-D 2008-04-12T13:06:10
+C Modify\sspeedtest8.c\sso\sthat\sit\scan\suse\sthe\slogging\sfrom\stest_osinst.c\swhen\sHAVE_OSINST\sis\sdefined.\s(CVS\s4997)
+D 2008-04-12T16:03:37
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in b861627d91df5ee422c54237aa38296954dc0151
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -164,7 +164,7 @@ F src/test_loadext.c 22065d601a18878e5542191001f0eaa5d77c0ed8
 F src/test_malloc.c c92a65e8f9b31bb2b332448d92d2016c000a963d
 F src/test_md5.c bca40b727c57462ddb415e57c5323445a1bb1a40
 F src/test_onefile.c 2fea6d22f13f5f286356c80c77ffd41f995f2b7a
-F src/test_osinst.c 257403d3f5b25315a7348f4119f62264dd0bc080
+F src/test_osinst.c ff9bb856acc7ecaa21eb6920372594c3045a9a31
 F src/test_schema.c 12c9de7661d6294eec2d57afbb52e2af1128084f
 F src/test_server.c a6ece6c835e7eae835054124e09e947e422b1ac5
 F src/test_tclvar.c b2d1115e4d489179d3f029e765211b2ad527ba59
@@ -568,7 +568,7 @@ F tool/spaceanal.tcl b87db46ae29e3116411b1686e136b9b994d7de39
 F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355
 F tool/speedtest16.c 6f5bc019dcf8b6537f379bbac0408a9e1a86f0b6
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
-F tool/speedtest8.c fe5c8aeba4f4d4a0159dadc1c3a0733c1b7e0417
+F tool/speedtest8.c c0b2587ce87e9e67db7e926d43eba864a53d7b1b
 F tool/speedtest8inst1.c 025879132979a5fdec11218472cba6cf8f6ec854
 F www/34to35.tcl 942e479aa7740b55d714dce0f0b2cb6ca91c3f20
 F www/arch.fig d5f9752a4dbf242e9cfffffd3f5762b6c63b3bcf
@@ -628,7 +628,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 3866a5da2bdcfafe956e1a9bf117f3277207de05
-R 40a5d13b55e5ef081321902e3d9af0e6
-U drh
-Z 56c81aa17b30b71c3deabfefd64b3068
+P 062bf5d44d53ae0ee2bf96eddcc8de09157aa789
+R acbe7f765f5e59e9c8330f514873e362
+U danielk1977
+Z 109ca7543e880caad3c790cf58ed5c5b
index bb259100697573c66f1683ccf6e6baef9d40cb0a..8d82191d70c35919ad59ccd2c88e0fec9a5a6ada 100644 (file)
@@ -1 +1 @@
-062bf5d44d53ae0ee2bf96eddcc8de09157aa789
\ No newline at end of file
+7622d74ad6088de4d94cb727b60ac4a042c52016
\ No newline at end of file
index 1f256900b3ce2a0cb6c95888a131b34a2dad7959..edcad2979ff4c62c47d86364e0b71d5583b55c59 100644 (file)
@@ -243,7 +243,7 @@ __inline__ unsigned long long int osinst_hwtime(void){
   return rc;                                 \
 }
 
-#define OS_TIME_VFS(eEvent, Z, A, B, Call) {      \
+#define OS_TIME_VFS(eEvent, Z, flags, A, B, Call) {      \
   InstVfs *pInstVfs = (InstVfs *)pVfs;   \
   int rc;                                \
   sqlite3_int64 t = hwtime();                      \
@@ -252,7 +252,7 @@ __inline__ unsigned long long int osinst_hwtime(void){
   pInstVfs->aTime[eEvent] += t;          \
   pInstVfs->aCount[eEvent] += 1;         \
   if( pInstVfs->xCall ){                 \
-    pInstVfs->xCall(pInstVfs->pClient, eEvent, t, Z, 0, A, B); \
+    pInstVfs->xCall(pInstVfs->pClient, eEvent, t, Z, flags, A, B); \
   }                                      \
   return rc;                             \
 }
@@ -368,7 +368,7 @@ static int instOpen(
   p->zName = zName;
   p->flags = flags;
 
-  OS_TIME_VFS(OS_OPEN, zName, flags, 0,
+  OS_TIME_VFS(OS_OPEN, zName, flags, 0, 0,
     REALVFS(pVfs)->xOpen(REALVFS(pVfs), zName, p->pReal, flags, pOutFlags)
   );
 }
@@ -379,7 +379,7 @@ static int instOpen(
 ** returning.
 */
 static int instDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
-  OS_TIME_VFS(OS_DELETE, zPath, dirSync, 0,
+  OS_TIME_VFS(OS_DELETE, zPath, 0, dirSync, 0,
     REALVFS(pVfs)->xDelete(REALVFS(pVfs), zPath, dirSync) 
   );
 }
@@ -389,7 +389,7 @@ static int instDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
 ** is available, or false otherwise.
 */
 static int instAccess(sqlite3_vfs *pVfs, const char *zPath, int flags){
-  OS_TIME_VFS(OS_ACCESS, zPath, flags, 0, 
+  OS_TIME_VFS(OS_ACCESS, zPath, 0, flags, 0, 
     REALVFS(pVfs)->xAccess(REALVFS(pVfs), zPath, flags) 
   );
 }
@@ -400,7 +400,7 @@ static int instAccess(sqlite3_vfs *pVfs, const char *zPath, int flags){
 ** at least (INST_MAX_PATHNAME+1) bytes.
 */
 static int instGetTempName(sqlite3_vfs *pVfs, int nOut, char *zBufOut){
-  OS_TIME_VFS( OS_GETTEMPNAME, 0, 0, 0,
+  OS_TIME_VFS( OS_GETTEMPNAME, 0, 0, 0, 0,
     REALVFS(pVfs)->xGetTempname(REALVFS(pVfs), nOut, zBufOut);
   );
 }
@@ -416,7 +416,7 @@ static int instFullPathname(
   int nOut, 
   char *zOut
 ){
-  OS_TIME_VFS( OS_FULLPATHNAME, zPath, 0, 0,
+  OS_TIME_VFS( OS_FULLPATHNAME, zPath, 0, 0, 0,
     REALVFS(pVfs)->xFullPathname(REALVFS(pVfs), zPath, nOut, zOut);
   );
 }
@@ -456,7 +456,7 @@ static void instDlClose(sqlite3_vfs *pVfs, void *pHandle){
 ** random data.
 */
 static int instRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
-  OS_TIME_VFS( OS_RANDOMNESS, 0, nByte, 0,
+  OS_TIME_VFS( OS_RANDOMNESS, 0, 0, nByte, 0,
     REALVFS(pVfs)->xRandomness(REALVFS(pVfs), nByte, zBufOut);
   );
 }
@@ -466,7 +466,7 @@ static int instRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
 ** actually slept.
 */
 static int instSleep(sqlite3_vfs *pVfs, int nMicro){
-  OS_TIME_VFS( OS_SLEEP, 0, nMicro, 0, 
+  OS_TIME_VFS( OS_SLEEP, 0, 0, nMicro, 0, 
     REALVFS(pVfs)->xSleep(REALVFS(pVfs), nMicro) 
   );
 }
@@ -475,7 +475,7 @@ static int instSleep(sqlite3_vfs *pVfs, int nMicro){
 ** Return the current time as a Julian Day number in *pTimeOut.
 */
 static int instCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
-  OS_TIME_VFS( OS_CURRENTTIME, 0, 0, 0,
+  OS_TIME_VFS( OS_CURRENTTIME, 0, 0, 0, 0,
     REALVFS(pVfs)->xCurrentTime(REALVFS(pVfs), pTimeOut) 
   );
 }
@@ -523,9 +523,11 @@ void sqlite3_instvfs_configure(
 }
 
 void sqlite3_instvfs_destroy(sqlite3_vfs *pVfs){
-  sqlite3_vfs_unregister(pVfs);
-  sqlite3_instvfs_configure(pVfs, 0, 0, 0);
-  sqlite3_free(pVfs);
+  if( pVfs ){
+    sqlite3_vfs_unregister(pVfs);
+    sqlite3_instvfs_configure(pVfs, 0, 0, 0);
+    sqlite3_free(pVfs);
+  }
 }
 
 void sqlite3_instvfs_reset(sqlite3_vfs *pVfs){
@@ -670,6 +672,7 @@ sqlite3_vfs *sqlite3_instvfs_binarylog(
   pParent->xFullPathname(pParent, zLog, pParent->mxPathname, p->zOut);
 
   flags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MASTER_JOURNAL;
+  pParent->xDelete(pParent, p->zOut, 0);
   rc = pParent->xOpen(pParent, p->zOut, p->pOut, flags, &flags);
   if( rc==SQLITE_OK ){
     rc = p->pOut->pMethods->xWrite(p->pOut, "sqlite_ostrace1.....", 20, 0);
index a48830a8a467fb4307f123c45fbce58e5ea2d10a..844ba348562458241bec9ff9628183c8282d78fc 100644 (file)
@@ -93,12 +93,31 @@ int main(int argc, char **argv){
   int nStmt = 0;
   int nByte = 0;
 
+#ifdef HAVE_OSINST
+  extern sqlite3_vfs *sqlite3_instvfs_binarylog(char *, char *, char *);
+  extern void sqlite3_instvfs_destroy(sqlite3_vfs *);
+
+  sqlite3_vfs *pVfs = 0;
+  if( argc!=3 && (argc!=5 || strcmp("-log", argv[1])) ){
+    fprintf(stderr, "Usage: %s ?-log LOGFILE? FILENAME SQL-SCRIPT\n"
+                    "Runs SQL-SCRIPT against a UTF8 database\n",
+                    argv[0]);
+    exit(1);
+  }
+  if( argc==5 ){
+    pVfs = sqlite3_instvfs_binarylog("oslog", 0, argv[2]);
+    sqlite3_vfs_register(pVfs, 1);
+    argv += 2;
+  }
+#else
   if( argc!=3 ){
     fprintf(stderr, "Usage: %s FILENAME SQL-SCRIPT\n"
                     "Runs SQL-SCRIPT against a UTF8 database\n",
                     argv[0]);
     exit(1);
   }
+#endif
+
   in = fopen(argv[2], "r");
   fseek(in, 0L, SEEK_END);
   nSql = ftell(in);
@@ -148,5 +167,13 @@ int main(int argc, char **argv){
   printf("Open/Close time:      %15llu cycles\n", iSetup);
   printf("Total Time:           %15llu cycles\n",
       prepTime + runTime + finalizeTime + iSetup);
+
+#ifdef HAVE_OSINST
+  if( pVfs ){
+    sqlite3_instvfs_destroy(pVfs);
+    printf("vfs log written to %s\n", argv[0]);
+  }
+#endif
+
   return 0;
 }