1profiler(n)                      Tcl Profiler                      profiler(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       profiler - Tcl source code profiler
9

SYNOPSIS

11       package require Tcl  8.3
12
13       package require profiler  ?0.3?
14
15       ::profiler::init
16
17       ::profiler::dump pattern
18
19       ::profiler::print ?pattern?
20
21       ::profiler::reset ?pattern?
22
23       ::profiler::suspend ?pattern?
24
25       ::profiler::resume ?pattern?
26
27       ::profiler::sortFunctions key
28
29_________________________________________________________________
30

DESCRIPTION

32       The profiler package provides a simple Tcl source code profiler.  It is
33       a function-level profiler; that is,  it  collects  only  function-level
34       information, not the more detailed line-level information.  It operates
35       by redefining the Tcl proc command.  Profiling  is  initiated  via  the
36       ::profiler::init command.
37

COMMANDS

39       ::profiler::init
40              Initiate  profiling.   All procedures created after this command
41              is called will be profiled.  To profile an  entire  application,
42              this command must be called before any other commands.
43
44       ::profiler::dump pattern
45              Dump  profiling  information for the all functions matching pat‐
46              tern.  If no pattern is specified, information for all functions
47              will  be returned.  The result is a list of key/value pairs that
48              maps function names to information  about  that  function.   The
49              information  about  each function is in turn a list of key/value
50              pairs.  The keys used and their values are:
51
52              totalCalls
53                     The total number of times functionName was called.
54
55              callerDist
56                     A list of key/value pairs mapping each  calling  function
57                     that called functionName to the number of times it called
58                     functionName.
59
60              compileTime
61                     The runtime, in clock clicks, of functionName  the  first
62                     time that it was called.
63
64              totalRuntime
65                     The sum of the runtimes of all calls of functionName.
66
67              averageRuntime
68                     Average runtime of functionName.
69
70              descendantTime
71                     Sum of the time spent in descendants of functionName.
72
73              averageDescendantTime
74                     Average time spent in descendants of functionName.
75
76       ::profiler::print ?pattern?
77              Print  profiling information for all functions matching pattern.
78              If no pattern is specified, information about all functions will
79              be  displayed.  The return result is a human readable display of
80              the profiling information.
81
82       ::profiler::reset ?pattern?
83              Reset profiling information for all functions matching  pattern.
84              If  no  pattern  is specified, information will be reset for all
85              functions.
86
87       ::profiler::suspend ?pattern?
88              Suspend profiling for all functions  matching  pattern.   If  no
89              pattern  is specified, profiling will be suspended for all func‐
90              tions. It stops gathering profiling information after this  com‐
91              mand  is issued. However, it does not erase any profiling infor‐
92              mation that has been gathered previously.  Use resume command to
93              re-enable profiling.
94
95       ::profiler::resume ?pattern?
96              Resume profiling for all functions matching pattern.  If no pat‐
97              tern is specified, profiling will be resumed for all  functions.
98              This  command should be invoked after suspending the profiler in
99              the code.
100
101       ::profiler::sortFunctions key
102              Return a list of functions  sorted  by  a  particular  profiling
103              statistic.   Supported values for key are: calls, exclusiveTime,
104              compileTime, nonCompileTime, totalRuntime, avgExclusiveTime, and
105              avgRuntime.   The  return  result is a list of lists, where each
106              sublist consists of a function name and the  value  of  key  for
107              that function.
108

KEYWORDS

110       performance, profile, speed
111
112
113
114profiler                              0.3                          profiler(n)
Impressum