Reading Counter Data using PVRScope

To read counter data using PVRScope:

  1. Set activeGroup to one of the following:

    • A new Group ID, if the next counters to be read are in a different group;

    • 0xffffffff, if no group change is required.

  2. Read the current counter values and set the group for the next update:

    PVRScopeReadCounters(PVRScopeStatsData, &counterReading, activeGroup);
    PVRScopeSetGroup(PVRScopeStatsData, &counterReading, activeGroup);

It is worth noting that there are some limitations to the PVRScopeReadCounters and PVRScopeSetGroup functions. The functions have to be called regularly to allow PVRScope to track the latest hardware performance data. If psReading is not NULL, PVRScope will also calculate and return counter values to the application.

There are two uses cases for calling the function:

  1. A 3D application rendering a performance HUD, for example, the on-screen graphs in PVRScopeStats Example. Such an application should call this function at least once per frame in order to gather new counter values. If slower HUD updates are desired, psReading may be NULL until a new reading is required, in order to smooth out values across longer time periods, perhaps for a number of frames.

  2. A standalone performance monitor, such as PVRMonitor or logging application. Such an application should idle and regularly wake up to call this function. Suggested rates are 100Hz (10ms delays) or 200Hz (5ms delays). If counter updates are required at a lower rate, set psReading to NULL on all calls except when new counter values are desired.

Note:: Although the sampling period is configurable, the recommended sampling interval is 16ms. Setting a smaller sampling period may result in “noisy” data, whilst a longer sampling period will result in some counter events being omitted as the driver has a limited amount of data that can be stored in its circular buffer until old values are overwritten.