HP Caliper Ktrace Features Guide
How does Kernel Tracing Work?
You use ktracer to define trace points to be associated with functions being traced.
A trace point is similar to a tag. During kernel tracing, the kernel creates a trace record
each time it encounters a function with a trace point. The trace record contains
information about the function call and is saved in a trace buffer in kernel memory.
See the “Trace Buffers” section in this chapter for more information about the trace
records and trace buffers.
Trace Buffers
Each CPU has its own trace buffer, allocated from kernel memory. A trace buffer can
hold up to 2048 trace records by default. The trace record is often referred to as a “trace”.
After 2048 procedure calls are traced, the buffer is full. The buffer can be circular or
linear. See Figure 1-1 (page 15).
When a circular buffer is full, records will continue to be written with the oldest records
overwritten first. When a linear buffer is full, no more traces are collected for that CPU.
Note that the rate at which a particular CPU's buffer fills will depend on the rate traced
procedure calls are made for that CPU. You cannot extract old trace records once any
of the following actions on the buffers have occurred:
• overwritten.
• cleared using the ktracer –Z command.
• freed using the ktracer –f command
You can adjust the number of traces allowed for each CPU using the ktracer –A
numtraces command where numtraces is the number of trace records. There is a
system wide safeguard limit of 6 million traces (1 GB) for all CPUs combined.
See “Trace Buffer Management” (page 15) in this chapter for information about trace
buffer overflow.
14 HP Caliper Ktrace Feature Overview