4.14.5 Event counters

To count events in an event stream without the runtime overhead of using the event callbacks, set the optional counter argument of the eventStream_create() function to True.

This argument has the following effects:

  • An internal counter is incremented for each event. This counter is specific to each event stream and client, in other words, it is specific to each eventStream_create() call.
  • No normal 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 relevant 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 be able to determine the number of wraparounds that occurred.

Non-ConfidentialPDF file icon PDF version101196_0100_00_en
Copyright © 2018 Arm Limited or its affiliates. All rights reserved.