Sending Custom Timing Data#

PVRTune has the ability to display custom timing data similar to that displayed for the TA and 3D tasks.

This custom timing data appears in the timeline created using pplInitialise(). Each block of the custom timing data is started with a call to pplSendProcessingBegin() and ended with a call to pplSendProcessingEnd().

Note

These calls cannot be nested.

Starting a Timing Block#

To start a timing block, complete the following instructions:

  1. Determine the current frame.

unsigned int currentFrame = 0;
  1. Name the timing block.

std::string funcName = __func__;
  1. Call

pplSendProcessingBegin();
pplSendProcessingBegin(PVRScopeComms, funcName.c_str(), (unsigned int)funcName.length(), currentFrame);

Ending a Timing Block#

To end a timing block, call pplSendProcessingEnd() as follows:

pplSendProcessingEnd(PVRScopeComms);

Full source code#

/*********************************************************************************************
*
* This example code consists of four steps:
*
* 1. Setup two functions to time
* 2. Setup PVRScopeComms
* 3. Call the two functions to end the Custom Timing Data to PVRTune
* 4. Shutdown PVRScopeComms
*
*********************************************************************************************/

#include "PVRScopeComms.h"

// Step 1. Setup two functions to time

// Function that pretends to do some work
void Foo(SSPSCommsData* comms, unsigned int frameNum)
{
    std::string funcName = __func__;
    pplSendProcessingBegin(*comms, funcName, (unsigned int)funcName.length(), frameNum);

    // Pretend to do some work
    sleep(1);

    pplSendProcessingEnd(*comms);
}

// Function that pretends to do a bit more work
void Bar(SSPSCommsData* comms, unsigned int frameNum)
{
    std::string funcName = __func__;
    pplSendProcessingBegin(*comms, funcName, (unsigned int)funcName.length(), frameNum);

    // Pretend to do some work
    sleep(2);

    pplSendProcessingEnd(*comms);
}


// Step 2. Setup PVRScopeComms
SSPSCommsData* PVRScopeComms;
std::string timelineTitle = "Example";
PVRScopeComms = pplInitialise(timelineTitle,
                              (unsigned int)timelineTitle.length());

// Step 3. Send Custom Timing Data to PVRTune
unsigned int currentFrame = 0;
for(unsigned int i = 0; i < 100; i++)
{
    Foo(PVRScopeComms, currentFrame);
    Bar(PVRScopeComms, currentFrame);

    currentFrame++;
}

// Step 4. Shutdown PVRScopeComms
pplShutdown(PVRScopeComms);