Profiler: Sort output by total time

This commit is contained in:
degasus
2015-08-20 11:41:49 +02:00
parent cb264df64c
commit 17932935d9
3 changed files with 27 additions and 2 deletions

View File

@ -5,10 +5,14 @@
#pragma once
#include <list>
#include <mutex>
#include <string>
#include "CommonTypes.h"
namespace Common
{
class Profiler
{
public:
@ -21,8 +25,11 @@ public:
void Stop();
std::string Read();
bool operator<(const Profiler& b) const;
private:
static std::list<Profiler*> s_all_profilers;
static std::mutex s_mutex;
static u32 s_max_length;
static u64 s_frame_time;
static u64 s_usecs_frame;
@ -55,5 +62,7 @@ private:
Profiler* m_p;
};
};
// Warning: This profiler isn't thread safe. Only profile functions which doesn't run simultaneously
#define PROFILE(name) static Profiler prof_gen(name); ProfilerExecuter prof_e(&prof_gen);
#define PROFILE(name) static Common::Profiler prof_gen(name); Common::ProfilerExecuter prof_e(&prof_gen);