]> git.tdb.fi Git - libs/core.git/blobdiff - source/debug/profilingscope.cpp
Add move semantics to Variant
[libs/core.git] / source / debug / profilingscope.cpp
index 39222342123848e1ba7d768592bff0fbd981b2d1..723529c9a4b7ccaa259fc14d6ce4696bac3cc472 100644 (file)
@@ -1,11 +1,4 @@
-/* $Id$
-
-This file is part of libmspcore
-Copyright © 2007  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
-#include "../time/utils.h"
+#include <msp/time/utils.h>
 #include "profilingscope.h"
 
 using namespace std;
@@ -17,19 +10,15 @@ ProfilingScope::ProfilingScope(Profiler &p, const string &n):
        profiler(p),
        name(n),
        parent(profiler.enter(this)),
-       start_t(Time::now())
+       entry_time(Time::now())
 { }
 
 ProfilingScope::~ProfilingScope()
 {
-       const Time::TimeDelta dt = Time::now()-start_t;
+       time_spent = Time::now()-entry_time;
        if(parent)
-       {
-               parent->child_t += dt;
-               profiler.record(name, parent->name, dt, child_t);
-       }
-       else
-               profiler.record(name, string(), dt, child_t);
+               parent->child_time += get_time_spent();
+       profiler.record(*this);
        profiler.enter(parent);
 }