41 #define CH_TIMER(name, tpointer) (void)0 42 #define CH_TIME(name) (void)0 43 #define CH_TIMELEAF(name) (void)0 44 #define CH_TIMERS(name) (void)0 45 #define CH_START(tpointer) (void)0 46 #define CH_STOP(tpointer) (void)0 47 #define CH_STOPV(tpointer, val) (void)0 48 #define CH_TIMER_REPORT() (void)0 49 #define CH_TIMER_RESET() (void)0 50 #define CH_TIMER_PRUNE(threshold) (void)0 55 #define CH_TIMER(name, tpointer) \ 56 const char* TimerTag_##tpointer = name ; \ 57 CH_XD::TraceTimer* tpointer = CH_XD::TraceTimer::getTimer(TimerTag_##tpointer) 59 #define CH_TIME(name) \ 60 const char* TimerTagA = name ; \ 61 char CH_TimermutexA = 0; \ 62 CH_XD::TraceTimer* ch_tpointer = CH_XD::TraceTimer::getTimer(TimerTagA); \ 63 CH_XD::AutoStart autostart(ch_tpointer, &CH_TimermutexA) 65 #define CH_TIMELEAF(name) \ 66 const char* TimerTagA = name ; \ 67 CH_XD::TraceTimer* ch_tpointer = CH_XD::TraceTimer::getTimer(TimerTagA); \ 68 CH_XD::AutoStartLeaf autostart(ch_tpointer) 70 #define CH_TIMERS(name) \ 71 const char* TimerTagA = name ; \ 72 char CH_TimermutexA = 0; \ 73 char CH_Timermutex = 0; \ 74 CH_XD::TraceTimer* ch_tpointer = CH_XD::TraceTimer::getTimer(TimerTagA); \ 75 CH_XD::AutoStart autostart(ch_tpointer, &CH_TimermutexA, &CH_Timermutex) 78 #define CH_START(tpointer) tpointer->start(&CH_Timermutex) 80 #define CH_STOP(tpointer) tpointer->stop(&CH_Timermutex) 81 #define CH_STOPV(tpointer, val ) val = tpointer->stop(&CH_Timermutex) 83 #define CH_TIMER_REPORT() CH_XD::TraceTimer::report() 85 #define CH_TIMER_RESET() CH_XD::TraceTimer::reset() 87 #define CH_TIMER_PRUNE(threshold) CH_XD::TraceTimer::PruneTimersParentChildPercent(threshold) 240 void start(
char* mutex);
241 unsigned long long int stop(
char* mutex);
242 static void report(
bool a_closeAfter=
false);
249 unsigned long long int time()
const 251 return m_accumulated_WCtime;
269 static int initializer();
271 const std::vector<TraceTimer*>& children()
const ;
273 static void PruneTimersParentChildPercent(
double percent);
274 static void sampleMemUsage() ;
278 return s_currentTimer[0]->m_name;
302 void reportTree(FILE* out,
const TraceTimer& node,
int depth);
308 void currentize()
const ;
309 int computeRank()
const;
310 static void reportFullTree(FILE* out,
const TraceTimer& timer,
311 unsigned long long int totalTime,
int depth);
312 static void reportOneTree(FILE* out,
const TraceTimer& timer);
313 static void reportMemoryOneTree(FILE* out,
const TraceTimer& timer);
314 static void subReport(FILE* out,
const char* header,
unsigned long long int totalTime);
316 static void PruneTimersParentChildPercent(
double threshold,
TraceTimer* parent);
344 :m_mutex(mutex), m_childMutex(childMutex),m_timer(a_timer)
345 {a_timer->
start(mutex);}
347 :m_mutex(mutex), m_childMutex(&
AutoStart::ok),m_timer(a_timer)
348 {a_timer->
start(mutex);}
363 if (*m_childMutex == 1)
366 m_timer->stop(m_mutex);
377 gettimeofday(&tv, &tz);
378 return((
double)tv.tv_sec + 0.000001 * (
double)tv.tv_usec);
386 if (m_pruned)
return;
388 m_last_WCtime_stamp = ch_ticks();
393 if (m_pruned)
return;
394 m_accumulated_WCtime += ch_ticks() - m_last_WCtime_stamp;
395 m_last_WCtime_stamp=0;
static char ok
Definition: CH_Timer.H:355
std::vector< TraceTimer * > m_children
Definition: CH_Timer.H:291
char * m_childMutex
Definition: CH_Timer.H:353
long long int m_peak
Definition: CH_Timer.H:300
bool m_pruned
Definition: CH_Timer.H:289
static bool s_traceMemory
Definition: CH_Timer.H:285
AutoStart(TraceTimer *a_timer, char *mutex, char *childMutex)
Definition: CH_Timer.H:343
double TimerGetTimeStampWC()
Definition: CH_Timer.H:369
char * m_mutex
Definition: CH_Timer.H:352
Definition: CH_Timer.H:340
~AutoStart()
Definition: CH_Timer.H:360
int m_thread_id
Definition: CH_Timer.H:297
void leafStart()
Definition: CH_Timer.H:384
Definition: CH_Timer.H:321
int rank() const
Definition: CH_Timer.H:254
TraceTimer * m_timer
Definition: CH_Timer.H:337
const char * name(const FArrayBox &a_dummySpecializationArg)
Definition: CH_HDF5.H:741
unsigned long long int m_accumulated_WCtime
Definition: CH_Timer.H:294
int m_rank
Definition: CH_Timer.H:296
bool isPruned() const
Definition: CH_Timer.H:264
static const char * currentTimer()
Definition: CH_Timer.H:276
static TraceTimer * s_peakTimer
Definition: CH_Timer.H:287
long long int count() const
Definition: CH_Timer.H:258
static std::vector< TraceTimer * > s_roots
Definition: CH_Timer.H:283
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
long long int m_memory
Definition: CH_Timer.H:298
long long int m_last_Memory_Stamp
Definition: CH_Timer.H:299
AutoStart(TraceTimer *a_timer, char *mutex)
Definition: CH_Timer.H:346
TraceTimer * m_timer
Definition: CH_Timer.H:354
void leafStop()
Definition: CH_Timer.H:391
TraceTimer * m_parent
Definition: CH_Timer.H:290
Definition: CH_Timer.H:236
unsigned long long int time() const
Definition: CH_Timer.H:249
~AutoStartLeaf()
Definition: CH_Timer.H:329
AutoStartLeaf(TraceTimer *a_timer)
Definition: CH_Timer.H:324
static std::vector< TraceTimer * > s_currentTimer
Definition: CH_Timer.H:284
static long long int s_peak
Definition: CH_Timer.H:286
const char * m_name
Definition: CH_Timer.H:292
unsigned long long int m_last_WCtime_stamp
Definition: CH_Timer.H:295
long long int m_count
Definition: CH_Timer.H:293