31 #ifndef HELIB_TIMING_H
32 #define HELIB_TIMING_H
34 #include <helib/NumbTh.h>
35 #include <helib/multicore.h>
54 FHEtimer(
const char* _name,
const char* _loc) :
88 auto_timer(FHEtimer* _timer) :
95 timer->counter += amt;
111 #define HELIB_STRINGIFY(x) #x
112 #define HELIB_TOSTRING(x) HELIB_STRINGIFY(x)
113 #define HELIB_AT __FILE__ ":" HELIB_TOSTRING(__LINE__)
115 #define HELIB_stringify_aux(s) #s
116 #define HELIB_stringify(s) HELIB_stringify_aux(s)
118 #define HELIB_TIMER_START \
119 static helib::FHEtimer _local_timer(__func__, HELIB_AT); \
120 helib::auto_timer _local_auto_timer(&_local_timer)
122 #define HELIB_TIMER_STOP _local_auto_timer.stop()
124 #define HELIB_NTIMER_START(n) \
125 static helib::FHEtimer _named_local_timer##n(#n, HELIB_AT); \
126 helib::auto_timer _named_local_auto_timer##n(&_named_local_timer##n)
128 #define HELIB_NTIMER_STOP(n) _named_local_auto_timer##n.stop();
A simple class to accumulate time.
Definition: timing.h:45
void reset()
Definition: timing.cpp:61
FHEtimer(const char *_name, const char *_loc)
Definition: timing.h:54
const char * loc
Definition: timing.h:48
double getTime() const
Definition: timing.cpp:68
HELIB_atomic_ulong counter
Definition: timing.h:51
HELIB_atomic_long numCalls
Definition: timing.h:52
long getNumCalls() const
Definition: timing.cpp:75
const char * name
Definition: timing.h:47
Definition: apiAttributes.h:21
bool printNamedTimer(std::ostream &str, const char *name)
Definition: timing.cpp:116
void printAllTimers(std::ostream &str=std::cerr)
Print the value of all timers to stream.
Definition: timing.cpp:84
void resetAllTimers()
Definition: timing.cpp:77
void setTimersOff()
Definition: timing.h:67
unsigned long GetTimerClock()
Definition: timing.cpp:41
void registerTimer(FHEtimer *timer)
Definition: timing.cpp:54
void setTimersOn()
Definition: timing.h:66
const FHEtimer * getTimerByName(const char *name)
Definition: timing.cpp:106
bool areTimersOn()
Definition: timing.h:68