From: danielk1977 Date: Thu, 10 Apr 2008 17:27:38 +0000 (+0000) Subject: Add the --ostrace and --ossummary options to tester.tcl. To log calls the vfs layer... X-Git-Tag: version-3.6.10~1193 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e21fd523b6cc21fc5e962a3f481685c42308368;p=thirdparty%2Fsqlite.git Add the --ostrace and --ossummary options to tester.tcl. To log calls the vfs layer from within test scripts. (CVS 4984) FossilOrigin-Name: e1322415d0ca2d6b45f35ef9257b37161ec043e2 --- diff --git a/manifest b/manifest index 7a6248338c..5557214c1b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhanced\stesting\sand\sdocumentation\sof\ssqlite3_result_error_code().\nTicket\s#2940.\s(CVS\s4983) -D 2008-04-10T17:14:07 +C Add\sthe\s--ostrace\sand\s--ossummary\soptions\sto\stester.tcl.\sTo\slog\scalls\sthe\svfs\slayer\sfrom\swithin\stest\sscripts.\s(CVS\s4984) +D 2008-04-10T17:27:39 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 b6ef38b4b363a83597f9228d8bf9f63d7dc1f801 +F src/test_osinst.c 1a2d6de4ce031ccc53fb346be2352173465f4e2e F src/test_schema.c 12c9de7661d6294eec2d57afbb52e2af1128084f F src/test_server.c a6ece6c835e7eae835054124e09e947e422b1ac5 F src/test_tclvar.c b2d1115e4d489179d3f029e765211b2ad527ba59 @@ -456,7 +456,7 @@ F test/table.test 13b1c2e2fb4727b35ee1fb7641fc469214fd2455 F test/tableapi.test 791f7e3891d9b70bdb43b311694bf5e9befcbc34 F test/tclsqlite.test 3fac87cb1059c46b8fa8a60b553f4f1adb0fb6d9 F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125 -F test/tester.tcl 5d1550b66790c928c1bb7c299a18ea0a83be0ab2 +F test/tester.tcl 7820fa85db914ef8cfff72b689fd4a9ed8712cec F test/thread001.test 8fbd9559da0bbdc273e00318c7fd66c162020af7 F test/thread002.test 2c4ad2c386f60f6fe268cd91c769ee35b3c1fd0b F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35 @@ -626,7 +626,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 1e094ecfd7c6feaf8d524aa3c1477910b2328946 -R 76aadead09a9d806a27a54dca07b7abd -U drh -Z b01d010606845cba682f38fd64039c7c +P 5be56dbe879f89351239accf5069e4cb166e0792 +R d1764f0c0bff8d613b92eb445b05f051 +U danielk1977 +Z 5ce16846520ccc3e314c2b13bb59694a diff --git a/manifest.uuid b/manifest.uuid index cba6a46735..78b7774805 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5be56dbe879f89351239accf5069e4cb166e0792 \ No newline at end of file +e1322415d0ca2d6b45f35ef9257b37161ec043e2 \ No newline at end of file diff --git a/src/test_osinst.c b/src/test_osinst.c index 28f8fd3f4c..f0a1b9bd65 100644 --- a/src/test_osinst.c +++ b/src/test_osinst.c @@ -215,6 +215,7 @@ static sqlite3_io_methods inst_io_methods = { ** processor and returns that value. This can be used for high-res ** profiling. */ +#if defined(i386) || defined(__i386__) || defined(_M_IX86) __inline__ unsigned long long int hwtime(void){ unsigned long long int x; __asm__("rdtsc\n\t" @@ -222,6 +223,9 @@ __inline__ unsigned long long int hwtime(void){ :"=A" (x)); return x; } +#else + static unsigned long long int hwtime(void){ return 0; } +#endif #define OS_TIME_IO(eEvent, A, B, Call) { \ inst_file *p = (inst_file *)pFile; \ @@ -518,6 +522,7 @@ 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); } @@ -646,18 +651,25 @@ static int test_sqlite3_instvfs( case IV_CREATE: { char *zParent = 0; sqlite3_vfs *p; - if( objc!=4 && objc!=3 ){ - Tcl_WrongNumArgs(interp, 2, objv, "NAME ?PARENT-VFS?"); + int isDefault = 0; + if( objc>2 && 0==strcmp("-default", Tcl_GetString(objv[2])) ){ + isDefault = 1; + } + if( (objc-isDefault)!=4 && (objc-isDefault)!=3 ){ + Tcl_WrongNumArgs(interp, 2, objv, "?-default? NAME ?PARENT-VFS?"); return TCL_ERROR; } - if( objc==4 ){ - zParent = Tcl_GetString(objv[3]); + if( objc==(4+isDefault) ){ + zParent = Tcl_GetString(objv[3+isDefault]); } - p = sqlite3_instvfs_create(Tcl_GetString(objv[2]), zParent); + p = sqlite3_instvfs_create(Tcl_GetString(objv[2+isDefault]), zParent); if( !p ){ Tcl_AppendResult(interp, "error creating vfs ", 0); return TCL_ERROR; } + if( isDefault ){ + sqlite3_vfs_register(p, 1); + } Tcl_SetObjResult(interp, objv[2]); break; } diff --git a/test/tester.tcl b/test/tester.tcl index b812782e9a..d172d4df07 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -11,7 +11,7 @@ # This file implements some common TCL routines used for regression # testing the SQLite library # -# $Id: tester.tcl,v 1.113 2008/03/29 11:00:55 drh Exp $ +# $Id: tester.tcl,v 1.114 2008/04/10 17:27:39 danielk1977 Exp $ # # What for user input before continuing. This gives an opportunity @@ -61,7 +61,6 @@ for {set i 0} {$i<[llength $argv]} {incr i} { set argv [lreplace $argv $i $i] sqlite3_memdebug_backtrace 10 sqlite3_memdebug_log start - set argv [lreplace $argv $i $i] set tester_do_malloctrace 1 } } @@ -72,6 +71,28 @@ for {set i 0} {$i<[llength $argv]} {incr i} { } } + +proc ostrace_call {zCall nClick zFile i32 i64} { + set s "INSERT INTO ostrace VALUES( '$zCall', $nClick, '$zFile', $i32, $i64);" + puts $::ostrace_fd $s +} + +for {set i 0} {$i<[llength $argv]} {incr i} { + if {[lindex $argv $i] eq "--ossummary" || [lindex $argv $i] eq "--ostrace"} { + sqlite3_instvfs create -default ostrace + set tester_do_ostrace 1 + set ostrace_fd [open ostrace.sql w] + puts $ostrace_fd "BEGIN;" + if {[lindex $argv $i] eq "--ostrace"} { + set s "CREATE TABLE ostrace" + append s "(method TEXT, clicks INT, file TEXT, i32 INT, i64 INT);" + puts $ostrace_fd $s + sqlite3_instvfs configure ostrace ostrace_call + } + set argv [lreplace $argv $i $i] + } +} + # # Check the command-line arguments to set the maximum number of # errors tolerated before halting. @@ -249,6 +270,20 @@ proc finalize_testing {} { puts "$sqlite_open_file_count files were left open" incr nErr } + if {[info exists ::tester_do_ostrace]} { + puts "Writing ostrace.sql..." + set fd $::ostrace_fd + + puts -nonewline $fd "CREATE TABLE ossummary" + puts $fd "(method TEXT, clicks INTEGER, count INTEGER);" + foreach row [sqlite3_instvfs report ostrace] { + foreach {method count clicks} $row break + puts $fd "INSERT INTO ossummary VALUES('$method', $clicks, $count);" + } + puts $fd "COMMIT;" + close $fd + sqlite3_instvfs destroy ostrace + } if {[sqlite3_memory_used]>0} { puts "Unfreed memory: [sqlite3_memory_used] bytes" incr nErr