op_stat_obj_dim_size_get()

摘要

从指定对象读取局部维度化统计量的大小。

语法

op_stat_obj_dim_size_get (stat_name, obj_id, dim_size_ptr)
参数 类型 说明
stat_name const char* 需要获取句柄的统计量名称。
obj_id Objid 包含目标统计量的对象的 ID。
dim_size_ptr int * 用于存储维度大小的变量的地址

返回类型

Compcode

完成代码,指示操作是否成功完成。若统计量名称或大小指针无效,返回 OPC_COMPCODE_FAILURE;否则返回 OPC_COMPCODE_SUCCESS。

示例

摘自:models/std/utilities/oms/oms_dim_stat_support.ex.c

if ((dim_stat_desc_handle_ptr = (OmsT_Dim_Stat_Desc *)
	prg_string_hash_table_item_get (dim_stat_desc_hash_table_ptr [stat_type],
			stat_desc_key_str)) == OPC_NIL)

	/* Create a new record to store dimensioned statistics for this */
	/* group/stat name from the supplied module. */
	dim_stat_desc_handle_ptr = (OmsT_Dim_Stat_Desc *) oms_dim_stat_desc_alloc ();

	/* The dimensioned statistics have a finite dimension index using */
	/* which stats can be registered/recorded. Determine this limit for */
	/* the current statistic. */
	sprintf (stat_reg_name_str, "%s.%s", group_name, stat_name);

	/* If the statistic is a local statistic, use op_stat_obj_dim_size_get */
	/* Else if the statistic is a global statistic, use op_stat_dim_size_get */
	/* This is because op_stat_obj_dim_size_get does not consider statistic */
	/* type (LOCAL or GLOBAL) and returns a 0 dim size for global statistics. */
	if (stat_type == OPC_STAT_LOCAL)
		op_stat_obj_dim_size_get (stat_reg_name_str, module_id,
			&dim_stat_desc_handle_ptr->max_dim_size);
else
	op_stat_dim_size_get (stat_reg_name_str, stat_type,
		&dim_stat_desc_handle_ptr->max_dim_size);

	/* Initialize the elements of this newly created data structure */
	/* used to maintain dimensioned statistic handle. */
	dim_stat_desc_handle_ptr->next_dim_index = 0;

	/* Register a new stathandle with the supplied arguments. */
	dim_stathandle_ptr = oms_dim_stat_register (dim_stat_desc_handle_ptr,
		module_id, group_name, stat_name, stat_type, stat_key_str);
...

详情

该内核过程从指定对象(如路径、链路或需求)读取统计量的维度数组值。维度信息存储在统计量的 Count 字段中。

如果统计量没有维度,*dim_size_ptr 被设置为 OPC_STAT_UNDIMENSIONED;否则该值为上限(上统计量索引 + 1)。

用途

提供一种在注册统计量之前计算其维度的机制。

错误

  • 程序中止(Program Abort):该内核过程需要进程上下文。
  • 程序中止(Program Abort):段错误。(由于无效的 dim_size_ptr)
  • 程序中止(Program Abort):段错误。(由于无效或格式错误的 stat_name 参数)
  • 可恢复错误(Recoverable Error):指定了不支持类型的对象(<obj_id>)

参考

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com