Add spall profiler and stop generating layout every frame

This commit is contained in:
Krzosa Karol
2024-07-04 14:30:20 +02:00
parent 143a88ac1d
commit 2f52c018cd
5 changed files with 587 additions and 29 deletions

View File

@@ -204,3 +204,25 @@ FileIter IterateFiles(Allocator alo, String path) {
Advance(&it);
return it;
}
#if _WIN32
#include <Windows.h>
double get_time_in_micros(void) {
static double invfreq;
if (!invfreq) {
LARGE_INTEGER frequency;
QueryPerformanceFrequency(&frequency);
invfreq = 1000000.0 / frequency.QuadPart;
}
LARGE_INTEGER counter;
QueryPerformanceCounter(&counter);
return counter.QuadPart * invfreq;
}
#else
#include <unistd.h>
double get_time_in_micros(void) {
struct timespec spec;
clock_gettime(CLOCK_MONOTONIC, &spec);
return (((double)spec.tv_sec) * 1000000) + (((double)spec.tv_nsec) / 1000);
}
#endif