OpenClonk
C4Stat Class Reference

#include <C4Stat.h>

Collaboration diagram for C4Stat:
[legend]

Public Member Functions

 C4Stat (const char *strName)
 
 ~C4Stat ()
 
void Start ()
 
void Stop ()
 
void Reset ()
 
void ResetPart ()
 

Static Public Member Functions

static C4MainStatgetMainStat ()
 

Protected Attributes

C4StatpNext
 
C4StatpPrev
 
C4TimeMilliseconds tStartTime
 
unsigned int iStartCalled
 
uint32_t tTimeSum
 
unsigned int iCount
 
uint32_t tTimeSumPart
 
unsigned int iCountPart
 
const char * strName
 
bool bRegistred
 

Friends

class C4MainStat
 

Detailed Description

Definition at line 49 of file C4Stat.h.

Constructor & Destructor Documentation

◆ C4Stat()

C4Stat::C4Stat ( const char *  strName)

Definition at line 164 of file C4Stat.cpp.

165  : strName(strnName)
166 {
167  Reset();
168  getMainStat()->RegisterStat(this);
169 }
void RegisterStat(C4Stat *pStat)
Definition: C4Stat.cpp:27
static C4MainStat * getMainStat()
Definition: C4Stat.cpp:192
void Reset()
Definition: C4Stat.cpp:176
const char * strName
Definition: C4Stat.h:114

References getMainStat(), C4MainStat::RegisterStat(), and Reset().

Here is the call graph for this function:

◆ ~C4Stat()

C4Stat::~C4Stat ( )

Definition at line 171 of file C4Stat.cpp.

172 {
173  getMainStat()->UnRegStat(this);
174 }
void UnRegStat(C4Stat *pStat)
Definition: C4Stat.cpp:45

References getMainStat(), and C4MainStat::UnRegStat().

Here is the call graph for this function:

Member Function Documentation

◆ getMainStat()

C4MainStat * C4Stat::getMainStat ( )
static

Definition at line 192 of file C4Stat.cpp.

193 {
194  static C4MainStat *pMainStat = new C4MainStat();
195  return pMainStat;
196 }
friend class C4MainStat
Definition: C4Stat.h:51

References C4MainStat.

Referenced by C4Stat(), and ~C4Stat().

Here is the caller graph for this function:

◆ Reset()

void C4Stat::Reset ( )

Definition at line 176 of file C4Stat.cpp.

177 {
178  iStartCalled = 0;
179 
180  tTimeSum = 0;
181  iCount = 0;
182 
183  ResetPart();
184 }
unsigned int iCount
Definition: C4Stat.h:102
void ResetPart()
Definition: C4Stat.cpp:186
unsigned int iStartCalled
Definition: C4Stat.h:93
uint32_t tTimeSum
Definition: C4Stat.h:99

References iCount, iStartCalled, ResetPart(), and tTimeSum.

Referenced by C4Stat().

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

◆ ResetPart()

void C4Stat::ResetPart ( )

Definition at line 186 of file C4Stat.cpp.

187 {
188  tTimeSumPart = 0;
189  iCountPart = 0;
190 }
unsigned int iCountPart
Definition: C4Stat.h:110
uint32_t tTimeSumPart
Definition: C4Stat.h:107

References iCountPart, and tTimeSumPart.

Referenced by Reset().

Here is the caller graph for this function:

◆ Start()

void C4Stat::Start ( )
inline

Definition at line 57 of file C4Stat.h.

58  {
59  if (!iStartCalled)
61  iCount ++;
62  iCountPart ++;
63  iStartCalled ++;
64  }
C4TimeMilliseconds tStartTime
Definition: C4Stat.h:90
static C4TimeMilliseconds Now()

References iCount, iCountPart, iStartCalled, C4TimeMilliseconds::Now(), and tStartTime.

Here is the call graph for this function:

◆ Stop()

void C4Stat::Stop ( )
inline

Definition at line 66 of file C4Stat.h.

67  {
68  assert(iStartCalled);
69  iStartCalled --;
70  if (!iStartCalled && iCount >= 100)
71  {
72  uint32_t tTime = C4TimeMilliseconds::Now() - tStartTime;
73 
74  tTimeSum += tTime;
75  tTimeSumPart += tTime;
76  }
77  }

References iCount, iStartCalled, C4TimeMilliseconds::Now(), tStartTime, tTimeSum, and tTimeSumPart.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ C4MainStat

friend class C4MainStat
friend

Definition at line 51 of file C4Stat.h.

Referenced by getMainStat().

Member Data Documentation

◆ bRegistred

bool C4Stat::bRegistred
protected

Definition at line 117 of file C4Stat.h.

◆ iCount

unsigned int C4Stat::iCount
protected

Definition at line 102 of file C4Stat.h.

Referenced by Reset(), C4MainStat::Show(), Start(), and Stop().

◆ iCountPart

unsigned int C4Stat::iCountPart
protected

Definition at line 110 of file C4Stat.h.

Referenced by ResetPart(), C4MainStat::ShowPart(), and Start().

◆ iStartCalled

unsigned int C4Stat::iStartCalled
protected

Definition at line 93 of file C4Stat.h.

Referenced by Reset(), Start(), and Stop().

◆ pNext

◆ pPrev

C4Stat* C4Stat::pPrev
protected

Definition at line 88 of file C4Stat.h.

Referenced by C4MainStat::RegisterStat(), and C4MainStat::UnRegStat().

◆ strName

const char* C4Stat::strName
protected

Definition at line 114 of file C4Stat.h.

Referenced by C4MainStat::Show(), and C4MainStat::ShowPart().

◆ tStartTime

C4TimeMilliseconds C4Stat::tStartTime
protected

Definition at line 90 of file C4Stat.h.

Referenced by Start(), and Stop().

◆ tTimeSum

uint32_t C4Stat::tTimeSum
protected

Definition at line 99 of file C4Stat.h.

Referenced by Reset(), C4MainStat::Show(), and Stop().

◆ tTimeSumPart

uint32_t C4Stat::tTimeSumPart
protected

Definition at line 107 of file C4Stat.h.

Referenced by ResetPart(), C4MainStat::ShowPart(), and Stop().


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