Started working on a custom profiler

This commit is contained in:
Victor Olin 2023-02-28 18:42:07 +01:00
parent 5e52de10bd
commit 4f9aaaf8b4

View 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);
};
}