summaryrefslogtreecommitdiff
path: root/reduced_system_layer.c
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2025-04-16 12:22:44 +0200
committerMitya Selivanov <automainint@guattari.tech>2025-04-16 12:22:44 +0200
commit95933facfbc45f667f051440ceb374f16b051fcc (patch)
tree5ec8be4a73f000cf25035c8374eaa95a7ed6eb3b /reduced_system_layer.c
parent24e30558d8b30d399a69dd99a510fd43ca075cfe (diff)
downloadreduced_system_layer-95933facfbc45f667f051440ceb374f16b051fcc.zip
Add test letter A
Diffstat (limited to 'reduced_system_layer.c')
-rwxr-xr-xreduced_system_layer.c7
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;