From 4f9aaaf8b4fc9029157f7676416d7e496af31ec5 Mon Sep 17 00:00:00 2001 From: Victor Olin Date: Tue, 28 Feb 2023 18:42:07 +0100 Subject: [PATCH] Started working on a custom profiler --- src/GC/include/profiler.hpp | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/GC/include/profiler.hpp 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