Next: , Previous: , Up: Exchanging Data Packets in a Multithreaded Program   [Contents][Index]


6.4.3 Tracing Exchange of Data Packets

The QSMM framework provides facilities for tracing events related to interaction sides. Types of events dumped in the trace log can be specified using a bitmask defined as a subset of the following macros merged by bitwise “or.”

Macro: QSMM_SIDE_TRACE_API

Side API calls entry and exit. For every call, the name of an API function, names and values of arguments of the function, and a value returned by the function are dumped.

Macro: QSMM_SIDE_TRACE_MSG

The contents of data packets sent from an interaction side to other interaction sides dumped as byte arrays in hexadecimal notation.

Use the following functions to get or set a bitmask of types of events dumped in the trace log.

Function: unsigned int qsmm_get_side_trace_flags (qsmm_side_t side)

This function returns the bitmask of types of events that may be dumped in the trace log of an interaction side. The interaction side is the originator of those events. Argument side specifies the handle of that side. The bitmask returned is the one set by the last call to the function qsmm_set_side_trace_flags or the default bitmask (see the remark below) if that function is not yet called.

Function: void qsmm_set_side_trace_flags (qsmm_side_t side, unsigned int flags)

This function sets the bitmask of types of events that may be dumped in the trace log of an interaction side. The interaction side is the originator of those events. Argument side specifies the handle of that side. Argument flags specifies the bitmask. The function does not check bitmask correctness.

The function qsmm_side_create initializes the bitmask of types of events dumped in the trace log to QSMM_SIDE_TRACE_MSG.

The events will not be dumped in the trace log unless a stream that represents the trace log is defined for the interaction side. Use the following functions to get or set the stream.

Function: FILE * qsmm_get_side_trace_stream (qsmm_side_t side)

This function returns a stream representing the trace log of an interaction side specified by handle side. If the stream is not set, then the function will return NULL.

Function: void qsmm_set_side_trace_stream (qsmm_side_t side, FILE *filep)

This function sets the stream representing the trace log of an interaction side specified by handle side. Argument filep specifies that stream. If filep is NULL, then event tracing will be disabled for the interaction side.

Use the following functions to write a formatted message to the trace log, e.g. containing additional information about a data packet sent or received.

Function: void qsmm_side_trace_f (qsmm_side_t side, const char *fmt, ...)
Function: void qsmm_side_trace_fv (qsmm_side_t side, const char *fmt, va_list ap)

These functions write a formatted message to the trace log of an interaction side specified by handle side. The character ‘\n’ is appended to the message and the stream buffer is flushed. If the trace log is not set, then the functions will have no effect. The meaning of argument fmt and subsequent arguments of function qsmm_side_trace_f is the same as in the function printf. The meaning of arguments fmt and ap of function qsmm_side_trace_fv is the same as in the function vprintf.


Next: , Previous: , Up: Exchanging Data Packets in a Multithreaded Program   [Contents][Index]