Using TraceEvent() to control tracing

Updated: May 06, 2022

You don't have to use tracelogger to control all aspects of tracing; you can call TraceEvent() directly—which (after all) is what tracelogger does. Using TraceEvent() to control tracing means a bit more work for you, but you have much more control over specific details.

You could decide not to use tracelogger at all, and use TraceEvent() exclusively, but you'd then have to manage the buffers, collect the trace data, and save it in the appropriate form, which would be a significant amount of work.

In practical terms you'll likely use tracelogger and TraceEvent() together. For example, you might run tracelogger in daemon mode, to take advantage of its management of the trace data, but call TraceEvent() to control exactly which events to trace.

The TraceEvent() kernel call takes a variable number of arguments. The first is always a command and determines what (if any) additional arguments are required. For reference information about TraceEvent(), see the QNX Neutrino C Library Reference.