feat: make profiler compile time define
This commit is contained in:
parent
5a89fbcd7d
commit
a285c42c5f
|
@ -6,6 +6,8 @@
|
||||||
#include "profiler.h"
|
#include "profiler.h"
|
||||||
#include "../containers/aligned_vector.h"
|
#include "../containers/aligned_vector.h"
|
||||||
|
|
||||||
|
#if PROFILING_COMPILED
|
||||||
|
|
||||||
#define MAX_PATH 256
|
#define MAX_PATH 256
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -141,3 +143,4 @@ void profiler_print_stats() {
|
||||||
fprintf(stderr, "%-60s%-20f%-20f%" PRIu64 "\n", result->name, (double)avg, (double)ms, result->total_calls);
|
fprintf(stderr, "%-60s%-20f%-20f%" PRIu64 "\n", result->name, (double)avg, (double)ms, result->total_calls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -7,12 +7,26 @@ typedef struct {
|
||||||
uint64_t start_time_in_us;
|
uint64_t start_time_in_us;
|
||||||
} Profiler;
|
} Profiler;
|
||||||
|
|
||||||
|
#define PROFILING_COMPILED 0
|
||||||
|
|
||||||
|
#if PROFILING_COMPILED
|
||||||
Profiler* profiler_push(const char* name);
|
Profiler* profiler_push(const char* name);
|
||||||
void profiler_checkpoint(const char* name);
|
void _profiler_checkpoint(const char* name);
|
||||||
void profiler_pop();
|
void _profiler_pop();
|
||||||
|
|
||||||
void profiler_print_stats();
|
void _profiler_print_stats();
|
||||||
|
|
||||||
void profiler_enable();
|
void _profiler_enable();
|
||||||
void profiler_disable();
|
void _profiler_disable();
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define profiler_push(name);
|
||||||
|
#define profiler_checkpoint(name);
|
||||||
|
#define profiler_pop();
|
||||||
|
|
||||||
|
#define profiler_print_stats();
|
||||||
|
|
||||||
|
#define profiler_enable();
|
||||||
|
#define profiler_disable();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue
Block a user