X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fdebug%2Fprofilingscope.h;h=586efa31d53fbf062a175ae7a44fb1e31897ac3f;hp=132c4183bf883e2353e665c38ced3e00e5449e7d;hb=41363aed34382386f915f17c1a961750b4fdcb14;hpb=e7638f74d3e4869020a19dfa1cc700d52373f01c diff --git a/source/debug/profilingscope.h b/source/debug/profilingscope.h index 132c418..586efa3 100644 --- a/source/debug/profilingscope.h +++ b/source/debug/profilingscope.h @@ -1,14 +1,8 @@ -/* $Id$ - -This file is part of libmspcore -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #ifndef MSP_DEBUG_PROFILINGSCOPE_H_ #define MSP_DEBUG_PROFILINGSCOPE_H_ -#include "../time/timestamp.h" +#include +#include #include "profiler.h" namespace Msp { @@ -19,20 +13,25 @@ RAII timing class to accompany Profiler. Timing starts when an object is created and ends when it goes out of scope. If there was another object in an outer scope, it is notified of the time used in inner scopes. */ -class ProfilingScope +class ProfilingScope: private NonCopyable { private: Profiler &profiler; std::string name; - ProfilingScope *parent; - Time::TimeStamp start_t; - Time::TimeDelta child_t; + ProfilingScope *parent = nullptr; + Time::TimeStamp entry_time; + Time::TimeDelta time_spent; + Time::TimeDelta child_time; - ProfilingScope(const ProfilingScope &); - ProfilingScope &operator=(const ProfilingScope &); public: ProfilingScope(Profiler &p, const std::string &n); ~ProfilingScope(); + + const std::string &get_name() const { return name; } + const ProfilingScope *get_parent() const { return parent; } + const Time::TimeStamp &get_entry_time() const { return entry_time; } + const Time::TimeDelta &get_time_spent() const { return time_spent; } + const Time::TimeDelta &get_child_time() const { return child_time; } }; } // namespace Debug