DiSMEC++
timer.cpp
Go to the documentation of this file.
1 // Copyright (c) 2021, Aalto University, developed by Erik Schultheis
2 // All rights reserved.
3 //
4 // SPDX-License-Identifier: MIT
5 
6 #include "timer.h"
7 #include "collection.h"
8 
10 
11 void ScopeTimer::record_duration() {
12  auto dt = clock_t::now() - m_Start;
13  m_Accu->record(m_Target, std::chrono::duration_cast<std::chrono::microseconds>(dt).count());
14 }
15 
17  return accu->is_enabled(stat);
18 }
StatisticsCollection * m_Accu
Definition: timer.h:20
static bool is_enabled(const StatisticsCollection *accu, stat_id_t stat)
Definition: timer.cpp:16
clock_t::time_point m_Start
Definition: timer.h:19
stat_id_t m_Target
Definition: timer.h:17
This class manages a collection of named Statistics objects.
Definition: collection.h:47
bool is_enabled(stat_id_t stat) const
Quickly checks whether collection of data is enabled for the given statistics.
Definition: collection.h:131
void record(stat_id_t stat, T &&value)
Records an already computed value.
Definition: collection.h:174