Non-Confidential | ![]() | 101196_0100_03_en | ||
| ||||
Home > Iris APIs > Events and trace API > Event counter |
To count events in an event stream without the runtime overhead of using event callbacks, set the optional counter
argument of the eventStream_create()
function to True.
This argument has the following effects:
eventStream_create()
call.ec_FOO()
callbacks are generated, but see
counterMode.nonOverflowTrace
. The counter
is initially set to the startVal
argument that is passed to eventStream_create()
, or to zero if startVal
is not specified. Together with the counterMode
argument, startVal
, which is of type NumberU64
, can be used to
trigger an action after N
events by setting it to
0xffffffffffffffff
-N
+1.
The counterMode
argument determines what happens when the counter overflows from
0xffffffffffffffff
to 0 and what happens on
non-overflow events. Several orthogonal actions can be selected by setting flags in
counterMode
, see EventCounterMode
for
details.
In addition to causing actions on counter overflow and counter events, the
counter
value of a counting event stream can be read by using
eventStream_getCounter()
.
In the counter mode that is created using eventStream_create(counter=True)
, the counter counts from 0 to 264-1 and then automatically wraps to 0. This overflow can safely be ignored in all cases. The difference between two 64-bit counter values is the number of ticks between the counter values if fewer than 264 ticks occurred between reading the counter values.
For counterMode.overflowReload
, clients must also enable counterMode.overflowTrace
to determine the number of wraparounds that occurred.