-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
232 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,8 @@ You can contact Cyan Worlds, Inc. by email [email protected] | |
|
||
#include "HeadSpin.h" | ||
|
||
#include <string_theory/string> | ||
|
||
#ifndef PLASMA_EXTERNAL_RELEASE | ||
#define PL_PROFILE_ENABLED | ||
#endif | ||
|
@@ -79,23 +81,23 @@ You can contact Cyan Worlds, Inc. by email [email protected] | |
|
||
#ifdef PL_PROFILE_ENABLED | ||
|
||
#define plProfile_CreateTimerNoReset(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayTime | plProfileVar::kDisplayNoReset) | ||
#define plProfile_CreateTimer(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayTime) | ||
#define plProfile_CreateAsynchTimer(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayTime | plProfileVar::kDisplayResetEveryBegin | plProfileVar::kDisplayNoReset) | ||
#define plProfile_CreateTimerNoReset(name, group, varName) plProfileVar gProfileVar##varName(ST_LITERAL(name), ST_LITERAL(group), plProfileVar::kDisplayTime | plProfileVar::kDisplayNoReset) | ||
#define plProfile_CreateTimer(name, group, varName) plProfileVar gProfileVar##varName(ST_LITERAL(name), ST_LITERAL(group), plProfileVar::kDisplayTime) | ||
#define plProfile_CreateAsynchTimer(name, group, varName) plProfileVar gProfileVar##varName(ST_LITERAL(name), ST_LITERAL(group), plProfileVar::kDisplayTime | plProfileVar::kDisplayResetEveryBegin | plProfileVar::kDisplayNoReset) | ||
#define plProfile_BeginTiming(varName) gProfileVar##varName.BeginTiming() | ||
#define plProfile_EndTiming(varName) gProfileVar##varName.EndTiming() | ||
#define plProfile_BeginLap(varName, lapName) gProfileVar##varName.BeginLap(lapName) | ||
#define plProfile_EndLap(varName, lapName) gProfileVar##varName.EndLap(lapName) | ||
|
||
#define plProfile_CreateCounter(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayCount) | ||
#define plProfile_CreateCounterNoReset(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayCount | plProfileVar::kDisplayNoReset) | ||
#define plProfile_CreateCounter(name, group, varName) plProfileVar gProfileVar##varName(ST_LITERAL(name), ST_LITERAL(group), plProfileVar::kDisplayCount) | ||
#define plProfile_CreateCounterNoReset(name, group, varName) plProfileVar gProfileVar##varName(ST_LITERAL(name), ST_LITERAL(group), plProfileVar::kDisplayCount | plProfileVar::kDisplayNoReset) | ||
#define plProfile_Inc(varName) gProfileVar##varName.Inc() | ||
#define plProfile_IncCount(varName, count) gProfileVar##varName.Inc(count) | ||
#define plProfile_Dec(varName) gProfileVar##varName.Dec() | ||
#define plProfile_Set(varName, value) gProfileVar##varName.Set(value) | ||
|
||
#define plProfile_CreateMemCounter(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayMem | plProfileVar::kDisplayNoReset) | ||
#define plProfile_CreateMemCounterReset(name, group, varName) plProfileVar gProfileVar##varName(name, group, plProfileVar::kDisplayMem) | ||
#define plProfile_CreateMemCounter(name, group, varName) plProfileVar gProfileVar##varName(ST_LITERAL(name), ST_LITERAL(group), plProfileVar::kDisplayMem | plProfileVar::kDisplayNoReset) | ||
#define plProfile_CreateMemCounterReset(name, group, varName) plProfileVar gProfileVar##varName(ST_LITERAL(name), ST_LITERAL(group), plProfileVar::kDisplayMem) | ||
#define plProfile_NewMem(varName, memAmount) gProfileVar##varName.NewMem(memAmount) | ||
#define plProfile_DelMem(varName, memAmount) gProfileVar##varName.DelMem(memAmount) | ||
|
||
|
@@ -151,7 +153,7 @@ class plProfileBase | |
}; | ||
|
||
protected: | ||
const char* fName; // Name of timer | ||
ST::string fName; // Name of timer | ||
|
||
uint64_t fValue; | ||
|
||
|
@@ -168,7 +170,7 @@ class plProfileBase | |
|
||
void IAddAvg(); | ||
|
||
void IPrintValue(uint64_t value, char* buf, bool printType); | ||
ST::string IPrintValue(uint64_t value, bool printType); | ||
|
||
public: | ||
plProfileBase(); | ||
|
@@ -181,13 +183,13 @@ class plProfileBase | |
|
||
uint64_t GetValue(); | ||
|
||
void PrintValue(char* buf, bool printType=true); | ||
void PrintAvg(char* buf, bool printType=true); | ||
void PrintMax(char* buf, bool printType=true); | ||
ST::string PrintValue(bool printType = true); | ||
ST::string PrintAvg(bool printType = true); | ||
ST::string PrintMax(bool printType = true); | ||
|
||
uint32_t GetTimerSamples() const { return fTimerSamples; } | ||
|
||
const char* GetName() { return fName; } | ||
ST::string GetName() { return fName; } | ||
|
||
void SetActive(bool s) { fActive = s; } | ||
|
||
|
@@ -202,21 +204,21 @@ class plProfileBase | |
class plProfileVar : public plProfileBase | ||
{ | ||
protected: | ||
const char* fGroup; | ||
ST::string fGroup; | ||
plProfileLaps* fLaps; | ||
bool fLapsActive; | ||
|
||
plProfileVar() {} | ||
|
||
void IBeginTiming(); | ||
void IEndTiming(); | ||
void IBeginLap(const char* lapName); | ||
void IEndLap(const char* lapName); | ||
|
||
void IBeginLap(const ST::string& lapName); | ||
void IEndLap(const ST::string& lapName); | ||
|
||
public: | ||
// Name is the timer name. Each timer group gets its own plStatusLog | ||
plProfileVar(const char *name, const char* group, uint8_t flags); | ||
plProfileVar(ST::string name, ST::string group, uint8_t flags); | ||
~plProfileVar(); | ||
|
||
// For timing | ||
|
@@ -238,10 +240,10 @@ class plProfileVar : public plProfileBase | |
// Will output to log like | ||
// Timername : lapCnt: (lapName) : 3.22 msec | ||
// | ||
void BeginLap(const char* lapName) { if(fActive && fRunning) IBeginLap(lapName); } | ||
void EndLap(const char* lapName) { if(fActive && fRunning) IEndLap(lapName); } | ||
const char* GetGroup() { return fGroup; } | ||
void BeginLap(const ST::string& lapName) { if (fActive && fRunning) IBeginLap(lapName); } | ||
void EndLap(const ST::string& lapName) { if (fActive && fRunning) IEndLap(lapName); } | ||
|
||
ST::string GetGroup() { return fGroup; } | ||
|
||
plProfileLaps* GetLaps() { return fLaps; } | ||
|
||
|
Oops, something went wrong.