op_q_stat()

Abstract

Obtains the value of a statistic which is automatically computed by the surrounding queue; the statistic is queue-wide (rather than pertaining to a single subqueue).

Syntax

op_q_stat (stat_index)
Argument Type Description
stat_index int numeric index of the queue statistic-of-interest
[This is an integer code that 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 for the surrounding queue.

The constant OPC_DBL_INVALID will be returned if a recoverable error occurs.

Example

/* determine the type of the interrupt */
if (op_intrpt_type () == OPC_INTRPT_REMOTE)
	{
	/* cold reboot: total loss of queued packets */
	if (op_intrpt_code () == COLD_REBOOT)
		{
		/* record the number of packets lost */
		num_lost_packets += op_q_stat (OPC_QSTAT_PKSIZE);

		/* flush the queue of its contents */
		op_q_flush ();
		}

	/* prioritize: loop through and sort all subqueues */
	else if (op_intrpt_code () == PRIORITIZE)
		{
		num_subqs = op_topo_child_count (op_id_self (), OPC_OBJTYPE_SUBQ);
		for (i = 0; i < num_subqs; i++)
			op_subq_sort (i);
		}
	}

Details

Q package KPs 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 them from a process running on a processor, or a pipeline stage model, will cause an error.

See Chapter 6 “Node Domain” on page 267 for more information on queue statistics.

Purpose

Provides a mechanism for obtaining statistics on the surrounding queue’s status, operation, and performance. There are a dozen queue statistics which are computed due to a query by this KP (i.e., “on-demand” computation). Queue statistics can be used to adaptively modify the behavior of a queueing algorithm; for instance, the average delay experienced by packets in a queue can be compared to a threshold value which alters the way that incoming packets are handled by the queueing process.

Errors

  • Program Abort: KP requires queue context.
  • Recoverable Error: Queue statistic index (<stat_index>) is out-of-range.

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