/ Check-in [96cf821b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add a simple TCL script for summing cachegrind information for each VDBE opcode.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:96cf821b6a69e2e8df33271b7bb674bd12a1ef7b
User & Date: drh 2016-05-20 23:51:14
Original Comment: Add a simple TCL script for summing cachegrind information for each VDBE opcdoe.
Context
2016-05-21
00:45
Add the shell-script used for routine performance testing. check-in: 8e366f18 user: drh tags: trunk
2016-05-20
23:51
Add a simple TCL script for summing cachegrind information for each VDBE opcode. check-in: 96cf821b user: drh tags: trunk
21:40
Another optimization on the OP_Column opcode. check-in: 1765672c user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added tool/opcodesum.tcl.





































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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]]
}