op_stat_annotate()
摘要
在输出向量文件中为统计量名称添加注释。
语法
op_stat_annotate (stat_handle, stat_annotation)
| 参数 | 类型 | 说明 |
|---|---|---|
stat_handle |
Stathandle |
统计量句柄,标识接收该值的全局或局部统计量 [统计量句柄可通过内核过程 op_stat_reg() 获得。] |
stat_annotation |
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_annot_str, "%s --> %s", source_FRAD_name, dest_FRAD_name);
op_stat_annotate (frms_ete_del_lhandle, stat_annot_str);
frms_ete_del_var_lhandle = op_stat_reg ("Frame Relay PVC.Delay Variance",
conn_id, OPC_STAT_LOCAL);
sprintf (stat_annot_str, "%s --> %s", source_FRAD_name, dest_FRAD_name);
op_stat_rename (frms_ete_del_var_lhandle, "Delay Variation");
op_stat_annotate (frms_ete_del_var_lhandle, stat_annot_str);
}
详情
该内核过程接收一个统计量句柄和一个字符串。字符串被放入尖括号内并追加到输出向量文件中的统计量名称之后。如果该统计量是维度化的,注释将替换通常出现在统计量末尾的维度编号。
例如,若输出向量文件中某统计量的完整层次名称为:
subnet.node.group.statistic [2]
调用 op_stat_annotate (hndl, "location") 后,完整层次名称变为:
subnet.node.group.statistic <location>
如果先用 op_stat_rename() 重命名统计量再添加注释,则输出向量文件中的统计量名称同时包含新名称和注释,无论两个操作的先后顺序如何。
用途
提供一种在输出向量文件中写入统计量并附带描述性注释的机制。
错误
- 程序中止(Program Abort):段错误。(由于无效的统计量句柄)
- 可恢复错误(Recoverable Error):试图使用未注册的统计量句柄。
参考
- 使用内核过程 op_stat_tag_add_dbl()、op_stat_tag_add_int32()、op_stat_tag_add_int64() 和 op_stat_tag_add_str() 为统计量添加标签。
- 使用内核过程 op_stat_reg() 获取统计量句柄
- 使用内核过程 op_stat_rename() 重命名统计量
- 使用内核过程 op_stat_scalar_write() 向标量统计量写入值
- 使用内核过程 op_stat_write() 向输出统计量写入值,并以当前仿真时间标记
- 使用内核过程 op_stat_write_t() 向输出统计量写入值,并以指定仿真时间标记