SNAP Library, Developer Reference  2012-10-15 15:06:59
SNAP, a general purpose network analysis and graph mining library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
tm.h File Reference
This graph shows which files directly or indirectly include this file:

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< TSecTmTSecTmV
typedef TKeyDat< TSecTm, TStrTSecTmStrKd
typedef TVec< TSecTmStrKdTSecTmStrKdV
typedef TVec< TTmTTmV
typedef TPair< TTm, TStrTTmStrPr
typedef TPair< TStr, TTmTStrTmPr
typedef TVec< TTmStrPrTTmStrPrV
typedef TVec< TStrTmPrTStrTmPrV

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 Documentation

Definition at line 205 of file tm.h.

Definition at line 206 of file tm.h.

typedef TVec<TSecTm> TSecTmV

Definition at line 204 of file tm.h.

typedef TPair<TStr, TTm> TStrTmPr

Definition at line 349 of file tm.h.

Definition at line 351 of file tm.h.

typedef TPair<TTm, TStr> TTmStrPr

Definition at line 348 of file tm.h.

Definition at line 350 of file tm.h.

typedef TVec<TTm> TTmV

Definition at line 347 of file tm.h.


Enumeration Type Documentation

enum TTmUnit
Enumerator:
tmuUndef 
tmu1Sec 
tmu1Min 
tmu10Min 
tmu15Min 
tmu30Min 
tmu1Hour 
tmu2Hour 
tmu4Hour 
tmu6Hour 
tmu12Hour 
tmuDay 
tmuWeek 
tmuMonth 
tmuYear 
tmuNodes 
tmuEdges 

Definition at line 9 of file tm.h.

             {
  tmuUndef, tmu1Sec, tmu1Min, tmu10Min, tmu15Min, tmu30Min,
  tmu1Hour, tmu2Hour, tmu4Hour, tmu6Hour, tmu12Hour, tmuDay, tmuWeek, // Sunday is the start of the week
  tmuMonth, tmuYear, tmuNodes, tmuEdges
  // wrap around time
  // tmuWrapHour, tmuWrapDay, tmuWrapWeek, tmuWrapMonth, tmuWrapYear
} TTmUnit;

Function Documentation

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); 
}

Here is the call graph for this function:

int GetTimerId ( const TStr TimerNm) const

Definition at line 410 of file tm.h.

References TimerH.

{ return TimerH.GetKeyId(TimerNm); }
int GetTimerIdFFirst ( ) const

Definition at line 413 of file tm.h.

References TimerH.

Referenced by GetTimerSumSec(), PrintReport(), and ResetAll().

{ return TimerH.FFirstKeyId(); }

Here is the caller graph for this function:

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); }

Here is the caller graph for this function:

TStr GetTimerNm ( const int &  TimerId) const

Definition at line 411 of file tm.h.

References TimerH.

Referenced by PrintReport().

{ return TimerH.GetKey(TimerId); }

Here is the caller graph for this function:

int GetTimers ( ) const

Definition at line 412 of file tm.h.

References TimerH.

{ return TimerH.Len(); }
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();
}

Here is the caller graph for this function:

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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PTmProfiler New ( ) [static]

Definition at line 407 of file tm.h.

References TTmProfiler().

{ return new TTmProfiler; }

Here is the call graph for this function:

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");
}

Here is the call graph for this function:

Definition at line 1291 of file tm.cpp.

References GetTimerIdFFirst(), GetTimerIdFNext(), and ResetTimer().

                           {
    int TimerId = GetTimerIdFFirst();
        while (GetTimerIdFNext(TimerId)) {
                ResetTimer(TimerId);
        }
}

Here is the call graph for this function:

void ResetTimer ( const TStr TimerNm)

Definition at line 423 of file tm.h.

References TimerH.

Referenced by ResetAll().

{ TimerH.GetDat(TimerNm).Reset(false); }

Here is the caller graph for this function:

void ResetTimer ( const int &  TimerId)

Definition at line 424 of file tm.h.

References TimerH.

{ TimerH[TimerId].Reset(false); }
void StartTimer ( const TStr TimerNm)

Definition at line 416 of file tm.h.

References TimerH.

{ TimerH.GetDat(TimerNm).Start(); }
void StartTimer ( const int &  TimerId)

Definition at line 417 of file tm.h.

References TimerH.

{ TimerH[TimerId].Start(); }
void StopTimer ( const TStr TimerNm)

Definition at line 419 of file tm.h.

References TimerH.

{ TimerH.GetDat(TimerNm).Stop(); }
void StopTimer ( const int &  TimerId)

Definition at line 420 of file tm.h.

References TimerH.

{ TimerH[TimerId].Stop(); }

Definition at line 406 of file tm.h.

Referenced by New().

{ }

Here is the caller graph for this function:


Variable Documentation