OGRE-Next  2.3
Object-Oriented Graphics Rendering Engine
Ogre::OfflineProfiler Class Reference

Simple profiler that will produce a CSV file for offline analysis once dumpProfileResults is called. More...

#include <OgreOfflineProfiler.h>

Public Member Functions

 OfflineProfiler ()
 
 ~OfflineProfiler ()
 
void dumpProfileResults (const String &fullPathPerFrame, const String &fullPathAccum)
 Dumps CSV data into two CSV files. More...
 
bool isPaused () const
 Returns true if sampling is paused. More...
 
void profileBegin (const char *name, ProfileSampleFlags::ProfileSampleFlags flags)
 
void profileEnd ()
 
void reset ()
 Destroys all collected samples and starts over. More...
 
void setDumpPathsOnShutdown (const String &fullPathPerFrame, const String &fullPathAccum)
 Ogre will call dumpProfileResults for your on shutdown if you set these paths. More...
 
void setPaused (bool bPaused)
 Pauses collection of samples. More...
 

Detailed Description

Simple profiler that will produce a CSV file for offline analysis once dumpProfileResults is called.

Remarks
Because this profiler collects sample undefinitely, it will cause memory consumption to grow over time. You can use setPaused to halt such growth temporarily, which is specially useful if whatever you want to profile is localized to particular execution moment.

Constructor & Destructor Documentation

◆ OfflineProfiler()

Ogre::OfflineProfiler::OfflineProfiler ( )

◆ ~OfflineProfiler()

Ogre::OfflineProfiler::~OfflineProfiler ( )

Member Function Documentation

◆ dumpProfileResults()

void Ogre::OfflineProfiler::dumpProfileResults ( const String fullPathPerFrame,
const String fullPathAccum 
)

Dumps CSV data into two CSV files.

Parameters
fullPathPerFrameFull path to csv without extension to generate where to dump the per-frame CSV data. Empty string to skip it. Note that the CSV extension will be appended, and the actual filename my vary as there will be one file per thread that was collected.
fullPathAccumFull path to csv without extension to generate where to dump the per-frame CSV data. Empty string to skip it. Note that the CSV extension will be appended, and the actual filename my vary as there will be one file per thread that was collected.

◆ isPaused()

bool Ogre::OfflineProfiler::isPaused ( ) const

Returns true if sampling is paused.

Note that some worker threads may still be collecting samples even if this returns true (and likewise, they may take a bit of time to resume again)

See also
OfflineProfiler::setPaused

◆ profileBegin()

void Ogre::OfflineProfiler::profileBegin ( const char *  name,
ProfileSampleFlags::ProfileSampleFlags  flags 
)

◆ profileEnd()

void Ogre::OfflineProfiler::profileEnd ( )

◆ reset()

void Ogre::OfflineProfiler::reset ( )

Destroys all collected samples and starts over.

Worker threads will honour this request as soon as they see it (which is the next time they call profileBegin).

◆ setDumpPathsOnShutdown()

void Ogre::OfflineProfiler::setDumpPathsOnShutdown ( const String fullPathPerFrame,
const String fullPathAccum 
)

Ogre will call dumpProfileResults for your on shutdown if you set these paths.

Parameters
fullPathPerFrameFull path to csv without extension to generate where to dump the per-frame CSV data. Empty string to skip it. Note that the CSV extension will be appended, and the actual filename my vary as there will be one file per thread that was collected.
fullPathAccumFull path to csv without extension to generate where to dump the per-frame CSV data. Empty string to skip it. Note that the CSV extension will be appended, and the actual filename my vary as there will be one file per thread that was collected.
See also
OfflineProfiler::dumpProfileResults

◆ setPaused()

void Ogre::OfflineProfiler::setPaused ( bool  bPaused)

Pauses collection of samples.

Note that other threads may be in the middle of a collection (i.e. they've called profileBegin but haven't yet called profileEnd). Threads will pause after their collection ends (i.e. only after they end up calling profileEnd).

Likewise, if you resume sampling, a thread that already called profileBegin while it was paused, thus it will resume sampling in its next profileBegin call.

TL;DR: It is thread safe, but do not assume pause is immediate (i.e. worker threads may still add a new sample after calling setPaused( true ))

Parameters
bPausedTrue to pause. False to resume.

The documentation for this class was generated from the following file: