ds_profile (public)
ds_profile command [ tag ]
Defined in packages/acs-developer-support/tcl/acs-developer-support-procs.tcl
Helper proc for performance profiling of templates. This will record the total time spent within an invocation of a template (computed as time between the 'ds_profile start' and 'ds_profile stop' invocations inserted by the template engine).
- Parameters:
- command (required)
- Must be "start" or "stop".
- tag (optional)
- In practice, the path to the template being profiled.
- start marks the beginning of a block.
- stop marks the end of a block. Start and stops must match.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- ds_add_test
Source code: if {![ds_enabled_p]} { error "DS not enabled" } switch $command { start { if { $tag eq "" } { error "Tag parameter is required" } set ::ds_profile__start_clock($tag) [clock clicks -microseconds] } stop { if { [info exists ::ds_profile__start_clock($tag)] && $::ds_profile__start_clock($tag) ne "" } { ds_add prof $tag [expr {[clock clicks -microseconds] - $::ds_profile__start_clock($tag)}] unset ::ds_profile__start_clock($tag) } else { ns_log Warning "ds_profile stop called without a corresponding call to ds_profile start, with tag $tag" } } default { error "Invalid command. Valid commands are 'start', 'stop', and 'log'." } }XQL Not present: Generic, PostgreSQL, Oracle