op_stat_dim_size_get()

Abstract

Reads the dimension size of a specified local or global statistic.

Syntax

op_stat_dim_size_get (stat_name, type, dim_size_ptr)
Argument Type Description
stat_name const char* name of statistic for which a handle is to be obtained.
type int OPC_STAT_GLOBAL for a global statistic or OPC_STAT_LOCAL for a local statistic. See Table 80 “Statistic Type Symbolic Constants“ on page 24.
dim_size_ptr int address of the variable to store the dimension size

Return Type

Compcode

Completion code that indicates whether the operation completed successfully. OPC_COMPCODE_FAILURE if the statistic name, type, or size pointer are not valid; OPC_COMPCODE_SUCCESS otherwise.

Example

/*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;
	}

Details

This KP reads the value of the dimension array of a local or global statistic. Dimension information is stored in the Count field of the statistic. You can view this information using the Interfaces > Local Statistics or Interfaces > Global Statistics operation of the process model.

If the statistic is undimensioned, *dim_size_ptr is set to OPC_STAT_UNDIMENSIONED; otherwise, the value is the upper limit (upper statistic index + 1).

Purpose

Provides a mechanism to calculate the dimensions of a statistic before registering the statistic.

Errors

  • Program Abort: Segmentation violation. (due to an invalid dim_size_ptr)
  • Program Abort: Segmentation violation. (due to an invalid or malformed stat_name argument)
  • Program Abort: KP requires process context.

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · 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