op_ev_count()

Abstract

Obtains the total number of events in the simulation that are currently scheduled or partially executed (sequential simulations only).

Syntax

op_ev_count ()
Argument Type Description
no arguments

Return Type

int

The number of events in the event list, including the current event and all forced events.

Example

/* Count the remote interrupts this module scheduled */
/* by looping through all of events and verifying if */
/* each is remote and from this module.              */
ri_count = 0;
num_events = op_ev_count ();
next_event = op_ev_current ();
for (i = 0; i < num_events; i++)
	{
	if ((op_ev_type (next_event) == OPC_INTRPT_REMOTE) &&
		(op_ev_src_id (next_event) == my_id))
		{
		ri_count++;
		}
	next_event = op_ev_next (next_event);
	}

Details

The total number of events includes the current event, all forced events, and the events in the event list.

Purpose

Provides a mechanism for determining the number of events. This is useful, for example, as an upper bound when looping through all of the events using op_ev_next().

Note: This KP works only in a sequential simulation context. In a parallel simulation, where events in the current time cell might be executed in varying fashion based on what the threads are doing, it will act as if there are no events after the current one.

Errors

  • No errors are trapped.

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