Files
TheRock/rocm-systems/projects/rocprofiler-sdk/external/sqlite/tool/vdbe_profile.tcl
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

97 lines
2.5 KiB
Tcl

#!/bin/tclsh
#
# SUMMARY:
# Run this script in the same directory as the "vdbe_profile.out" file.
# This script summarizes the results contained in that file.
#
# DETAILS:
# Compile SQLite using the -DVDBE_PROFILE option on Linux. This causes
# performance information about individual VDBE operations to be appended
# to the "vdbe_profile.out" file. After content has been accumulated in
# vdbe_profile.out, run this script to analyze the output and generate a
# report.
#
if {![file readable vdbe_profile.out]} {
error "run this script in the same directory as the vdbe_profile.out file"
}
set in [open vdbe_profile.out r]
set stmt {}
set allstmt {}
while {![eof $in]} {
set line [gets $in]
if {$line==""} continue
if {[regexp {^---- } $line]} {
set stmt [lindex $line 1]
if {[info exists cnt($stmt)]} {
incr cnt($stmt)
set firsttime 0
} else {
set cnt($stmt) 1
set sql($stmt) {}
set firsttime 1
lappend allstmt $stmt
}
continue;
}
if {[regexp {^-- } $line]} {
if {$firsttime} {
append sql($stmt) [string range $line 3 end]\n
}
continue
}
if {![regexp {^ *\d+ *\d+ *\d+ *\d+ ([A-Z].*)} $line all detail]} continue
set c [lindex $line 0]
set t [lindex $line 1]
set addr [lindex $line 3]
set op [lindex $line 4]
if {[info exists opcnt($op)]} {
incr opcnt($op) $c
incr opcycle($op) $t
} else {
set opcnt($op) $c
set opcycle($op) $t
}
if {[info exists stat($stmt,$addr)]} {
foreach {cx tx detail} $stat($stmt,$addr) break
incr cx $c
incr tx $t
set stat($stmt,$addr) [list $cx $tx $detail]
} else {
set stat($stmt,$addr) [list $c $t $detail]
}
}
close $in
foreach stmt $allstmt {
puts "********************************************************************"
puts [string trim $sql($stmt)]
puts "Execution count: $cnt($stmt)"
set tcx 0
set ttx 0
for {set i 0} {[info exists stat($stmt,$i)]} {incr i} {
foreach {cx tx detail} $stat($stmt,$i) break
if {$cx==0} {
set ax 0
} else {
set ax [expr {$tx/$cx}]
}
puts [format {%8d %12d %12d %4d %s} $cx $tx $ax $i $detail]
incr tcx $cx
incr ttx $tx
}
set tax [expr {$tcx>0?$ttx/$tcx:0}]
puts [format {%8d %12d %12d TOTAL} $tcx $ttx $tax]
}
puts "********************************************************************"
puts "OPCODES:"
foreach op [lsort [array names opcnt]] {
set cx $opcnt($op)
set tx $opcycle($op)
if {$cx==0} {
set ax 0
} else {
set ax [expr {$tx/$cx}]
}
puts [format {%8d %12d %12d %s} $cx $tx $ax $op]
}