You.i Engine
CYIProfiler Class Reference

Detailed Description

CYIProfiler

A container class for profiling data.

This class provides access to profiling data for multiple CYIProfileData.

Note
CYIProfiler is not thread-safe by default. Construct with threadSafe set to true to obtain thread safety for StartProfile and StopProfile which uses a CYISpinLock.
Warning
Although constructing with threadSafe set to true does provide thread safety for StartProfile and StopProfile it does not provide safety for the rest of the class.
See also
CYIEasyProfiler for

#include <utility/YiProfiler.h>

Public Types

enum  ReportFormat {
  ReportFormat::PlainText,
  ReportFormat::XML
}
 

Public Member Functions

 CYIProfiler (bool threadSafe=false, uint32_t maxProfiles=20)
 
void ResetProfiles (void)
 
void StartProfile (size_t index)
 
void StopProfile (size_t index)
 
bool AddProfile (size_t index, const CYIString &rName)
 
CYIProfileDataGetProfileData (size_t index) const
 
void SetMaximumProfiles (uint32_t maxProfiles)
 
size_t GetMaximumProfiles () const
 
CYIString Report (ReportFormat format=ReportFormat::PlainText, CYIProfileData::Accuracy accuracy=CYIProfileData::Accuracy::Milliseconds) const
 
CYIString Report (const std::vector< size_t > indexes, ReportFormat format=ReportFormat::PlainText, CYIProfileData::Accuracy accuracy=CYIProfileData::Accuracy::Milliseconds) const
 

Member Enumeration Documentation

◆ ReportFormat

Report formats used for retrieving profile reports.

Enumerator
PlainText 
XML 

Constructor & Destructor Documentation

◆ CYIProfiler()

CYIProfiler::CYIProfiler ( bool  threadSafe = false,
uint32_t  maxProfiles = 20 
)

Constructs a CYIProfiler that is threadSafe capable of handling maxProfiles CYIProfileData items.

Member Function Documentation

◆ AddProfile()

bool CYIProfiler::AddProfile ( size_t  index,
const CYIString rName 
)

Add a CYIProfileData item at index with rName.

Note
index is zero based.

◆ GetMaximumProfiles()

size_t CYIProfiler::GetMaximumProfiles ( ) const

Returns the maximum number of CYIProfileData items supported by the CYIProfiler.

◆ GetProfileData()

CYIProfileData* CYIProfiler::GetProfileData ( size_t  index) const

Returns a pointer to the CYIProfileData item at index.

Note
index is zero based.

◆ Report() [1/2]

Get a report from all CYIProfileData objects, optionally in XML format.

◆ Report() [2/2]

CYIString CYIProfiler::Report ( const std::vector< size_t indexes,
ReportFormat  format = ReportFormat::PlainText,
CYIProfileData::Accuracy  accuracy = CYIProfileData::Accuracy::Milliseconds 
) const

Get a report from the CYIProfileData at indicies specified in indexes, optionally in XML format.

◆ ResetProfiles()

void CYIProfiler::ResetProfiles ( void  )

Resets all CYIProfileData counters to 0.

◆ SetMaximumProfiles()

void CYIProfiler::SetMaximumProfiles ( uint32_t  maxProfiles)

Sets the maximum number of CYIProfileData items supported by the CYIProfiler.

◆ StartProfile()

void CYIProfiler::StartProfile ( size_t  index)

Start profiling for the CYIProfileData item at index.

Note
index is zero based.

◆ StopProfile()

void CYIProfiler::StopProfile ( size_t  index)

Stop profiling for the CYIProfileData item at index.

Note
index is zero based.

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