Fix the VDBE_PROFILE logic. Add a script to process the output file.
FossilOrigin-Name: 7adb3da235c8c162c84f05ef4ccf1cc463805d5f
This commit is contained in:
parent
cfc6ca4179
commit
2926f9694f
13
manifest
13
manifest
@ -1,5 +1,5 @@
|
||||
C Seek\spast\sNULLs\sin\sa\stop-constrained\ssearch.\s\sAvoid\schecking\sfor\sNULLs\sin\nthe\sbody\sof\sthe\ssearch.
|
||||
D 2014-02-14T23:49:13.552
|
||||
C Fix\sthe\sVDBE_PROFILE\slogic.\s\sAdd\sa\sscript\sto\sprocess\sthe\soutput\sfile.
|
||||
D 2014-02-17T01:13:28.650
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -281,7 +281,7 @@ F src/vdbe.c 543ed4ed0c41b34affad239374d4c07e6e5b2401
|
||||
F src/vdbe.h e6c4c610fcabad4fa80ebb1efc6822a9367e2b26
|
||||
F src/vdbeInt.h 5286af9067cabdb8ba57b87c0c988a931be6c6c8
|
||||
F src/vdbeapi.c 5bc41aaea448a7fc250902c418f1795859be3820
|
||||
F src/vdbeaux.c dac6e571262a322b2f889752a8dd36549bdacd2b
|
||||
F src/vdbeaux.c 9098973ff22c6fdfd68d061e11c2e64f65eea2d1
|
||||
F src/vdbeblob.c 9542e116c1db5ed813977581d506c176e117c0ec
|
||||
F src/vdbemem.c 06603e8e9d2f3247b68c6bbe4bd37fb6721b5bda
|
||||
F src/vdbesort.c 9d83601f9d6243fe70dd0169a2820c5ddfd48147
|
||||
@ -1147,10 +1147,11 @@ F tool/symbols-mingw.sh 4dbcea7e74768305384c9fd2ed2b41bbf9f0414d
|
||||
F tool/symbols.sh fec58532668296d7c7dc48be9c87f75ccdb5814f
|
||||
F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
|
||||
F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891
|
||||
F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
|
||||
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
|
||||
P 3c1ae447dec8fc2af1c5105134061717594ac0e0
|
||||
R 20e62eafcdc3ac9a7a16fa36432e6177
|
||||
P e07a32f30862acf3b322d4d8deb015846d6f8f5f
|
||||
R a089b7b7dc577bc47ffd22f19eb9e985
|
||||
U drh
|
||||
Z f35a13e794e2689c6821aa3d892fcd6f
|
||||
Z f101c06fe6a48199aebfe3f4c9baeea7
|
||||
|
@ -1 +1 @@
|
||||
e07a32f30862acf3b322d4d8deb015846d6f8f5f
|
||||
7adb3da235c8c162c84f05ef4ccf1cc463805d5f
|
@ -1174,7 +1174,7 @@ void sqlite3VdbePrintOp(FILE *pOut, int pc, Op *pOp){
|
||||
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
|
||||
displayComment(pOp, zP4, zCom, sizeof(zCom));
|
||||
#else
|
||||
zCom[0] = 0
|
||||
zCom[0] = 0;
|
||||
#endif
|
||||
/* NB: The sqlite3OpcodeName() function is implemented by code created
|
||||
** by the mkopcodeh.awk and mkopcodec.awk scripts which extract the
|
||||
@ -2552,6 +2552,16 @@ int sqlite3VdbeReset(Vdbe *p){
|
||||
fprintf(out, "%02x", p->aOp[i].opcode);
|
||||
}
|
||||
fprintf(out, "\n");
|
||||
if( p->zSql ){
|
||||
char c, pc = 0;
|
||||
fprintf(out, "-- ");
|
||||
for(i=0; (c = p->zSql[i])!=0; i++){
|
||||
if( pc=='\n' ) fprintf(out, "-- ");
|
||||
putc(c, out);
|
||||
pc = c;
|
||||
}
|
||||
if( pc!='\n' ) fprintf(out, "\n");
|
||||
}
|
||||
for(i=0; i<p->nOp; i++){
|
||||
fprintf(out, "%6d %10lld %8lld ",
|
||||
p->aOp[i].cnt,
|
||||
|
82
tool/vdbe_profile.tcl
Normal file
82
tool/vdbe_profile.tcl
Normal file
@ -0,0 +1,82 @@
|
||||
#!/bin/tclsh
|
||||
#
|
||||
# Run this script in the same directory as the "vdbe_profile.out" file.
|
||||
# This script summarizes the results contained in that file.
|
||||
#
|
||||
if {![file readable vdbe_profile.out]} {
|
||||
error "run this script in the same directory as the vdbe_profile.out file"
|
||||
}
|
||||
set in [open vdbe_profile.out r]
|
||||
set stmt {}
|
||||
set allstmt {}
|
||||
while {![eof $in]} {
|
||||
set line [gets $in]
|
||||
if {$line==""} continue
|
||||
if {[regexp {^---- } $line]} {
|
||||
set stmt [lindex $line 1]
|
||||
if {[info exists cnt($stmt)]} {
|
||||
incr cnt($stmt)
|
||||
set firsttime 0
|
||||
} else {
|
||||
set cnt($stmt) 1
|
||||
set sql($stmt) {}
|
||||
set firsttime 1
|
||||
lappend allstmt $stmt
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if {[regexp {^-- } $line]} {
|
||||
if {$firsttime} {
|
||||
append sql($stmt) [string range $line 3 end]\n
|
||||
}
|
||||
continue
|
||||
}
|
||||
if {![regexp {^ *\d+ *\d+ *\d+ *\d+ ([A-Z].*)} $line all detail]} continue
|
||||
set c [lindex $line 0]
|
||||
set t [lindex $line 1]
|
||||
set addr [lindex $line 3]
|
||||
set op [lindex $line 4]
|
||||
if {[info exists opcnt($op)]} {
|
||||
incr opcnt($op) $c
|
||||
incr opcycle($op) $t
|
||||
} else {
|
||||
set opcnt($op) $c
|
||||
set opcycle($op) $t
|
||||
}
|
||||
if {[info exists stat($stmt,$addr)]} {
|
||||
foreach {cx tx detail} $stat($stmt,$addr) break
|
||||
incr cx $c
|
||||
incr tx $t
|
||||
set stat($stmt,$addr) [list $cx $tx $detail]
|
||||
} else {
|
||||
set stat($stmt,$addr) [list $c $t $detail]
|
||||
}
|
||||
}
|
||||
close $in
|
||||
|
||||
foreach stmt $allstmt {
|
||||
puts "********************************************************************"
|
||||
puts [string trim $sql($stmt)]
|
||||
puts "Execution count: $cnt($stmt)"
|
||||
for {set i 0} {[info exists stat($stmt,$i)]} {incr i} {
|
||||
foreach {cx tx detail} $stat($stmt,$i) break
|
||||
if {$cx==0} {
|
||||
set ax 0
|
||||
} else {
|
||||
set ax [expr {$tx/$cx}]
|
||||
}
|
||||
puts [format {%8d %12d %12d %4d %s} $cx $tx $ax $i $detail]
|
||||
}
|
||||
}
|
||||
puts "********************************************************************"
|
||||
puts "OPCODES:"
|
||||
foreach op [lsort [array names opcnt]] {
|
||||
set cx $opcnt($op)
|
||||
set tx $opcycle($op)
|
||||
if {$cx==0} {
|
||||
set ax 0
|
||||
} else {
|
||||
set ax [expr {$tx/$cx}]
|
||||
}
|
||||
puts [format {%8d %12d %12d %s} $cx $tx $ax $op]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user