]> git.tdb.fi Git - libs/core.git/blob - source/debug/profilingscope.cpp
Add move semantics to Variant
[libs/core.git] / source / debug / profilingscope.cpp
1 #include <msp/time/utils.h>
2 #include "profilingscope.h"
3
4 using namespace std;
5
6 namespace Msp {
7 namespace Debug {
8
9 ProfilingScope::ProfilingScope(Profiler &p, const string &n):
10         profiler(p),
11         name(n),
12         parent(profiler.enter(this)),
13         entry_time(Time::now())
14 { }
15
16 ProfilingScope::~ProfilingScope()
17 {
18         time_spent = Time::now()-entry_time;
19         if(parent)
20                 parent->child_time += get_time_spent();
21         profiler.record(*this);
22         profiler.enter(parent);
23 }
24
25 } // namespace Debug
26 } // namespace Msp