blob: 6e4ceb532e310d78fd5c4e04a97d67070e4594d2 (
plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/**
** \file misc/timer.hxx
** \brief Inline methods for misc/timer.hh.
*/
#pragma once
#include <misc/contract.hh>
#include <misc/timer.hh>
namespace misc
{
inline void timer::push(int i)
{
precondition(this->intmap.find(i) != this->intmap.end());
this->push(this->intmap[i]);
}
inline void timer::pop([[maybe_unused]] const std::string& task_name)
{
precondition(this->tasksmap[task_name] == this->tasks.top());
this->pop();
}
inline void timer::pop(int i) { this->pop(this->intmap[i]); }
inline void timer::dump_on_destruction(std::ostream& out)
{
this->dump_stream = &out;
}
inline void timer::start() { this->total.start(); }
inline void timer::stop() { this->total.stop(); }
inline timer::time::time()
: user(0)
, sys(0)
, wall(0)
{}
inline timer::time& timer::time::operator+=(const time& rhs)
{
this->wall += rhs.wall;
this->user += rhs.user;
this->sys += rhs.sys;
return *this;
}
} // namespace misc
|