| Description: |
I am a little confused about the tcllib profiler
package. I am using
the 8.4.9 distribution on Windows XP, which includes
profiler 0.2.2.
Here is my elaborate test program.
package require profiler
::profiler::init
proc c1 { a } { for {set i 0} {$i<2000} {incr i} {;} }
proc c2 { a } { for {set i 0} {$i<2000} {incr i} {;} }
proc parent { } { for {set i 0} {$i<2000} {incr i} {
c1 $i ; c2 $i }
}
parent
::profiler::dump ::parent
The output is:
::parent {callCount 1 callerDist {GLOBAL 1}
compileTime 2816000
totalRuntime 2816000 averageRuntime 0 stddevRuntime 0
covpercentRuntime 0 descendantTime 0
averageDescendantTime 0
descendants {}}
The descendants data I would expect is like {c1 2000 c2
2000}.
The time reporting also seems wrong; how can all the
time be
reported as compile time with zero descendant time?
All the
time is spent in the children.
Am I missing something, or is this output completely
wrong?
|
| User Comments: |
ericm added on 2005-03-31 05:46:36:
Logged In: YES
user_id=86324
This seems to be a simple bug caused by the fact that Tcl
has two
logically-equivalent-but-not-actually-string-equivalent
names for commands: one which includes the "::" prefix
indicating the global namespace, and one which does not.
The profiler is saving descendent information using the
unscoped name (no "::" prefix), but then trying to query it
using the scoped name (with a "::" prefix).
I added code to the profiler to try and account for this.
It should work in most scenarios, but I didn't test it
exhaustively, so there may be corner cases not handled
correctly.
|