op_subq_print()
Abstract
Prints the packet contents of the specified subqueue onto the standard output device.
Syntax
op_subq_print (subq_index)
| Argument | Type | Description |
|---|---|---|
subq_index |
int |
numeric index of the subqueue-of-interest [Subqueue stream indices start at 0 and increment by one. There is no upper bound on the number of subqueues, but conservation of memory is achieved if they are utilized in a contiguous manner. Instead of an explicit index of a subqueue, an abstract subqueue selection index may be specified. An abstract subqueue selection index specifies a particular subqueue by a unique property it has. The acceptable abstract subqueue selection indices are listed in Table 85 “Subqueue Selection Index Symbolic Constants“ on page 26.] |
Return Type
void
No return value.
Example
/** diagnostic block **/
/* print name of queue */
op_ima_obj_attr_get (op_id_self (), "name", qname);
printf (">>> QUEUE [%s] <<<\n", qname);
/* print selected stats */
printf ("average bitsize (%g)\n\n",
op_q_stat (OPC_QSTAT_AVG_BITSIZE));
/* print subqueue contents */
op_subq_print (0);
example output as it appears on the standard output device:
>>> QUEUE [OF_Buffer] <<<
average bitsize (452.5)
---------- sub (0) ----------
0) packet id = (100), address (234281), priority (0), insert_time (4.128)
1) packet id = (117), address (236812), priority (0), insert_time (15.0212)
2) packet id = (122), address (237321), priority (0), insert_time (20.018)
Details
By default, the standard output device for a simulation is the command shell which spawned the simulation process. If the simulation process was spun off by the GUI, the standard output device is the command shell that spawned the application process. If the simulation process was spawned from a shell window, the default standard output device will be associated with that window. The standard output can be redirected to a file, using the “>” I/O redirection operator on the simulation command line.
The format of the subqueue packet contents information generated by this KP is shown in the example on the previous page. Note that packet addresses are displayed as hexadecimal numbers.
This KP must only be invoked within the context of a process running on a queue module (or from a function which is directly or indirectly invoked by a queue process); invoking it from a process running on a processor, or from a pipeline stage model will cause an error.
Purpose
Provides a mechanism for a user to monitor the contents of subqueues from a terminal, or to log the subqueue contents into a file for later investigation. Printing out subqueue contents can be very useful in the simulation debugger, when the arriving packets contain values which are used in process computations or which influence the flow of process logic. Statements to print out subqueue contents can be added to state executives (for event-driven printing), or to the diagnostic block (for user-driven printing of subqueue contents whenever the prodiag command is issued from the debugger).
Errors
- Program Abort: KP requires queue context.
- Recoverable Error: Subqueue selection flag (
<flag>) is unrecognized.
Reference
- Use the KP op_pk_print() in conjunction with the KP op_subq_pk_access() to print the contents of a single packet within a subqueue