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

Unified Diff: third_party/sqlite/src/tool/opcodesum.tcl

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/tool/mkvsix.tcl ('k') | third_party/sqlite/src/tool/replace.tcl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/tool/opcodesum.tcl
diff --git a/third_party/sqlite/src/tool/opcodesum.tcl b/third_party/sqlite/src/tool/opcodesum.tcl
new file mode 100644
index 0000000000000000000000000000000000000000..47dff32b9075001fc2dd378e6d82dc2f62f3483f
--- /dev/null
+++ b/third_party/sqlite/src/tool/opcodesum.tcl
@@ -0,0 +1,34 @@
+#!/usr/bin/tclsh
+#
+# Run this script, redirecting input from cachegrind output, to compute the
+# number of CPU cycles used by each VDBE opcode.
+#
+# The cachegrind output should be configured so that it reports a single
+# column of Ir at the left margin. Ex:
+#
+# cg_annotation --show=Ir --auto=yes cachegrind.out.* | tclsh opcodesum.tcl
+#
+set currentop x
+set ncycle(x) 0
+while {![eof stdin]} {
+ set line [string map {\173 x \175 x \042 x} [gets stdin]]
+ if {[regexp { \. case OP_.*:} $line]} {
+ regexp {OP_(.+):} $line all currentop
+ set ncycle($currentop) 0
+ } elseif {[lindex $line 1]=="default:"
+ && [regexp {really OP_Noop and OP_Explain} $line]} {
+ break
+ } elseif {[lindex $line 0]!="."} {
+ regsub -all {[^0-9]} [lindex $line 0] {} n
+ if {$n!=""} {incr ncycle($currentop) $n}
+ }
+}
+unset ncycle(x)
+set results {}
+foreach op [lsort [array names ncycle]] {
+ if {$ncycle($op)==0} continue
+ lappend results [list $ncycle($op) $op]
+}
+foreach entry [lsort -index 0 -int -decr $results] {
+ puts [format {%-16s %10d} [lindex $entry 1] [lindex $entry 0]]
+}
« no previous file with comments | « third_party/sqlite/src/tool/mkvsix.tcl ('k') | third_party/sqlite/src/tool/replace.tcl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698