ktracer.1m (2010 09)
k
ktracer(1M) ktracer(1M)
• Begin tracing (-b).
The
-R option is the simplest way to get started. This option tells
ktracer to trace every-
thing possible, and to begin immediately. It does not matter what state
ktracer was in
before using this option.
ktracer -R achieves a known state of allocated, installed and
active.
To get the full list of traced functions, run
ktracedump -FND.
The
-R option is a heavyweight function, because it traces "the world", which means it traces
every kernel function it possibly can. The number of functions to trace can easily be over
40,000 functions. The exact number of functions will depend on the kernel, and more
specificly will depend upon which Operating Environment (OE), kernel modules, 3rd party
drivers, patch level, machine model, processor architecture, and kernel type that are in use.
ktracer -R is convenient for tracing everything when you do not know specifically what to
look for, or to become more familiar with
ktracer.
-L Lightweight defaults: An easy way to get started tracing key functions. The
-L option does the
following tasks:
• Clear previous tracing state (
-h
, -U, -z).
• Allocate trace buffers (
-A).
• Add a few key functions (-a).
• Insert trace points (-I).
• Begin tracing (-b).
The
-L option is another simple way to get started. This option tells ktracer to trace only a
lightweight set of functions, beginning immediately. It does not matter what state ktracer
was in before using this option. ktracer -L achieves a known state of allocated, installed
and active.
These lightweight functions are kernel procedures relating to system calls, thread switching,
interrupt processing, and idle.
To get the full list of traced functions, run
ktracedump -FND.
The
-L option is lightweight, because it induces minimal performance overhead. The light-
weight function list is strategically chosen to provide key functions that have a high degree of
interest and use, and yet have a low degree of performance impact.
See the LIMITATIONS section regarding
_swtch() and the optimizer.
-b Begin tracing. Start intercepting and tracing functions.
In the following command example,
ktracer starts tracing every call that the kernel makes
to read() and write():
# ktracer -a read -a write -b
The -b option will start to intercept every function on the function list. Every single time a
traced function is called, the function call will begin with a branch to tracing code because
ktracer intercepts it.
Within the tracing code, the function arguments, timestamp, and other information will be
captured into a trace. After the trace data is captured, execution of the intercepted function
resumes.
The
ktracedump output will show one function trace per line.
Note that when the optimizer inlines a function call, that function call will not be traced,
because the function call itself has been eliminated by inlining.
-B Begin tracing. Same as -b.
Either
-B or -b or both can be used to begin tracing. The lowercase variant, -b for begin, is
chosen in documentation because the opposite of begin, -h for halt, is also lowercase.
-h Halt. Stop tracing and intercepting functions.
The
-h option stops ktracer from collecting traces into the trace buffers, and stops
ktracer from intercepting functions. The -h option is the opposite of -b (begin).
4 Hewlett-Packard Company − 4 − HP-UX 11i Version 3: September 2010