X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fdebug%2Fprofiler.h;h=ad0653c0697f566b31f356974733293277d6e63b;hp=3ebefa05b63877b979b4ace905e149d4b95ba1e1;hb=4798e6e5eac917b6225a1295fa5b118d88345237;hpb=967785734be5c3fc6f75da122c2d93ebbb338271 diff --git a/source/debug/profiler.h b/source/debug/profiler.h index 3ebefa0..ad0653c 100644 --- a/source/debug/profiler.h +++ b/source/debug/profiler.h @@ -4,7 +4,8 @@ #include #include #include -#include "../time/timedelta.h" +#include +#include namespace Msp { namespace Debug { @@ -25,14 +26,23 @@ Profiler for each thread. class Profiler { public: + struct CallInfo + { + Msp::Time::TimeStamp entry_time; + Msp::Time::TimeDelta duration; + }; + struct ScopeInfo { + Time::TimeStamp first_call; unsigned calls; Time::TimeDelta total_time; Time::TimeDelta self_time; Time::TimeDelta avg_time; - std::vector history; + float calls_per_sec; + std::vector history; unsigned hist_pos; + bool hist_full; std::map called_from; ScopeInfo(); @@ -65,21 +75,14 @@ public: */ ProfilingScope *enter(ProfilingScope *ps); - /** - Records a call to a scope. You'll probably want to use a ProfilingScope - instead of calling this manually. - - @param sn Scope name - @param pn Parent scope name - @param t Time spent in the scope - @param ct Time spent in child scopes - */ - void record(const std::string &sn, const std::string &pn, const Time::TimeDelta &t, const Time::TimeDelta &ct); + /** Records the data from a ProfilingScope. It is not useful to call this + manually. */ + void record(const ProfilingScope &); /** Returns informations about a scope. */ - const ScopeInfo &scope(const std::string &) const; + const ScopeInfo &get_scope(const std::string &) const; }; } // namespace Debug