aboutsummaryrefslogtreecommitdiff
path: root/profile_proc.tcl
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2018-05-09 23:11:55 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2018-05-09 23:11:55 -0400
commit04ae6e7aa22e7aafb532af183459efb9ff29ffa9 (patch)
tree00f03be6d89aba842fe828ecc104e7ef1ab1db28 /profile_proc.tcl
parent4fd5f052b95361e142a6224cd0e9225f8c13e5bd (diff)
downloadGradeBook-04ae6e7aa22e7aafb532af183459efb9ff29ffa9.tar.gz
GradeBook-04ae6e7aa22e7aafb532af183459efb9ff29ffa9.zip
added script to profile a procedure
Diffstat (limited to 'profile_proc.tcl')
-rwxr-xr-xprofile_proc.tcl37
1 files changed, 37 insertions, 0 deletions
diff --git a/profile_proc.tcl b/profile_proc.tcl
new file mode 100755
index 0000000..0238d16
--- /dev/null
+++ b/profile_proc.tcl
@@ -0,0 +1,37 @@
+#!/bin/sh
+# (C) 2011 by Eugeniy Mikhailov, <evgmik@gmail.com>
+# vim:set ft=tcl: \
+exec tclsh "$0" "$@"
+
+package require sqlite3
+package require md5
+package require json::write
+source ./profiler.tcl
+source ./GradeBook_lib.tcl
+
+if { $argc < 2 } {
+ puts {Profile and test built-in library procs}
+ puts {Usage:}
+ puts " $argv0 database_name ProcName \[arg1\] \[arg2\] \[arg3\] ..."
+ puts {}
+ puts {Example:}
+ puts [join [list { } $argv0 tests/test_class.db UpdateGradesTableStatistic dummy1 dummy2] " "]
+ exit
+}
+
+set dbfile [lindex $argv 0]
+set ProcName [lindex $argv 1]
+set arg_list [lrange $argv 2 end]
+
+sqlite3 db $dbfile
+
+$ProcName {*}$arg_list
+
+global TimeProfilerMode
+if { [info exists TimeProfilerMode] } {
+ TimeProfilerDump description
+ }
+
+db close
+
+# vim: ts=2 sw=2 foldmethod=indent: