6 #ifndef _INC_cTaskProfiler_H
7 #define _INC_cTaskProfiler_H
12 #include "../GrayLibBase.h"
19 #define USE_PROFILER_TEST
75 void InitTestCurrentWindow();
76 void ClearCurrentWindow();
88 return(m_iSampleWindowSec ?
true :
false);
92 return m_iSampleWindowSec;
94 void put_SampleWindowLen(
TIMESECD_t iSampleWindowSec);
131 return((
float)((
double)(m_PrvWindow[idTask].m_Time.m_nTime) / (
double)(m_TimeWindowSize.
m_nTime)));
137 return((
TIMESECF_t)m_PrvWindow[idTask].m_Time.get_Seconds());
154 return m_PrvWindow[idTask].m_nSamples;
158 virtual void OnSampleWindowComplete();
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
#define IS_INDEX_GOOD(i, q)
cast the (likely) int to unsigned to check for negatives.
Definition: Index.h:35
#define ASSERT(exp)
Definition: cDebugAssert.h:87
Definition: cTaskProfiler.h:25
UINT m_nSamples
how many samples/passes made into this.
Definition: cTaskProfiler.h:32
cTimePerf m_Time
accumulated time in QueryPerformanceFrequency units.
Definition: cTaskProfiler.h:31
static const TIMEPERF_t k_NOTIME_COUNT
time is not relevant. just a UINT count of something.
Definition: cTaskProfiler.h:30
static const TIMEPERF_t k_NOTIME_BYTERATE
time is not relevant. a UINT count of bytes.
Definition: cTaskProfiler.h:29
Definition: cTaskProfiler.h:38
THREADID_t m_nThreadId
only for a single thread. other threads don't count!
Definition: cTaskProfiler.h:43
cTimePerf m_TimeTaskSwitch
QueryPerformanceCount() of last task switch. (on this thread)
Definition: cTaskProfiler.h:47
TASK_PROFILER_t m_idTaskCur
What task are we currently processing? (on this thread)
Definition: cTaskProfiler.h:46
Definition: cTaskProfiler.h:51
TIMEPERF_t get_TaskDiff() const
Definition: cTaskProfiler.h:140
UINT m_nSampleFrame
total number of sample frames.
Definition: cTaskProfiler.h:58
TIMESECD_t m_iSampleWindowSec
The sample window size (in seconds). 0=off.
Definition: cTaskProfiler.h:62
void IncTaskCount(TASK_PROFILER_t idTask, UINT nSamples, TIMEPERF_t Type=cTaskProfilerRec::k_NOTIME_BYTERATE)
Definition: cTaskProfiler.h:108
double get_TaskDiffSec() const
Definition: cTaskProfiler.h:145
TIMESECF_t GetTaskTimeSec(TASK_PROFILER_t idTask) const
Definition: cTaskProfiler.h:133
void SetTaskCount(TASK_PROFILER_t idTask, UINT nSamples, TIMEPERF_t Type=cTaskProfilerRec::k_NOTIME_COUNT)
Definition: cTaskProfiler.h:116
UNITTEST_FRIEND(cTaskProfiler)
float GetTaskPercent(TASK_PROFILER_t idTask) const
Definition: cTaskProfiler.h:127
bool isProfilingActive() const
Definition: cTaskProfiler.h:86
TIMESECD_t get_SampleWindowLen() const
Definition: cTaskProfiler.h:90
cTimePerf m_TimeWindowSize
same as m_iSampleWindowSec but in cTimePerf units.
Definition: cTaskProfiler.h:63
cArrayTyped< cTaskProfilerRec, cTaskProfilerRec & > m_PrvWindow
Definition: cTaskProfiler.h:67
cArrayTyped< cTaskProfilerRec, cTaskProfilerRec & > m_CurWindow
Definition: cTaskProfiler.h:68
cThreadLockCount m_LockProf
make sure we can't conflict this.
Definition: cTaskProfiler.h:64
TASK_PROFILER_t get_TaskQty() const
Definition: cTaskProfiler.h:96
cTimePerf m_TimeTotal
Total time collected for this sample window. (so far)
Definition: cTaskProfiler.h:69
cTaskProfilerThread m_Cur
Definition: cTaskProfiler.h:72
const TASK_PROFILER_t m_iTaskQty
Definition: cTaskProfiler.h:61
TASK_PROFILER_t get_TaskCurrent() const
Definition: cTaskProfiler.h:100
cTaskProfilerRec & GetTaskCur(TASK_PROFILER_t idTask)
Definition: cTaskProfiler.h:77
TYPE & ElementAt(ITERATE_t nIndex)
Definition: cArray.h:167
Definition: cThreadLock.h:498
Definition: cTimeSys.h:225
TIMEPERF_t get_AgePerf() const noexcept
Definition: cTimeSys.h:276
TIMEPERF_t m_nTime
Arbitrary start time in k_nFreq units. 64 byte unsigned type.
Definition: cTimeSys.h:231
double get_AgeSeconds() const noexcept
Definition: cTimeSys.h:293
int TASK_PROFILER_t
an application specific enum of specific tasks we are tracking.
Definition: cTaskProfiler.h:35
UNITTEST2_PREDEF(cQuadtree)
int TIMESECD_t
signed delta seconds. like TIMESEC_t. redefined in TimeUnits.h.
Definition: cTimeSys.h:19
UINT64 TIMEPERF_t
The system very high precision performance timer. cTimeSpec.
Definition: cTimeSys.h:221
float TIMESECF_t
delta float seconds.
Definition: cTimeSys.h:20