Attach a callback to a trace event
#include <sys/traceparser.h> int traceparser_cs ( struct traceparser_state * stateptr, void * userdata, tracep_callb_func_t funcptr, unsigned class, unsigned event );
libtraceparser
Use the -l traceparser option to qcc to link against this library.
The traceparser_cs() function attaches the callback function specified by the pointer funcptr, to one particular event, from one particular class. You'll use this function if you're creating your own utility for parsing trace data (as an alternative to traceprinter).
The user data (userdata) is passed to the callback function upon execution. The stateptr is an opaque structure obtained from traceparser_init().
The synopsis of the callback function is defined by the tracep_callb_func_t data type as follows:
int my_callback( struct traceparser_state* statepointer, void * userdata, unsigned header, unsigned timestamp, unsigned* buffer, unsigned buffer_len)
The arguments are:
The callback should return 0 to indicate success, and -1 to indicate failure.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | No |
TraceEvent(), traceparser(), traceparser_cs_range(), traceparser_debug(), traceparser_destroy(), traceparser_get_info(), traceparser_init()
tracelogger, traceprinter in the Utilities Reference
System Analysis Toolkit User's Guide
Analyzing Your System with Kernel Tracing chapter of the Integrated Development Environment User's Guide