op_stat_dim_size_get()
Abstract
Reads the dimension size of a specified local or global statistic.
Syntax
op_stat_dim_size_get (stat_name, type, dim_size_ptr)
| Argument | Type | Description |
|---|---|---|
stat_name |
const char* |
name of statistic for which a handle is to be obtained. |
type |
int |
OPC_STAT_GLOBAL for a global statistic or OPC_STAT_LOCAL for a local statistic. See Table 80 “Statistic Type Symbolic Constants“ on page 24. |
dim_size_ptr |
int |
address of the variable to store the dimension size |
Return Type
Compcode
Completion code that indicates whether the operation completed successfully. OPC_COMPCODE_FAILURE if the statistic name, type, or size pointer are not valid; OPC_COMPCODE_SUCCESS otherwise.
Example
/*Get the dimension size of flow-based ETE delay statistic */
op_stat_dim_size_get (“IP.Background Traffic Flow Delay (sec)”,
OPC_STAT_LOCAL, &config_dim_size);
/* Create a statistic handle to carry flow-based ETE delay. */
if (i < config_dim_size)
{
/* Register statistic handle and maintain pointer to stathandle */
conversation_ptr->flow_ete_delay_stathandle_ptr =
(Stathandle *) op_prg_mem_alloc (sizeof (Stathandle));
*conversation_ptr->flow_ete_delay_stathandle_ptr =
op_stat_reg (“IP.Background Traffic Flow Delay (sec)”, i, OPC_STAT_LOCAL);
}
else
{
/* if exceeded dimension, set it to NIL pointer */
conversation_ptr->flow_ete_delay_stathandle_ptr = OPC_NIL;
}
Details
This KP reads the value of the dimension array of a local or global statistic. Dimension information is stored in the Count field of the statistic. You can view this information using the Interfaces > Local Statistics or Interfaces > Global Statistics operation of the process model.
If the statistic is undimensioned, *dim_size_ptr is set to OPC_STAT_UNDIMENSIONED; otherwise, the value is the upper limit (upper statistic index + 1).
Purpose
Provides a mechanism to calculate the dimensions of a statistic before registering the statistic.
Errors
- Program Abort: Segmentation violation. (due to an invalid
dim_size_ptr) - Program Abort: Segmentation violation. (due to an invalid or malformed
stat_nameargument) - Program Abort: KP requires process context.
Reference
- Use the KP op_stat_reg() to obtain a statistic handle
- Use the KP op_stat_obj_dim_size_get() to read the dimension size of a local statistic of an object