op_prg_odb_trace_active()
Abstract
Determines if a full trace, or a module trace associated with the surrounding module, has been activated by an ODB command.
Syntax
op_prg_odb_trace_active ()
| Argument | Type | Description |
|---|---|---|
| no arguments |
Return Type
Boolean
Boolean value indicating whether a full trace is active, or if a module trace is active for the surrounding module. This value is OPC_TRUE if either trace is active; OPC_FALSE otherwise.
Example
/* check if this module is being traced */
if (op_prg_odb_trace_active ())
{
/* print local banner (time / module not necessary) */
op_prg_odb_print_major ("List of in-stream contents:", OPC_NIL);
/* loop through all the input streams, determining the number */
/* of packets being queued there (assumes consecutive connections) */
num_in_strms = op_strm_max_index_in () + 1;
for (i = 0; i < num_in_strms; i++)
{
sprintf (out_string, "in-stream [%d] contains %d packets\n", i,
op_strm_pksize ());
op_prg_odb_print_minor (out_string, OPC_NIL);
}
}
Details
Traces are a special status of simulations that when activated, permit specific diagnostic information to be printed and related actions to occur. Simulation traces are supported within the ODB simulation debugger (see “Simulation Debugger (ODB)“ on page 39 for information on using ODB). Various types of traces can be activated within ODB, including full, module-oriented, packet-oriented, and labeled traces. Full traces are activated via the ODB command fulltrace, and module traces are activated via the ODB command mtrace. Both of these trace types are detected by this KP, but a module trace is only detected if it affects the surrounding module.
This KP returns OPC_FALSE when used with an optimized simulation kernel.
Purpose
Provides a mechanism for performing special actions if a full or surrounding module trace has been defined in ODB. The actions usually include diagnostic print statements generated by op_prg_odb_print_major(), op_prg_odb_print_minor(), or printf(). However, the actions can include any KPs, including reading statistics, manipulating packets, etc.
Errors
- No errors are trapped.
Reference
- Use the KPs op_prg_odb_print_major() and op_prg_odb_print_minor() to print diagnostic statements
- Use the KP op_prg_odb_ltrace_active() to determine if a specific labeled trace is active
- Use the KP op_prg_odb_pktrace_active() to determine if a specific packet trace is active