Tk Library Source Code

Artifact [52660cb8e2]
Login

Artifact 52660cb8e2e10cf31b0c87447a8842cd18ad28fb:

Attachment "profiler.diff" to ticket [446799ffff] added by hemanglavana 2001-08-01 22:15:28.
? profiler.diff
Index: profiler.n
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/profiler/profiler.n,v
retrieving revision 1.4
diff -r1.4 profiler.n
17a18,21
> \fB::profiler::suspend\fR
> .sp
> \fB::profiler::resume\fR
> .sp
80c84
< \fB::profiler::reset\fR ?\fIpattern\fR?
---
> \fB::profiler::reset\fR
82a87,100
> .TP
> \fB::profiler::suspend\fR ?\fIpattern\fR?
> Suspend profiling for all functions matching \fIpattern\fR.
> If no pattern is specified, profiling will be suspended for
> all functions. It stops gathering profiling information after
> this command is issued. However, it does not erase any profiling
> information that has been gathered previously.
> Use resume command to re-enable profiling.
> .TP
> \fB::profiler::resume\fR ?\fIpattern\fR?
> Resume profiling for all functions matching \fIpattern\fR.
> If no pattern is specified, profiling will be resumed for
> all functions.  This command should be invoked after suspending
> the profiler in the code.
Index: profiler.tcl
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/profiler/profiler.tcl,v
retrieving revision 1.15
diff -r1.15 profiler.tcl
15d14
<     variable enabled 1
123c122
<     if { $enabled } {
---
>     if { $enabled($name) } {
139c138
<     if { $enabled } {
---
>     if { $enabled($name) } {
175a175,176
>     variable enabled
>     variable paused
196a198
>     set enabled($name) [expr {!$paused}]
214a217,219
>     # paused is set to 1 when the profiler is suspended.
>     variable paused 0
> 
441a447,494
>     return
> }
> 
> # ::profiler::suspend --
> #
> #	Suspend the profiler.
> #
> # Arguments:
> #	pattern		pattern of functions to suspend; default is *.
> #
> # Results:
> #	None.  Resets the `enabled($name)' variable to 0
> #	       to suspend profiling
> 
> proc ::profiler::suspend {{pattern *}} {
>     variable callCount
>     variable enabled
>     variable paused
> 
>     set paused 1
>     foreach name [array names callCount $pattern] {
>         set enabled($name) 0
>     }
> 
>     return
> }
> 
> # ::profiler::resume --
> #
> #	Resume the profiler, after it has been suspended.
> #
> # Arguments:
> #	pattern		pattern of functions to suspend; default is *.
> #
> # Results:
> #	None.  Sets the `enabled($name)' variable to 1
> #	       so as to enable the profiler.
> 
> proc ::profiler::resume {{pattern *}} {
>     variable callCount
>     variable enabled
>     variable paused
> 
>     set paused 0
>     foreach name [array names callCount $pattern] {
>         set enabled($name) 1
>     }
>