Luanti 5.16.0-dev
Loading...
Searching...
No Matches
Profiler Class Reference

#include <profiler.h>

Collaboration diagram for Profiler:

Classes

struct  DataPair

Public Types

typedef std::map< std::string, float > GraphValues

Public Member Functions

 Profiler ()
void add (const std::string &name, float value)
void avg (const std::string &name, float value)
void max (const std::string &name, float value)
void clear ()
float getValue (const std::string &name) const
int getAvgCount (const std::string &name) const
u64 getElapsedMs () const
int print (std::ostream &o, u32 page=1, u32 pagecount=1)
void getPage (GraphValues &o, u32 page, u32 pagecount)
void graphSet (const std::string &id, float value)
void graphAdd (const std::string &id, float value)
void graphPop (GraphValues &result)
void remove (const std::string &name)

Private Attributes

std::mutex m_mutex
std::map< std::string, DataPairm_data
std::map< std::string, float > m_graphvalues
u64 m_start_time

Member Typedef Documentation

◆ GraphValues

typedef std::map<std::string, float> Profiler::GraphValues

Constructor & Destructor Documentation

◆ Profiler()

Profiler::Profiler ( )

References porting::getTimeMs(), and m_start_time.

Here is the call graph for this function:

Member Function Documentation

◆ add()

void Profiler::add ( const std::string & name,
float value )

References m_data, m_mutex, and SPT_ADD.

Referenced by Server::AsyncRunStep(), ServerMap::save(), and Map::timerUpdate().

Here is the caller graph for this function:

◆ avg()

void Profiler::avg ( const std::string & name,
float value )

References m_data, and m_mutex.

◆ clear()

void Profiler::clear ( )

References porting::getTimeMs(), m_data, m_mutex, and m_start_time.

Here is the call graph for this function:

◆ getAvgCount()

int Profiler::getAvgCount ( const std::string & name) const

References m_data.

Referenced by print().

Here is the caller graph for this function:

◆ getElapsedMs()

u64 Profiler::getElapsedMs ( ) const

References porting::getTimeMs(), and m_start_time.

Here is the call graph for this function:

◆ getPage()

void Profiler::getPage ( GraphValues & o,
u32 page,
u32 pagecount )

References m_data, m_mutex, and paging().

Referenced by print().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getValue()

float Profiler::getValue ( const std::string & name) const

References m_data.

◆ graphAdd()

void Profiler::graphAdd ( const std::string & id,
float value )
inline

References m_graphvalues, and m_mutex.

◆ graphPop()

void Profiler::graphPop ( GraphValues & result)
inline

References m_graphvalues, and m_mutex.

◆ graphSet()

void Profiler::graphSet ( const std::string & id,
float value )
inline

References m_graphvalues, and m_mutex.

◆ max()

void Profiler::max ( const std::string & name,
float value )

References m_data, m_mutex, and SPT_MAX.

◆ print()

int Profiler::print ( std::ostream & o,
u32 page = 1,
u32 pagecount = 1 )

References getAvgCount(), getPage(), and porting::mt_snprintf().

Referenced by Server::AsyncRunStep(), ServerMap::save(), and Map::timerUpdate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove()

void Profiler::remove ( const std::string & name)
inline

References m_data, and m_mutex.

Member Data Documentation

◆ m_data

std::map<std::string, DataPair> Profiler::m_data
private

◆ m_graphvalues

std::map<std::string, float> Profiler::m_graphvalues
private

Referenced by graphAdd(), graphPop(), and graphSet().

◆ m_mutex

std::mutex Profiler::m_mutex
private

◆ m_start_time

u64 Profiler::m_start_time
private

Referenced by Profiler(), clear(), and getElapsedMs().


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