diff options
Diffstat (limited to 'reduced_system_layer.c')
-rwxr-xr-x | reduced_system_layer.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/reduced_system_layer.c b/reduced_system_layer.c index cd0a4a3..f34c03d 100755 --- a/reduced_system_layer.c +++ b/reduced_system_layer.c @@ -1498,6 +1498,7 @@ typedef struct { i64 begin_nsec; } Profiler_Slot_; +b8 _profiler_ready = 0; i64 _profiler_num_slots = 0; Profiler_Slot_ *_profiler_slots = NULL; @@ -1512,10 +1513,12 @@ void PROFILER_init(u32 slot, c8 *name) { mem_set_(_profiler_slots + slot, 0, sizeof *_profiler_slots); _profiler_slots[slot].name = name; + + _profiler_ready = 1; } void PROFILER_begin(u32 slot) { - if ((i64) (u64) slot >= _profiler_num_slots && slot == PROFILE_MEMORY) + if (!_profiler_ready) return; if ((i64) (u64) slot >= _profiler_num_slots) { @@ -1558,6 +1561,8 @@ static void normalize_time_(i64 *sec, i64 *nsec) { } void PROFILER_end(u32 slot) { + if (!_profiler_ready) + return; if ((i64) (u64) slot >= _profiler_num_slots) return; |