op_subq_stat()

Abstract

Obtains the value of a statistic which is automatically computed by the surrounding queue; the statistic pertains to the specified subqueue, rather than the queue as a whole.

Syntax

op_subq_stat (subq_index, stat_index)
Argument Type Description
subq_index int numeric index of the subqueue-of-interest [Subqueue stream indices start at 0 and increment by one. There is no upper bound on the number of subqueues, but conservation of memory is achieved if they are utilized in a contiguous manner. Instead of an explicit index of a subqueue, an abstract subqueue selection index may be specified. An abstract subqueue selection index specifies a particular subqueue by a unique property it has. The acceptable abstract subqueue selection indices are listed in Table 85 “Subqueue Selection Index Symbolic Constants“ on page 26.]
stat_index int numeric index of the subqueue statistic-of-interest [This is an integer code which represents one of the possible queue statistic types (see Table 74 “Queue Statistic Symbolic Constants“ on page 22).]

Return Type

double

Current value of the specified statistic. The constant OPC_DBL_INVALID is returned if a recoverable error occurs.

Example

/* determine if queue is empty; if not, then process its contents */
if (op_q_empty () == OPC_FALSE)
	{
	/* determine the number of subqueues */
	op_ima_obj_attr_get (op_id_self (), "subqueue", &subq_objid);
	num_subqs = op_topo_child_count (subq_objid, OPC_OBJTYPE_SUBQ);

	/* loop through each subqueue */
	for (i = 0; i < num_subqs; i++)
		{
		/* determine the number of packets in subqueue */
		num_pkts = op_subq_stat (i, OPC_QSTAT_PKSIZE);

		/* loop through each packet in subqueue */
		for (j = 0; j < num_pkts; j++)
			{
			/* schedule self interrupt based on packet’s insert time */
			pkptr = op_subq_pk_access (i, j);
			op_intrpt_schedule_self (op_q_insert_time (pkptr) + 0.05, PROC_COMP);
			}
		}
	}

Details

This KP must only be invoked within the context of a process running on a queue module (or from a function which is directly or indirectly invoked by a queue process); invoking it from a process running on a processor, or from a pipeline stage model will cause an error.

Purpose

Provides a mechanism for obtaining statistics on subqueue status, operations, and performance. There are twelve queue statistics which are computed due to a query by this KP (i.e., “on-demand” computation). Combining this KP with an abstract subqueue selection index, particularly if the subqueue selection index and the subqueue statistic are different, provides a powerful way to obtain information about a queue in a single statement.

Errors

  • Program Abort: KP requires queue context.
  • Recoverable Error: Subqueue selection flag (<flag>) is unrecognized.

Reference

  • Use the KP op_q_stat() to obtain the value of queue-wide statistics
  • Use the KP op_stat_local_read() to obtain the value of one of the surrounding queue’s input statistics

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