op_stat_rename()
摘要
在输出向量文件中重命名统计量。
语法
op_stat_rename (stat_handle, new_stat_name)
| 参数 | 类型 | 说明 |
|---|---|---|
stat_handle |
Stathandle |
统计量句柄,标识要接收更新值的全局或局部统计量[统计量句柄可通过内核过程 op_stat_reg() 获得。] |
new_stat_name |
const string |
用作统计量新名称的文本(不得包含句点“.”) |
返回类型
void
无返回值。
示例
/* 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);
}
详情
该内核过程接收一个 stathandle 和一个字符串。在将统计量的数据写入输出向量文件时,该字符串取代统计量的真实名称。
例如,若某统计量在输出向量文件中的完整层次名称在没有 op_stat_rename (hnd, "Voice Mail") 调用时是:
subnet.node.Apps.Custom App [2]
则调用之后,完整层次名称变为:
subnet.node.Apps.Voice Mail
当统计量名称被更改时,其所属的统计量组(如果有)不会改变。
用途
提供了一种在输出向量文件中以更描述性的名称写入统计量的机制。
错误
- 程序中止(Program Abort):段错误。(由于无效的统计量句柄)
- 可恢复错误(Recoverable Error):试图使用未注册的统计量句柄。
- 可恢复错误(Recoverable Error):指定的新统计量名称无效(
<new_stat_name>)。
参考
- 使用内核过程 op_stat_obj_reg() 访问任何链路、路径、模块或子模块对象的统计量
- 使用内核过程 op_stat_reg() 获取统计量句柄
- 使用内核过程 op_stat_scalar_write() 向标量统计量写入值
- 使用内核过程 op_stat_write() 向输出统计量写入值,并以当前仿真时间标记
- 使用内核过程 op_stat_write_t() 向输出统计量写入值,并以指定仿真时间标记