Help end child hunger

Profile Lib Specification

Prev: In Action Next: Header
 

VSProfileLib has actually very few methods, so this section will be fairly short. As mentioned in the previous section, PROFILE and PROFILE_GL are just defines for the instance constructor. Each profile segment creates an instance when it starts, and destroys it when it finishes, hence the curly brackets. The curly brackets define the scope where the instance variable will live.

What to profile is controlled by VSPL_PROFILE. There are three options for this constant:

  • VSPL_PROFILE_NONE: no profiling is performed
  • VSPL_PROFILE_CPU: CPU profiling only
  • VSPL_PROFILE_CPU_AND_GPU: profile both CPU and GPU (default value)

The following statement can be found at the beginning of vspl.h:

#define VSPL_PROFILE VSPL_PROFILE_CPU_AND_GPU

To change the profiler behaviour just change VSPL_PROFILE.

VSProfileLib allows the usage of several clocks. In addition to the standard C clock function, we can select Unix gettimeofday, and Windows QueryPerformanceCounter and GetSystemTime.

The header file contains the following defines:

#define VSPL_C_CLOCK 0
#define VSPL_GETTIMEOFDAY 1
#define VSPL_WIN_HIGH_PERFORMANCE_COUNTER 2
#define VSPL_WIN_SYSTEMTIME 3

To select a clock define VSPL_CLOCK. By default VSPL will use the standard C clock function, as the following line from the header shows:

#define VSPL_CLOCK VSPL_C_CLOCK

To select a different clock just replace VSPL_C_CLOCK by the defined constant for your selection.

Class Methods


static void Reset();

Function to reset all the profiler counters.

Example:

VSProfileLib::Reset();

static void CollectQueryResults();

Collects the OpenGL time queries. Use this at the end of the frame. VSProfileLib uses a double buffering scheme for the queries, as detailed in the tutorial. A string with the results can then be obtained with DumpLevels.

Example:

VSProfileLib::CollectQueryResults();

static const std::string &DumpLevels();

Returns a string with the profile report. This function can be called anytime, anywhere. There is no need to initialize the class. This string can then be printed on top of an OpenGL application with VSFontLib.

Example:

std::string s = VSProfileLib::DumpLevels();

 

Prev: In Action Next: Header
 

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2014 Lighthouse3d.com Suffusion theme by Sayontan Sinha