OLD | NEW |
1 #!/bin/tclsh | 1 #!/bin/tclsh |
2 # | 2 # |
| 3 # SUMMARY: |
3 # Run this script in the same directory as the "vdbe_profile.out" file. | 4 # Run this script in the same directory as the "vdbe_profile.out" file. |
4 # This script summarizes the results contained in that file. | 5 # This script summarizes the results contained in that file. |
5 # | 6 # |
| 7 # DETAILS: |
| 8 # Compile SQLite using the -DVDBE_PROFILE option on Linux. This causes |
| 9 # performance information about individual VDBE operations to be appended |
| 10 # to the "vdbe_profile.out" file. After content has been accumulated in |
| 11 # vdbe_profile.out, run this script to analyze the output and generate a |
| 12 # report. |
| 13 # |
6 if {![file readable vdbe_profile.out]} { | 14 if {![file readable vdbe_profile.out]} { |
7 error "run this script in the same directory as the vdbe_profile.out file" | 15 error "run this script in the same directory as the vdbe_profile.out file" |
8 } | 16 } |
9 set in [open vdbe_profile.out r] | 17 set in [open vdbe_profile.out r] |
10 set stmt {} | 18 set stmt {} |
11 set allstmt {} | 19 set allstmt {} |
12 while {![eof $in]} { | 20 while {![eof $in]} { |
13 set line [gets $in] | 21 set line [gets $in] |
14 if {$line==""} continue | 22 if {$line==""} continue |
15 if {[regexp {^---- } $line]} { | 23 if {[regexp {^---- } $line]} { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 foreach op [lsort [array names opcnt]] { | 81 foreach op [lsort [array names opcnt]] { |
74 set cx $opcnt($op) | 82 set cx $opcnt($op) |
75 set tx $opcycle($op) | 83 set tx $opcycle($op) |
76 if {$cx==0} { | 84 if {$cx==0} { |
77 set ax 0 | 85 set ax 0 |
78 } else { | 86 } else { |
79 set ax [expr {$tx/$cx}] | 87 set ax [expr {$tx/$cx}] |
80 } | 88 } |
81 puts [format {%8d %12d %12d %s} $cx $tx $ax $op] | 89 puts [format {%8d %12d %12d %s} $cx $tx $ax $op] |
82 } | 90 } |
OLD | NEW |