op_pro_tag_set()
Abstract
Set a descriptive tag in the process.
Syntax
op_pro_tag_set (pro_handle, tag_string)
| Argument | Type | Description |
|---|---|---|
pro_handle |
Prohandle |
Process handle that refers to process of interest |
tag_string |
const char* |
Process tag - descriptive string |
Return Type
Compcode
Completion code indicating whether or not the Simulation Kernel successfully set the tag. This return code can be compared to the constants OPC_COMPCODE_SUCCESS and OPC_COMPCODE_FAILURE to determine if the process tag was successfully set.
Example
/* Obtain the number of subqueues. */
op_ima_obj_attr_get (queue_object_id, “subqueue count”, &num_subq);
/* Create a process to manage each subqueue. */
for (i = 0; i < num_subq; i++)
/* Create the process. */
pro_handle = op_pro_create (“subqueue_manager”, OPC_NIL);
/* Generate descriptive string and set in process. */
sprintf (tag_string, “subq process (%d)”, i);
op_pro_tag_set (pro_handle, tag_string);
}
Details
The tag is typically a string that is used to distinguish one process from others of the same type within the same processor or queue. The tag may be a string constant, which is denoted in the process model as a string surrounded by double quotation marks. The tag value may also be dynamically generated using the C function sprintf.
Purpose
This KP provides a mechanism to attach a descriptive string to a process. The tag is typically used to distinguish one similar process from another within the simulation debugger context. The debugger command promap shows the processes that exist at a specified processor or queue.
Errors
- Program Abort: KP requires process context.
- Program Abort: Segmentation violation. (due to a malformed process handle or an invalid or malformed tag_string argument)
- Recoverable Error: Process handle is invalid.
- Recoverable Error: Process handle is for destroyed process (
<proc_id>). - Recoverable Error: Process handle is for remote process (
<proc_id>).
Reference
- Use the KP op_pro_create() to create a process and obtain a handle for it
- Use the KP op_pro_parent() to obtain a process handle for the parent of another process