3 # Run this script in the same directory as the "vdbe_profile.out" file.
4 # This script summarizes the results contained in that file.
6 if {![file readable vdbe_profile.out
]} {
7 error "run this script in the same directory as the vdbe_profile.out file"
9 set in
[open vdbe_profile.out r
]
14 if {$line==""} continue
15 if {[regexp {^
---- } $line]} {
16 set stmt
[lindex $line 1]
17 if {[info exists cnt
($stmt)]} {
28 if {[regexp {^
-- } $line]} {
30 append sql
($stmt) [string range
$line 3 end
]\n
34 if {![regexp {^
*\d
+ *\d
+ *\d
+ *\d
+ ([A-Z
].
*)} $line all detail
]} continue
35 set c
[lindex $line 0]
36 set t
[lindex $line 1]
37 set addr
[lindex $line 3]
38 set op
[lindex $line 4]
39 if {[info exists opcnt
($op)]} {
46 if {[info exists stat
($stmt,$addr)]} {
47 foreach {cx tx detail
} $stat($stmt,$addr) break
50 set stat
($stmt,$addr) [list $cx $tx $detail]
52 set stat
($stmt,$addr) [list $c $t $detail]
57 foreach stmt
$allstmt {
58 puts "********************************************************************"
59 puts [string trim
$sql($stmt)]
60 puts "Execution count: $cnt($stmt)"
61 for {set i
0} {[info exists stat
($stmt,$i)]} {incr i
} {
62 foreach {cx tx detail
} $stat($stmt,$i) break
66 set ax
[expr {$tx/$cx}]
68 puts [format {%8d
%12d
%12d
%4d
%s
} $cx $tx $ax $i $detail]
71 puts "********************************************************************"
73 foreach op
[lsort [array names opcnt
]] {
79 set ax
[expr {$tx/$cx}]
81 puts [format {%8d
%12d
%12d
%s
} $cx $tx $ax $op]