ktracer.1m (2010 09)
k
ktracer(1M) ktracer(1M)
many conditions that can lead to an early return from it without collecting a trace record.
These conditions include but are not limited to the following:
1. Tracing is OFF, because it was halted or not begun, or a stop function was encountered.
2. The executing process does not match selected process to trace (see the
-p option).
3. No trace buffer is allocated on current CPU (see the
-A option).
4. The trace buffer is full AND linear buffers (not circular) were chosen.
The command-line options
-a, -r
, -S, and -z configure the list of kernel functions to trace.
When
-I is run, the entry point of each function in the list is modified to branch to kernel
tracing code.
After trace point insertion (
-I
), ktracer is ready and set to go, but will not begin to collect
trace records until you turn it on. See
-b for begin tracing.
The
-t option (status) for ktracer
will report "Funcs NOT installed" when no trace points
are inserted.
ktracer will report "Funcs INSTALLED" when trace points are inserted for
each function.
-U Uninsert. Remove all trace points.
The
-U uninsert option reverses the effect of
-I (insert). The -U option eliminates the inter-
ception of each traced function and restores kernel path flow to its original state, thereby elim-
inating
ktracer overhead and restoring system performance.
Managing Memory for Traces
Each trace record shows as one line in the
ktracedump output. Each CPU has a circular trace buffer.
ktracer defaults to collecting 2048 traces per CPU. Use the ktracer -A option to increase or
decrease the number of traces (numtraces ) per CPU. After the trace buffer is filled with trace records,
the oldest trace record is overwritten and lost. The most recent numtraces are preserved in the trace
buffer until ktracer -f frees them, or until ktracer -Z or ktracer -A
initializes them to zero, or
until the system is shut down. If a dump is taken prior to reboot, the trace buffers will be saved in the
dump, and
ktracedump may be run in the dump directory to report their content.
-A numtraces
Allocate trace buffers in kernel memory that are large enough to hold numtraces trace records
per CPU. At 160 bytes per trace record, trace buffers that can hold 6 million trace records will
consume just under 1GB of kernel memory. The allocated memory is initialized to zero.
The
-A option requires an integer argument which specifies how many trace records to collect
per CPU. If -A numtraces is never specified, the default of 2048 trace records per CPU is
chosen. You might want to increase the numtraces per CPU if ktracedump reports that the
trace buffer is FULL. That is, the output contains 2048 trace records, but represents only a
brief segment of your workload, or is missing parts of that workload which you want to see.
The maximum numtraces per CPU is equal to 6 million divided by the number of active CPUs
on the host. A system wide limit of 6 million trace records is chosen as a safeguard against
exhausting kernel memory.
As numtraces is increased, kernel memory usage will increase, the size of the
ktracedump
output will increase, and the time to write and sort the output will increase.
ktracer -R typically overruns the trace buffer quickly. To improve kernel memory usage
and performance, and to reduce the volume of output and length of processing, trace fewer
functions. Use the ktracer options in the Changing the Function List section, such as -r,
-z, -a, and -l, to select a subset of functions that are of interest to trace.
As indicated in the Options Chart , after
-A numtraces completes, the status of tracing will be
off. If you want turn tracing on after allocation, select an option that indicates on in the
status column of the Options Chart . These options include -R, -L, -b, and -B.
For example,
ktracer -A 10000 -L will allocate trace buffers to hold 10,000 trace records
per CPU (-A 10000), then begin tracing lightweight function calls (-L). All the options that
begin tracing, including -R and -L, honor the latest number of traces per CPU specified by -A
numtraces.
-Z Zero the trace buffers. Clear the contents of all the per-CPU trace buffers.
8 Hewlett-Packard Company − 8 − HP-UX 11i Version 3: September 2010