Next: , Previous: , Up: Multinode Model   [Contents][Index]


4.18 Tracing Model Execution

The QSMM framework provides facilities for tracing events related to a multinode model. 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_TRACE_API

Multinode model 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_TRACE_EVT

The beginning and end of processing every model event by event handler functions. Event parameters are also dumped.

Macro: QSMM_TRACE_CTRL

Calling nodes, returning control from nodes, instruction invocations, and outcomes of those invocations.

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

Function: unsigned int qsmm_get_trace_flags (qsmm_t model)

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

Function: void qsmm_set_trace_flags (qsmm_t model, unsigned int flags)

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

The function qsmm_create initializes the bitmask of types of events dumped in the trace log to 0.

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

Function: FILE * qsmm_get_trace_stream (qsmm_t model)

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

Function: void qsmm_set_trace_stream (qsmm_t model, FILE *filep)

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

Use the following functions to write a custom formatted message to the trace log.

Function: void qsmm_trace_f (qsmm_t model, const char *fmt, ...)
Function: void qsmm_trace_fv (qsmm_t model, const char *fmt, va_list ap)

These functions write a formatted message to the trace log of a multinode model specified by handle model. 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_trace_f is the same as in the function printf. The meaning of arguments fmt and ap of function qsmm_trace_fv is the same as in the function vprintf.


Next: , Previous: , Up: Multinode Model   [Contents][Index]