3 prof, tprof, kprof \- display profiling data
24 interprets files produced automatically by programs loaded using the
29 The symbol table in the
35 is read and correlated with the
39 For each symbol, the percentage
40 of time (in seconds) spent executing between that symbol
42 is printed (in decreasing order),
43 together with the time spent there and
44 the number of times that routine was called.
49 prints the dynamic call graph of the target program,
50 annotating the calls with the time spent in each routine
51 and those it calls, recursively. The output is indented
52 two spaces for each call, and is formatted as
60 is the entry point of the call,
65 is the number of times that entry point was called at that
66 point in the call graph. If
71 Normally recursive calls are compressed to keep the output brief;
74 prints the full call graph.
76 The size of the buffer
79 used to hold the profiling
80 data, by default 2000 entries,
81 may be controlled by setting the environment variable
85 If the buffer fills, subsequent function calls may not be recorded.
87 The profiling code provided by the linker initializes itself to profile the current pid,
88 producing a file called
90 If a process forks, only the parent will continue to be profiled. Forked children
91 can cause themselves to be profile by calling
94 prof(fn, arg, entries, what)
97 which causes the function \f2fn\fP(\f2arg\fP) to be profiled. When \f2fn\fP
100 is produced for the current process pid.
102 The environment variable
110 to profile time measured spent in user mode, time spent in user+kernel mode, or elapsed time,
111 using the cycle counter, or the time in user mode using the kernel's HZ clock. The cycle counter
112 is currently only available on modern PCs and on the PowerPC. Default profiling measures user
113 time, using the cycle counter if it is available.
118 but is intended for profiling multiprocess programs.
120 .BI /proc/ pid /profile
121 file to collect instruction frequency counts for the text image associated with the process,
122 for all processes that share that text.
123 It must be run while the program is still active, since the data is stored with the running program.
126 profiling for a given process,
129 echo profile > /proc/\f2pid\f1/ctl
132 and then, after the program has run for a while, execute
138 Since the data collected for
140 is based on interrupt-time sampling of the program counter,
151 but presents the data accumulated by the kernel
154 The symbol table file, that of the operating system kernel,
155 and the data file, typically
159 has no options and cannot present dynamic data.
161 .B /sys/src/cmd/prof.c
163 .B /sys/src/cmd/kprof.c