op_stat_dim_size_get()
摘要
读取指定局部或全局统计量的维度大小。
语法
op_stat_dim_size_get (stat_name, type, dim_size_ptr)
| 参数 | 类型 | 说明 |
|---|---|---|
stat_name |
const char* |
需要获取句柄的统计量名称。 |
type |
int |
全局统计量用 OPC_STAT_GLOBAL,局部统计量用 OPC_STAT_LOCAL。参见表 80“Statistic Type Symbolic Constants“(第 24 页)。 |
dim_size_ptr |
int |
用于存储维度大小的变量的地址 |
返回类型
Compcode
完成代码,指示操作是否成功完成。若统计量名称、类型或大小指针无效,返回 OPC_COMPCODE_FAILURE;否则返回 OPC_COMPCODE_SUCCESS。
示例
/*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;
}
详情
该内核过程读取局部或全局统计量的维度数组值。维度信息存储在统计量的 Count 字段中。可以通过进程模型的 Interfaces > Local Statistics 或 Interfaces > Global Statistics 操作查看该信息。
如果统计量没有维度,*dim_size_ptr 被设置为 OPC_STAT_UNDIMENSIONED;否则该值为上限(上统计量索引 + 1)。
用途
提供一种在注册统计量之前计算其维度的机制。
错误
- 程序中止(Program Abort):段错误。(由于无效的
dim_size_ptr) - 程序中止(Program Abort):段错误。(由于无效或格式错误的
stat_name参数) - 程序中止(Program Abort):该内核过程需要进程上下文。
参考
- 使用内核过程 op_stat_reg() 获取统计量句柄
- 使用内核过程 op_stat_obj_dim_size_get() 读取某对象局部统计量的维度大小