Index: openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl,v diff -u -r1.27.2.1 -r1.27.2.2 --- openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl 16 Apr 2004 15:05:45 -0000 1.27.2.1 +++ openacs-4/packages/acs-developer-support/tcl/acs-developer-support-procs.tcl 21 May 2004 23:13:13 -0000 1.27.2.2 @@ -557,19 +557,20 @@ set ds_profile__start_clock($tag) [clock clicks -milliseconds] } stop { - if { [empty_string_p $tag] } { - error "Tag parameter is required" + if { ![empty_string_p $ds_profile__start_clock($tag)] } { + set num_ms [expr [clock clicks -milliseconds] - $ds_profile__start_clock($tag)] + set ds_profile__start_clock($tag) {} + + if { ![info exists ds_profile__total_ms($tag)] } { + set ds_profile__total_ms($tag) 0 + set ds_profile__iterations($tag) 0 + } + + set ds_profile__total_ms($tag) [expr [set ds_profile__total_ms($tag)] + $num_ms] + set ds_profile__iterations($tag) [expr [set ds_profile__iterations($tag)] + 1] + } else { + ns_log Error "ds_profile stop called without a corresponding call to ds_profile start, with tag $tag" } - set num_ms [expr [clock clicks -milliseconds] - $ds_profile__start_clock($tag)] - set ds_profile__start_clock($tag) {} - - if { ![info exists ds_profile__total_ms($tag)] } { - set ds_profile__total_ms($tag) 0 - set ds_profile__iterations($tag) 0 - } - - set ds_profile__total_ms($tag) [expr [set ds_profile__total_ms($tag)] + $num_ms] - set ds_profile__iterations($tag) [expr [set ds_profile__iterations($tag)] + 1] } log { if { ![empty_string_p $tag] } {