csrep
csrep (CallStack REPort)
===== ========== =======
csrep is used to create a "butterfly" report from one or more
raw callstack reports produced by histx. E.g.
% csrep -c 3 < cs.prog.12345 > butterfly.12345
or
% csrep cs.prog.* > butterfly.all
Output from csrep consists of 2 sections. First, a listing
of the frequency of appearance of each function found in a
callstack, e.g.:
Appearance Frequency
========== =========
97.06% libc.so.6.1:__libc_start_main+0x230 [../sysdeps/generic/libc-start.c:129]
96.32% a.out:_start+0x80
48.28% a.out:main+0x2a0 [prog.c:93]
48.04% a.out:main+0x90 [prog.c:70]
35.05% libm.so.6.1:cos
20.10% a.out:f1+0xb0 [prog.c:23]
19.36% a.out:f2+0xb0 [prog.c:33]
18.38% a.out:f2+0x80 [prog.c:33]
17.65% libm.so.6.1:acos
15.69% a.out:f1+0x80 [prog.c:23]
13.73% libm.so.6.1:asin
12.25% a.out:f1 [prog.c:19]
10.54% a.out:f2 [prog.c:29]
Each percentage, is followed by <library>:<function>+<offset> [<file>:line]
information.
The second section consists of a "butterfly" report for each function.
Each has the form:
--------------------------------------------------------------------------------
xxx.xx% (yyy.yy%) <caller_1 info>
xxx.xx% (yyy.yy%) <caller_2 info>
xxx.xx% (yyy.yy%) <caller_3 info>
...
xxx.xx% (yyy.yy%) <caller_M info>
....... (yyy.yy%) <function info>
xxx.xx% (yyy.yy%) <callee_1 info>
xxx.xx% (yyy.yy%) <callee_2 info>
xxx.xx% (yyy.yy%) <callee_3 info>
...
xxx.xx% (yyy.yy%) <callee_N info>
e.g.
--------------------------------------------------------------------------------
100.00% ( 20.10%) a.out:main+0x90 [prog.c:70]
....... ( 20.10%) a.out:f1+0xb0 [prog.c:23]
96.34% ( 19.36%) libm.so.6.1:cos
3.66% ( 0.74%) a.out:_init
Each report conveys a lot of information. Above the function of interest,
there is a line for each caller of the function. The xxx.xx percentage in
those lines is computed from the formula:
<# callstacks containing caller_j followed by function> /
<# callstacks containing function> * 100
so the sum for all callers is 100%. Each (yyy.yy%) percentage is computed from:
<# callstacks containing caller_j followed by function> /
<total # of callstacks> * 100
Below the function of interest, there is a line for each callee of the
function. The xxx.xx percentages in those lines are now given by the formula:
<# callstacks containing function followed by callee_j> /
<# callstacks containing function> * 100
and again sum to 100%, while the (yyy.yy%) percentages are computed from
<# callstacks containing function followed by callee_j> /
<total # of callstacks> * 100
This type of report allows one to not only quickly identify the functions
of interest in an application, but also identify the must likely paths
through the program by which such functions were called.
csrep will not mention functions whose percentage in all recorded
callstacks is less than a cutoff. The default cutoff is 0.5%. A
different cutoff percentage may be provided to csrep by placing
"-c <cutoff percentage>" first on the command line, where
0 <= <cutoff percentage> < 100.