Kernel event data logging process

In the IDE, you control kernel event tracing by defining a log configuration, in which you can specify the event types to be logged and where to store the captured data so you can do postmortem analysis. The logging and capture of kernel event data is done through a multi-step process:


Figure 1. Kernel event data logging and capture process

Instrumented kernel

The instrumented kernel contains small event-gathering modules. If your target isn't already running this version of the kernel, you can switch to this version by modifying the buildfile for your boot image. This is done by replacing procnto with procnto-instr in the bootstrap command, as follows:

[virtual=armle-v7,raw] .bootstrap = {
  startup-omap4430 
  PATH=/proc/boot procnto-instr 
}

You must then rebuild your boot image and transfer it to your target board. Information about these required tasks is given in the Building Embedded Systems guide.

To verify that you're running the instrumented kernel, in a terminal window on the target, run this command:

ls /proc/boot

You should see the correct kernel name (procnto-instr).

Events

Information logged for an event includes the category or class that it belongs to (e.g., kernel call, interrupt servicing, process and thread management) as well as event-specific data.

Events can be logged in fast mode or wide mode, but there's a trade-off between the amount of data generated and the work needed to generate and analyze it, as follows:
Event type Amount of data Work for kernel Size of log file
Fast Less Less Smaller
Wide More More Larger

Kernel buffer management

Events are stored in a circular list of buffers (a ring buffer). The data capture process works with the kernel to get information about process and thread activity. The buffer size is fixed at 16K, and the number of buffers that can be successfully created may vary over time. The kernel allocates buffers from physically contiguous memory; however, if there isn't enough space for the requested number of buffers then it will use less memory.

Note: There is nothing that prevents data loss if the capture process can't keep up with the kernel's writing of data.

Data capture process

The data capture process retrieves events logged in the kernel buffers. The process interfaces with the kernel, telling it what sorts of events to log, and moves events from the kernel's event buffers into another storage location. Data can be captured using the following tools:

Analyzing

To analyze the log, you can use the QNX System Profiler perspective in the IDE, traceprinter, or a custom application that uses the traceparser() API. More details are given in "View and interpret the captured data".