PMSIS API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Performance counters

Functions

static void pi_perf_conf (unsigned events)
 Configure performance counters. More...
 
static void pi_perf_reset ()
 Reset all hardware performance counters. More...
 
static void pi_perf_start ()
 Start monitoring configured events. More...
 
static void pi_perf_stop ()
 Stop monitoring configured events. More...
 
static unsigned int pi_perf_read (int id)
 Read a performance counter. More...
 

Description

This API gives access to the core performance counters. Each core has a few performance counters which can be configured to count one event out of several available. An event is a cycle, an instruction, a cache miss and so on. The number of counters limits the number of events which can be monitored at the same time and depends on the platform. Real chips have only 1 counter while other platforms have one per event.

In addition, this API uses a few other HW mechanisms useful for monitoring performance such as timers.

Function Documentation

static void pi_perf_conf ( unsigned  events)
inlinestatic

The set of events which can be activated at the same time depends on the platform. On real chips (rather than with the simulator), there is always only one counter. It is advisable to always use only one to be compatible with simulator and chip. At least PI_PERF_CYCLES and another event can be monitored at the same time as the first one is using the timer. This API can be called both from fabric-controller or cluster side.

Parameters
eventsA mask containing the events to activate. This is a bitfield, so events identifier must be used like 1 << PI_PERF_CYCLES.
static unsigned int pi_perf_read ( int  id)
inlinestatic

This does a direct read to the specified performance counter. Calling this function is useful for getting the performance counter with very low overhead (just few instructions). This API can be called both from fabric-controller or cluster side.

Parameters
idThe performance event identifier to read.
Returns
The performance counter value.
static void pi_perf_reset ( )
inlinestatic

All hardware performance counters are set to 0, except the time, as it is a shared resource within the cluster. This API can be called both from fabric-controller or cluster side.

static void pi_perf_start ( )
inlinestatic

This function is useful for finely controlling the point where performance events start being monitored. The counter retains its value between stop and start so it is possible to easily sum events for several portions of code. This API can be called both from fabric-controller or cluster side.

static void pi_perf_stop ( )
inlinestatic

This API can be called both from fabric-controller or cluster side.