Started working on a custom profiler
This commit is contained in:
parent
5e52de10bd
commit
4f9aaaf8b4
1 changed files with 38 additions and 0 deletions
38
src/GC/include/profiler.hpp
Normal file
38
src/GC/include/profiler.hpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "chunk.hpp"
|
||||
#include "event.hpp"
|
||||
#include "heap.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace GC {
|
||||
|
||||
enum PrintTraceOptions {
|
||||
Short,
|
||||
Full
|
||||
};
|
||||
|
||||
class Profiler {
|
||||
private:
|
||||
Profiler() { }
|
||||
~Profiler() { }
|
||||
|
||||
inline static Profiler *the() {
|
||||
if (m_instance)
|
||||
return m_instance;
|
||||
m_instance = new Profiler();
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
inline static Profiler *m_instance;
|
||||
vector<GCEvent *> m_events;
|
||||
|
||||
public:
|
||||
static void record(GCEventType type);
|
||||
static void record(GCEventType type, Chunk *chunk);
|
||||
static void printTrace(PrintTraceOptions opt);
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue