diff --git a/src/GC/include/profiler.hpp b/src/GC/include/profiler.hpp new file mode 100644 index 0000000..5a3f3b4 --- /dev/null +++ b/src/GC/include/profiler.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include + +#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 m_events; + + public: + static void record(GCEventType type); + static void record(GCEventType type, Chunk *chunk); + static void printTrace(PrintTraceOptions opt); + }; +} \ No newline at end of file