Profiler work

This commit is contained in:
Victor Olin 2023-03-08 15:04:12 +01:00
parent 0d376171c8
commit 7bb64c0489
5 changed files with 9 additions and 21 deletions

View file

@ -44,7 +44,6 @@ namespace GC {
TimeStamp getTimeStamp(); TimeStamp getTimeStamp();
Chunk *getChunk(); Chunk *getChunk();
void printShort(); void print(std::ostream &out);
void printFull();
}; };
} }

View file

@ -10,11 +10,6 @@ using namespace std;
namespace GC { namespace GC {
enum PrintTraceOptions {
Short,
Full
};
class Profiler { class Profiler {
private: private:
Profiler() { } Profiler() { }
@ -33,6 +28,6 @@ namespace GC {
public: public:
static void record(GCEventType type); static void record(GCEventType type);
static void record(GCEventType type, Chunk *chunk); static void record(GCEventType type, Chunk *chunk);
static void printTrace(PrintTraceOptions opt); static void printTrace();
}; };
} }

View file

@ -6,7 +6,7 @@
#include "event.hpp" #include "event.hpp"
#include "heap.hpp" #include "heap.hpp"
using namespace std; // using namespace std;
namespace GC { namespace GC {
@ -22,12 +22,7 @@ namespace GC {
return m_chunk; return m_chunk;
} }
void GCEvent::printShort() { void GCEvent::print(std::ostream &out) {
assert(false && "TODO: unimplemented"); assert(false && "TODO: unimplemented");
} }
void GCEvent::printFull() {
assert(false && "TODO: unimplemented");
ostream s1 = cout;
}
} }

View file

@ -19,16 +19,13 @@ namespace GC {
profiler->m_events.push_back(event); profiler->m_events.push_back(event);
} }
void Profiler::printTrace(PrintTraceOptions opt) { void Profiler::printTrace() {
auto profiler = Profiler::the(); auto profiler = Profiler::the();
auto start = profiler->m_events.begin(); auto start = profiler->m_events.begin();
auto end = profiler->m_events.end(); auto end = profiler->m_events.end();
while (start != end) { while (start != end) {
auto event = *start++; auto event = *start++;
if (opt == Short) event->print(std::cout);
event->printShort();
else
event->printFull();
} }
} }
} }

View file

@ -6,7 +6,9 @@ Goal for next week (24/2):
- Write more complex tests - Write more complex tests
## GC TODO: ## GC TODO:
- Double check m_heap_size functionality and when a collection is triggered - Skriva klart profiler
- Kolla linking med Valter/Victor
- Fixa en a-fil/static lib till Samuel
- Kolla vektor vs list complexity - Kolla vektor vs list complexity
## Tests TODO ## Tests TODO