1 #ifndef GALOIS_RUNTIME_THREADTIMER_H
2 #define GALOIS_RUNTIME_THREADTIMER_H
6 #include "galois/config.h"
9 namespace galois::runtime {
19 void start() { clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start_); }
22 clock_gettime(CLOCK_THREAD_CPUTIME_ID, &stop_);
23 nsec_ += (stop_.tv_nsec - start_.tv_nsec);
24 nsec_ += ((stop_.tv_sec - start_.tv_sec) * 1000000000);
29 uint64_t
get_sec()
const {
return (nsec_ / 1000000000); }
31 uint64_t
get_msec()
const {
return (nsec_ / 1000000); }
38 void reportTimes(
const char* category,
const char* region);
41 template <
bool enabled>
43 const char*
const region_;
44 const char*
const category_;
46 void reportTimes() { reportTimes(category_, region_); }
50 : region_(region), category_(category) {}
substrate::PerThreadStorage< ThreadTimer > timers_
Definition: ThreadTimer.h:36
uint64_t get_msec() const
Definition: ThreadTimer.h:31
Definition: ThreadTimer.h:11
void stop()
Definition: ThreadTimer.h:61
void reportTimes(const char *category, const char *region)
Definition: ThreadTimer.cpp:8
Definition: ThreadTimer.h:42
void start()
Definition: ThreadTimer.h:19
void stop() const
Definition: ThreadTimer.h:79
uint64_t get_sec() const
Definition: ThreadTimer.h:29
void start()
Definition: ThreadTimer.h:59
uint64_t get_nsec() const
Definition: ThreadTimer.h:27
PerThreadTimer(const char *const region, const char *const category)
Definition: ThreadTimer.h:49
PerThreadTimer(const char *const, const char *const)
Definition: ThreadTimer.h:68
Definition: PerThreadStorage.h:88
void start() const
Definition: ThreadTimer.h:77
~PerThreadTimer()
Definition: ThreadTimer.h:57
Definition: ThreadTimer.h:34
void stop()
Definition: ThreadTimer.h:21
PerThreadTimer & operator=(const PerThreadTimer &)=delete