diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-01-08 10:53:42 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-01-15 00:35:55 +0000 |
commit | 6cf56682bc156f66cdbb290c9494c52501e2f5df (patch) | |
tree | 263acea55ac9ac76bb116af9c61423eb3ab2aa69 /src/common/perf_timer.h | |
parent | perf_timer: use std::unique_ptr instead of new/delete (diff) | |
download | monero-6cf56682bc156f66cdbb290c9494c52501e2f5df.tar.xz |
perf_timer: add faster x86_64 timers, and pause/resume
Diffstat (limited to 'src/common/perf_timer.h')
-rw-r--r-- | src/common/perf_timer.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/perf_timer.h b/src/common/perf_timer.h index 2b318bff2..536cfddd0 100644 --- a/src/common/perf_timer.h +++ b/src/common/perf_timer.h @@ -48,6 +48,8 @@ class PerformanceTimer public: PerformanceTimer(const std::string &s, uint64_t unit, el::Level l = el::Level::Debug); ~PerformanceTimer(); + void pause(); + void resume(); private: std::string name; @@ -55,6 +57,7 @@ private: el::Level level; uint64_t ticks; bool started; + bool paused; }; void set_performance_timer_log_level(el::Level level); @@ -66,5 +69,7 @@ void set_performance_timer_log_level(el::Level level); #define PERF_TIMER_START_UNIT(name, unit) std::unique_ptr<tools::PerformanceTimer> pt_##name(new tools::PerformanceTimer(#name, unit, el::Level::Info)) #define PERF_TIMER_START(name) PERF_TIMER_START_UNIT(name, 1000) #define PERF_TIMER_STOP(name) do { pt_##name.reset(NULL); } while(0) +#define PERF_TIMER_PAUSE(name) pt_##name->pause() +#define PERF_TIMER_RESUME(name) pt_##name->resume() } |