Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: third_party/sqlite/sqlite-src-3170000/tool/vdbe_profile.tcl

Issue 2747283002: [sql] Import reference version of SQLite 3.17.. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/bin/tclsh
2 #
3 # SUMMARY:
4 # Run this script in the same directory as the "vdbe_profile.out" file.
5 # This script summarizes the results contained in that file.
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 #
14 if {![file readable vdbe_profile.out]} {
15 error "run this script in the same directory as the vdbe_profile.out file"
16 }
17 set in [open vdbe_profile.out r]
18 set stmt {}
19 set allstmt {}
20 while {![eof $in]} {
21 set line [gets $in]
22 if {$line==""} continue
23 if {[regexp {^---- } $line]} {
24 set stmt [lindex $line 1]
25 if {[info exists cnt($stmt)]} {
26 incr cnt($stmt)
27 set firsttime 0
28 } else {
29 set cnt($stmt) 1
30 set sql($stmt) {}
31 set firsttime 1
32 lappend allstmt $stmt
33 }
34 continue;
35 }
36 if {[regexp {^-- } $line]} {
37 if {$firsttime} {
38 append sql($stmt) [string range $line 3 end]\n
39 }
40 continue
41 }
42 if {![regexp {^ *\d+ *\d+ *\d+ *\d+ ([A-Z].*)} $line all detail]} continue
43 set c [lindex $line 0]
44 set t [lindex $line 1]
45 set addr [lindex $line 3]
46 set op [lindex $line 4]
47 if {[info exists opcnt($op)]} {
48 incr opcnt($op) $c
49 incr opcycle($op) $t
50 } else {
51 set opcnt($op) $c
52 set opcycle($op) $t
53 }
54 if {[info exists stat($stmt,$addr)]} {
55 foreach {cx tx detail} $stat($stmt,$addr) break
56 incr cx $c
57 incr tx $t
58 set stat($stmt,$addr) [list $cx $tx $detail]
59 } else {
60 set stat($stmt,$addr) [list $c $t $detail]
61 }
62 }
63 close $in
64
65 foreach stmt $allstmt {
66 puts "********************************************************************"
67 puts [string trim $sql($stmt)]
68 puts "Execution count: $cnt($stmt)"
69 for {set i 0} {[info exists stat($stmt,$i)]} {incr i} {
70 foreach {cx tx detail} $stat($stmt,$i) break
71 if {$cx==0} {
72 set ax 0
73 } else {
74 set ax [expr {$tx/$cx}]
75 }
76 puts [format {%8d %12d %12d %4d %s} $cx $tx $ax $i $detail]
77 }
78 }
79 puts "********************************************************************"
80 puts "OPCODES:"
81 foreach op [lsort [array names opcnt]] {
82 set cx $opcnt($op)
83 set tx $opcycle($op)
84 if {$cx==0} {
85 set ax 0
86 } else {
87 set ax [expr {$tx/$cx}]
88 }
89 puts [format {%8d %12d %12d %s} $cx $tx $ax $op]
90 }
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3170000/tool/vdbe-compress.tcl ('k') | third_party/sqlite/sqlite-src-3170000/tool/warnings.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698