op_ev_stat()
Abstract
Obtains the input statistic index associated with the specified event.
Syntax
op_ev_stat (evhandle)
| Argument | Type | Description |
|---|---|---|
evhandle |
Evhandle |
event handle that identifies the event [An event handle can be obtained from several KPs in this package, such as op_ev_current(), op_ev_seek_time(), and op_ev_next().]. |
Return Type
int
input statistic index associated with the specified event.
This input statistic index is that of the destination statistic for the statistic wire associated with the specified event. The constant OPC_STAT_INVALID is returned if a recoverable error occurs.
Example
/* Determine if any interrupts on the Q_LEN statwire are scheduled */
/* to occur in the next five seconds. */
stat_intrpt_found = 0;
time_boundary = op_sim_time () + 5.0;
event = op_ev_next (op_ev_current ());
while (op_ev_valid (event))
{
/* If the event is after the time boundary, then quit looking. */
if (op_ev_time (event) > time_boundary)
break
/* If it is a statwire intrpt on the Q_LEN statwire, note it and break out. */
if ((op_ev_type (event) == OPC_INTRPT_STAT) &&
(op_ev_stat (event) == Q_LEN_STATWIRE))
{
stat_intrpt_found = 1;
break;
}
/* Didn’t match, so try the next local event. */
event = op_ev_next_local (event);
}
Details
This KP will only produce a valid result when applied to an event that is associated with an incoming statistic wire. The only type of event meeting this restriction is the statistic interrupt. Note that op_ev_stat (op_ev_current()) is equivalent to op_intrpt_stat().
Purpose
Provides a mechanism for determining which input statistic is associated with an event.
Errors
- Program Abort: Segmentation violation. (due to a malformed event handle)
- Recoverable Error: Event handle refers to an event that is either invalid or not currently scheduled.
- Recoverable Error: Event is not statistic-wire related.
Reference
- Use the KP op_ev_valid() to determine if the Evhandle is valid
- Use the KP op_ev_type() to determine the type of the event
- Use the KP op_ev_code() to determine the code of a self, remote, or multicast interrupt
- Use the KP op_ev_strm() to determine the stream index associated with a stream interrupt
- Use the KP op_ev_time() to determine the scheduled time of the event
- Use the KP op_ev_ici() to obtain the ICI associated with the event