op_stat_rename()
Abstract
Renames a statistic in the output vector file.
Syntax
op_stat_rename (stat_handle, new_stat_name)
| Argument | Type | Description |
|---|---|---|
stat_handle |
Stathandle |
Statistic handle identifying the global or local statistic to receive an updated value [A statistic handle can be obtained via the KP op_stat_reg().] |
new_stat_name |
const string |
Text to be used for new name of statistic (must not contain a period “.”) |
Return Type
void
No return value.
Example
/* Obtain a local statistic handle for the ete delay and variance statistics. */
if (conn_id < FRMSC_PVC_CONN_STAT_COUNT)
{
frms_ete_del_lhandle = op_stat_reg ("Frame Relay PVC. Delay (sec)", conn_id,
OPC_STAT_LOCAL);
sprintf (stat_rename_str, "Delay: %s <-- %s\n", source_FRAD_name,
dest_FRAD_name);
op_stat_rename (frms_ete_del_lhandle, stat_rename_str);
frms_ete_del_var_lhandle = op_stat_reg ("Frame Relay PVC. Delay Variance",
conn_id, OPC_STAT_LOCAL);
sprintf (stat_rename_str, "Delay Variation: %s <-- %s\n", source_FRAD_name,
dest_FRAD_name);
op_stat_rename (frms_ete_del_var_lhandle, stat_rename_str);
}
Details
This KP takes a stathandle and a string. The string is used in place of the statistic’s true name when writing the statistic’s data to the output vector file.
For example, if the full hierarchical name of a statistic in the output vector file without an op_stat_rename (hnd, "Voice Mail") call is:
subnet.node.Apps.Custom App [2]
after the call, the full hierarchical name is:
subnet.node.Apps.Voice Mail
When the statistic name is changed, the statistic group, if any, is not changed.
Purpose
Provides a mechanism for writing statistics in the output vector file, using a more descriptive name.
Errors
- Program Abort: Segmentation violation. (due to an invalid statistic handle)
- Recoverable Error: Attempting use of unregistered statistic handle.
- Recoverable Error: Invalid new statistic name specified (
<new_stat_name>).
Reference
- Use the KP op_stat_obj_reg() to access a statistic for any link, path, module or submodule object
- Use the KP op_stat_reg() to obtain a statistic handle
- Use the KP op_stat_scalar_write() to write a value to a scalar statistic
- Use the KP op_stat_write() to write a value to an output statistic, tagged with the current simulation time
- Use the KP op_stat_write_t() to write a value to an output statistic, tagged with a specified simulation time