Capturing Trace Data
The program that captures data is the messenger
between the instrumented kernel and the filesystem.
The main function of the data-capture program is to send the buffers given to it by the instrumented kernel to an output device (which may be a file or something else). To accomplish this function, the program must also:
- interface with the instrumented kernel
- specify data-filtering requirements the kernel will use
You must configure the instrumented kernel before logging. The kernel configuration settings include:
- buffer allocations (size)
- which events and classes of events to log (filtering)
- whether to log the events in wide mode or fast mode
We've provided tracelogger as the default data-capture utility. Although you can write your own utility, there's little need to.
For information about controlling the trace from the IDE, see the
Analyzing System Behavior
chapter of the IDE User's Guide.
Let's look first at using tracelogger, and then we'll describe how you can use TraceEvent() to control tracing from your application.
- Don't run more than one instance of tracelogger at a time. Similarly, don't run tracelogger and trace events under control of the IDE at the same time.
- The hardware underlying ClockCycles()
must be synchronized across all processors on an SMP system.
If the clocks aren't synchronized, then tracelogger produces
data with inconsistent timestamps, and the IDE won't be able to load the trace file.
The IDE attempts to properly order the events in
the trace file, and this can go awry if the timestamp data is incorrect.
The traceprinter utility doesn't have any issues with such traces because it doesn't attempt to reorder and then interpret the data; it simply dumps the contents of each event.