44 #define CH_TIMERS_ON() false 45 #define CH_TIMER(name, tpointer) (void)0 46 #define CH_TIME(name) (void)0 47 #define CH_TIMELEAF(name) (void)0 48 #define CH_TIMERS(name) (void)0 49 #define CH_START(tpointer) (void)0 50 #define CH_STOP(tpointer) (void)0 52 #define CH_TIMER_REPORT() (void)0 53 #define CH_TIMER_REPORTNAME(stream, name) (void)0 54 #define CH_TIMER_RESET() (void)0 55 #define CH_TIMER_PRUNE(threshold) (void)0 59 extern std::fstream
LBFILE;
61 #define CH_TIMERS_ON() TraceTimer::timersOn() 63 #define CH_TIMER(name, tpointer) \ 64 const char* TimerTag_##tpointer = name ; \ 65 CH_XD::TraceTimer* tpointer = NULL ;\ 68 tpointer = CH_XD::TraceTimer::getTimer(TimerTag_##tpointer) ; \ 71 #define CH_TIME(name) \ 72 const char* TimerTagA = name ; \ 73 char CH_TimermutexA = 0; \ 74 CH_XD::TraceTimer* ch_tpointer = NULL; \ 75 int tid=omp_get_thread_num(); \ 78 ch_tpointer = CH_XD::TraceTimer::getTimer(TimerTagA); \ 80 CH_XD::AutoStart autostart(ch_tpointer, &CH_TimermutexA) 82 #define CH_TIME(name) \ 83 const char* TimerTagA = name ; \ 84 char CH_TimermutexA = 0; \ 85 CH_XD::TraceTimer* ch_tpointer = NULL; \ 86 ch_tpointer = CH_XD::TraceTimer::getTimer(TimerTagA); \ 87 CH_XD::AutoStart autostart(ch_tpointer, &CH_TimermutexA) 91 #define CH_TIMELEAF(name) \ 92 const char* TimerTagA = name ; \ 93 CH_XD::TraceTimer* ch_tpointer = NULL; \ 94 int tid = omp_get_thread_num(); if(tid==0) \ 96 ch_tpointer = CH_XD::TraceTimer::getTimer(TimerTagA); \ 98 CH_XD::AutoStartLeaf autostart(ch_tpointer) 100 #define CH_TIMELEAF(name) \ 101 const char* TimerTagA = name ; \ 102 CH_XD::TraceTimer* ch_tpointer = NULL; \ 103 ch_tpointer = CH_XD::TraceTimer::getTimer(TimerTagA); \ 104 CH_XD::AutoStartLeaf autostart(ch_tpointer) 108 #define CH_TIMERS(name) \ 109 const char* TimerTagA = name ; \ 110 char CH_TimermutexA = 0; \ 111 char CH_Timermutex = 0; \ 112 CH_XD::TraceTimer* ch_tpointer = NULL; \ 113 int TIMERS_tid = omp_get_thread_num(); if(TIMERS_tid==0) \ 115 ch_tpointer = CH_XD::TraceTimer::getTimer(TimerTagA); \ 117 CH_XD::AutoStart autostart(ch_tpointer, &CH_TimermutexA, &CH_Timermutex) 120 #define CH_START(tpointer) \ 123 tpointer->start(&CH_Timermutex); \ 126 #define CH_STOP(tpointer) \ 129 tpointer->stop(&CH_Timermutex); \ 133 #define CH_TIMERS(name) \ 134 const char* TimerTagA = name ; \ 135 char CH_TimermutexA = 0; \ 136 char CH_Timermutex = 0; \ 137 CH_XD::TraceTimer* ch_tpointer = NULL; \ 140 ch_tpointer = CH_XD::TraceTimer::getTimer(TimerTagA); \ 142 CH_XD::AutoStart autostart(ch_tpointer, &CH_TimermutexA, &CH_Timermutex) 145 #define CH_START(tpointer) \ 147 tpointer->start(&CH_Timermutex); \ 150 #define CH_STOP(tpointer) \ 152 tpointer->stop(&CH_Timermutex); \ 158 #define CH_TIMER_REPORT() CH_XD::TraceTimer::report() 160 #define CH_TIMER_REPORTNAME(stream, name) CH_XD::TraceTimer::reportName(stream, name); 161 #define CH_TIMER_RESET() CH_XD::TraceTimer::reset() 163 #define CH_TIMER_PRUNE(threshold) CH_XD::TraceTimer::PruneTimersParentChildPercent(threshold) 310 void start(
char* mutex);
311 unsigned long long int stop(
char* mutex);
312 static void report(
bool a_closeAfter=
false);
313 static void reportName(std::ostream& out,
const char*
name);
319 unsigned long long int time()
const 321 return m_accumulated_WCtime;
339 static int initializer();
340 static TraceTimer* getTimer(
const char* name);
341 const std::vector<TraceTimer*>& children()
const ;
343 static void PruneTimersParentChildPercent(
double percent);
344 static void sampleMemUsage(
const char* a_name) ;
345 static void sampleMemUsage2() ;
346 static void reportPeak(FILE* out);
350 return s_currentTimer[0]->m_name;
353 static bool timersOn();
378 static bool find(std::list<const TraceTimer*>& a_trace,
const TraceTimer* a_target);
379 void reportTree(FILE* out,
const TraceTimer& node,
int depth);
385 void currentize()
const ;
386 int computeRank()
const;
387 static void reportFullTree(FILE* out,
const TraceTimer& timer,
388 unsigned long long int totalTime,
int depth,
TraceTimer** stack_bottom);
389 static void reportOneTree(FILE* out,
const TraceTimer& timer);
390 static void updateMemory(
TraceTimer& a_timer);
393 static void subReport(FILE* out,
const char* header,
unsigned long long int totalTime);
395 static void PruneTimersParentChildPercent(
double threshold,
TraceTimer* parent);
409 if(m_timer)m_timer->leafStop();
422 :m_mutex(mutex), m_childMutex(childMutex),m_timer(a_timer)
423 {
if(a_timer)a_timer->
start(mutex);}
425 :m_mutex(mutex), m_childMutex(&
AutoStart::ok),m_timer(a_timer)
426 {
if(a_timer)a_timer->
start(mutex);}
428 {
if(m_timer)m_timer->stop(m_mutex); }
444 if (m_pruned)
return;
452 if (m_pruned)
return;
453 m_accumulated_WCtime +=
ch_ticks() - m_last_WCtime_stamp;
455 m_last_WCtime_stamp=0;
static char ok
Definition: CH_Timer.H:435
std::vector< TraceTimer * > m_children
Definition: CH_Timer.H:365
char * m_childMutex
Definition: CH_Timer.H:433
unsigned int m_memoryMin
Definition: CH_Timer.H:373
bool m_pruned
Definition: CH_Timer.H:363
Definition: IntVect.H:719
unsigned long long int ch_ticks()
Definition: ClockTicks.H:64
AutoStart(TraceTimer *a_timer, char *mutex, char *childMutex)
Definition: CH_Timer.H:421
char * m_mutex
Definition: CH_Timer.H:432
Definition: CH_Timer.H:418
~AutoStart()
Definition: CH_Timer.H:427
int m_thread_id
Definition: CH_Timer.H:371
void leafStart()
Definition: CH_Timer.H:442
Definition: CH_Timer.H:399
int rank() const
Definition: CH_Timer.H:324
unsigned long long int m_flops
Definition: CH_Timer.H:374
TraceTimer * m_timer
Definition: CH_Timer.H:415
static bool s_tracing
Definition: CH_Timer.H:376
const char * name(const FArrayBox &a_dummySpecializationArg)
Definition: CH_HDF5.H:907
unsigned long long int m_accumulated_WCtime
Definition: CH_Timer.H:368
int m_rank
Definition: CH_Timer.H:370
bool isPruned() const
Definition: CH_Timer.H:334
static const char * currentTimer()
Definition: CH_Timer.H:348
static TraceTimer * s_peakTimer
Definition: CH_Timer.H:361
long long int count() const
Definition: CH_Timer.H:328
static std::vector< TraceTimer * > s_roots
Definition: CH_Timer.H:357
AutoStart(TraceTimer *a_timer, char *mutex)
Definition: CH_Timer.H:424
TraceTimer * m_timer
Definition: CH_Timer.H:434
void leafStop()
Definition: CH_Timer.H:450
TraceTimer * m_parent
Definition: CH_Timer.H:364
Definition: CH_Timer.H:306
unsigned long long int time() const
Definition: CH_Timer.H:319
~AutoStartLeaf()
Definition: CH_Timer.H:407
long long int ch_flops
Definition: CH_Counters.H:30
AutoStartLeaf(TraceTimer *a_timer)
Definition: CH_Timer.H:402
static std::vector< TraceTimer * > s_currentTimer
Definition: CH_Timer.H:358
static bool s_memorySampling
Definition: CH_Timer.H:372
static long long int s_peak
Definition: CH_Timer.H:360
const char * m_name
Definition: CH_Timer.H:366
unsigned long long int m_last_WCtime_stamp
Definition: CH_Timer.H:369
long long int m_count
Definition: CH_Timer.H:367