HP Caliper Ktrace Features Guide

Specify a function to trace (or add a function to the function list): ktracer -a
func
Trace for a shorter time by specifying how many seconds to trace:
ktracer -g #seconds
Trace only a single process: ktracer -p pid
Traces are generated each time an installed function is executed. If a function you are
interested in is on the traced function list, but you see no traces for it, this means one
of three things.
The function did not execute while ktracer was active
The circular buffers wrapped around it.
The function call was inlined by the optimizer.
To generate fewer traces, you can try a combinations of these steps:
limit the list of functions to trace; for example: ktracer -z -a my_func1 -a
my_func2 B)
shorten the duration that ktracer is active.
trace only one PID.
Limitations
Traces are only collected at function entry, not at function exit or elsewhere. Therefore,
the Elapsed Times are from function entry to function entry. You will not see when a
function exited or what value it returned. If you need to trace an exit function, make a
function call in the source code, such as kt_dbg(retval, errno, 0, 0). Then
look for kt_dbg in the trace output. The arg0 column will show the return value, and
arg1 will show errno.
Not all functions are traceable. If you try to trace the kernel function lbcopy ( ktracer
-a lbcopy) will report that lbcopy cannot be traced. You will not see traces with
lbcopy as the Function name in the ktracedump output, no matter how many times
lbcopy was called and executed while ktracer was active. A function which is not
traceable will never show in the Function name column, but it might show in the Caller
column.
To produce a list of all traceable functions in a given system, run:
ktracer -R -DNF > traceable_functions
Then view the traceable_functions. If a C source file is compiled with the option
+O3 or +Oinline, the optimizer inlines functions to reduce function call overhead.
When a function call is inlined, the function call is no longer made, then ktracer no
longer traces it, causing the absence of expected function call traces in the ktracedump
output. Function inlining also causes caller to callee relationships to differ from the
source code definition. For example, suppose that pm_swtch.c contains the function
16 HP Caliper Ktrace Feature Overview