aboutsummaryrefslogtreecommitdiff
path: root/src/common/perf_timer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/perf_timer.h')
-rw-r--r--src/common/perf_timer.h36
1 files changed, 2 insertions, 34 deletions
diff --git a/src/common/perf_timer.h b/src/common/perf_timer.h
index 4d7d99afb..a1d71609c 100644
--- a/src/common/perf_timer.h
+++ b/src/common/perf_timer.h
@@ -41,44 +41,12 @@ namespace tools
class PerformanceTimer;
extern el::Level performance_timer_log_level;
-extern __thread std::vector<PerformanceTimer*> *performance_timers;
class PerformanceTimer
{
public:
- PerformanceTimer(const std::string &s, uint64_t unit, el::Level l = el::Level::Debug): name(s), unit(unit), level(l), started(false)
- {
- ticks = epee::misc_utils::get_ns_count();
- if (!performance_timers)
- {
- MLOG(level, "PERF ----------");
- performance_timers = new std::vector<PerformanceTimer*>();
- }
- else
- {
- PerformanceTimer *pt = performance_timers->back();
- if (!pt->started)
- {
- MLOG(pt->level, "PERF " << std::string((performance_timers->size()-1) * 2, ' ') << " " << pt->name);
- pt->started = true;
- }
- }
- performance_timers->push_back(this);
- }
-
- ~PerformanceTimer()
- {
- performance_timers->pop_back();
- ticks = epee::misc_utils::get_ns_count() - ticks;
- char s[12];
- snprintf(s, sizeof(s), "%8llu ", (unsigned long long)ticks / (1000000000 / unit));
- MLOG(level, "PERF " << s << std::string(performance_timers->size() * 2, ' ') << " " << name);
- if (performance_timers->empty())
- {
- delete performance_timers;
- performance_timers = NULL;
- }
- }
+ PerformanceTimer(const std::string &s, uint64_t unit, el::Level l = el::Level::Debug);
+ ~PerformanceTimer();
private:
std::string name;