SNAP Library, Developer Reference
2012-10-15 15:06:59
SNAP, a general purpose network analysis and graph mining library
|
Go to the source code of this file.
Classes | |
class | TTmInfo |
class | TJulianDate |
class | TSecTm |
class | TTm |
class | TExeTm |
class | TTmStopWatch |
class | TTmTimer |
Typedefs | |
typedef TVec< TSecTm > | TSecTmV |
typedef TKeyDat< TSecTm, TStr > | TSecTmStrKd |
typedef TVec< TSecTmStrKd > | TSecTmStrKdV |
typedef TVec< TTm > | TTmV |
typedef TPair< TTm, TStr > | TTmStrPr |
typedef TPair< TStr, TTm > | TStrTmPr |
typedef TVec< TTmStrPr > | TTmStrPrV |
typedef TVec< TStrTmPr > | TStrTmPrV |
Enumerations | |
enum | TTmUnit { tmuUndef, tmu1Sec, tmu1Min, tmu10Min, tmu15Min, tmu30Min, tmu1Hour, tmu2Hour, tmu4Hour, tmu6Hour, tmu12Hour, tmuDay, tmuWeek, tmuMonth, tmuYear, tmuNodes, tmuEdges } |
Functions | |
TTmProfiler () | |
static PTmProfiler | New () |
int | AddTimer (const TStr &TimerNm) |
int | GetTimerId (const TStr &TimerNm) const |
TStr | GetTimerNm (const int &TimerId) const |
int | GetTimers () const |
int | GetTimerIdFFirst () const |
bool | GetTimerIdFNext (int &TimerId) const |
void | StartTimer (const TStr &TimerNm) |
void | StartTimer (const int &TimerId) |
void | StopTimer (const TStr &TimerNm) |
void | StopTimer (const int &TimerId) |
void | ResetAll () |
void | ResetTimer (const TStr &TimerNm) |
void | ResetTimer (const int &TimerId) |
double | GetTimerSumSec () const |
double | GetTimerSec (const int &TimerId) const |
void | PrintReport (const TStr &ProfileNm="") const |
Variables | |
ClassTP(TTmProfiler, PTmProfiler) private THash < TStr, TTmStopWatch > | TimerH |
typedef TVec<TSecTmStrKd> TSecTmStrKdV |
enum TTmUnit |
int TTmProfiler::AddTimer | ( | const TStr & | TimerNm | ) |
Definition at line 1286 of file tm.cpp.
References TInt::GetMx(), TStr::Len(), and TimerH.
{ MxNmLen = TInt::GetMx(MxNmLen, TimerNm.Len()); return TimerH.AddKey(TimerNm); }
int GetTimerId | ( | const TStr & | TimerNm | ) | const |
int GetTimerIdFFirst | ( | ) | const |
Definition at line 413 of file tm.h.
References TimerH.
Referenced by GetTimerSumSec(), PrintReport(), and ResetAll().
{ return TimerH.FFirstKeyId(); }
bool GetTimerIdFNext | ( | int & | TimerId | ) | const |
Definition at line 414 of file tm.h.
References TimerH.
Referenced by GetTimerSumSec(), PrintReport(), and ResetAll().
{ return TimerH.FNextKeyId(TimerId); }
TStr GetTimerNm | ( | const int & | TimerId | ) | const |
Definition at line 411 of file tm.h.
References TimerH.
Referenced by PrintReport().
{ return TimerH.GetKey(TimerId); }
int GetTimers | ( | ) | const |
double TTmProfiler::GetTimerSec | ( | const int & | TimerId | ) | const |
Definition at line 1307 of file tm.cpp.
References TimerH.
Referenced by GetTimerSumSec(), and PrintReport().
{ return TimerH[TimerId].GetSec(); }
double TTmProfiler::GetTimerSumSec | ( | ) | const |
Definition at line 1298 of file tm.cpp.
References GetTimerIdFFirst(), GetTimerIdFNext(), and GetTimerSec().
Referenced by PrintReport().
{ double Sum = 0.0; int TimerId = GetTimerIdFFirst(); while (GetTimerIdFNext(TimerId)) { Sum += GetTimerSec(TimerId); } return Sum; }
static PTmProfiler New | ( | ) | [static] |
Definition at line 407 of file tm.h.
References TTmProfiler().
{ return new TTmProfiler; }
void TTmProfiler::PrintReport | ( | const TStr & | ProfileNm = "" | ) | const |
Definition at line 1311 of file tm.cpp.
References TStr::CStr(), TStr::GetSpaceStr(), GetTimerIdFFirst(), GetTimerIdFNext(), GetTimerNm(), GetTimerSec(), GetTimerSumSec(), and TStr::Len().
{ const double TimerSumSec = GetTimerSumSec(); printf("-- %s --\n", ProfileNm.CStr()); printf("Sum: (%.2f sec):\n", TimerSumSec); int TimerId = GetTimerIdFFirst(); while (GetTimerIdFNext(TimerId)) { // get timer name TStr TimerNm = GetTimerNm(TimerId); TimerNm = TStr::GetSpaceStr(TimerNm.Len() - MxNmLen) + TimerNm; // get timer time and precentage if (TimerSumSec > 0.0) { const double TimerSec = GetTimerSec(TimerId); const double TimerPerc = TimerSec / TimerSumSec * 100.0; printf(" %s: %.2fs [%.2f%%]\n", TimerNm.CStr(), TimerSec, TimerPerc); } else { printf(" %s: -\n", TimerNm.CStr()); } } printf("--\n"); }
void TTmProfiler::ResetAll | ( | ) |
Definition at line 1291 of file tm.cpp.
References GetTimerIdFFirst(), GetTimerIdFNext(), and ResetTimer().
{ int TimerId = GetTimerIdFFirst(); while (GetTimerIdFNext(TimerId)) { ResetTimer(TimerId); } }
void ResetTimer | ( | const TStr & | TimerNm | ) |
Definition at line 423 of file tm.h.
References TimerH.
Referenced by ResetAll().
{ TimerH.GetDat(TimerNm).Reset(false); }
void ResetTimer | ( | const int & | TimerId | ) |
void StartTimer | ( | const TStr & | TimerNm | ) |
void StartTimer | ( | const int & | TimerId | ) |
void StopTimer | ( | const int & | TimerId | ) |
TTmProfiler | ( | ) |
ClassTP (TTmProfiler, PTmProfiler) private THash<TStr, TTmStopWatch> TimerH |
Definition at line 400 of file tm.h.
Referenced by AddTimer(), GetTimerId(), GetTimerIdFFirst(), GetTimerIdFNext(), GetTimerNm(), GetTimers(), GetTimerSec(), ResetTimer(), StartTimer(), and StopTimer().