|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:
ec_FOO()callbacks are generated, but see
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
startVal, which is of type
NumberU64, can be used to
trigger an action after
N events by setting it to
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
In addition to causing actions on counter overflow and counter events, the
counter value of a counting event stream can be read by using
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.
counterMode.overflowReload, clients must also enable
counterMode.overflowTrace to determine the number of wraparounds that occurred.