-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathbasic_timer.cpp
More file actions
35 lines (30 loc) · 836 Bytes
/
basic_timer.cpp
File metadata and controls
35 lines (30 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "memilio/timer/basic_timer.h"
#include "memilio/utils/logging.h"
namespace mio
{
namespace timing
{
void BasicTimer::set_running(bool new_state)
{
#ifndef NDEBUG
m_is_running = new_state;
#else
mio::unused(new_state);
#endif
}
void BasicTimer::should_be_running(bool expected, const std::string_view function) const
{
#ifndef NDEBUG
if (m_is_running != expected) {
mio::log_error("A BasicTimer was {}running while expected to be {}. "
"The offending call was {}. "
"Consider using an AutoTimer with name (and scope) to avoid this.",
m_is_running ? "" : "not ", expected ? "started" : "stopped", function);
}
// else: everything ok.
#else
mio::unused(expected, function);
#endif
}
} // namespace timing
} // namespace mio