Stopwatch for seeing different system's tick-duration.

This commit is contained in:
2025-11-22 00:09:27 +01:00
parent 2ef1ffff43
commit 76cb5e18f6

View File

@@ -3,6 +3,7 @@ package ecs
import "core:container/queue"
import "core:fmt"
import "core:log"
import "core:time"
Entity :: struct {
id: Entity_ID,
@@ -297,10 +298,23 @@ create_system :: proc(
}
tick :: proc(world: ^World) {
sw: time.Stopwatch
for &s in &world.systems {
assert(&s != nil)
assert(s.tick != nil)
s.tick(world, s.state)
time.stopwatch_reset(&sw)
time.stopwatch_start(&sw)
{
s.tick(world, s.state)
}
time.stopwatch_stop(&sw)
// TODO: SS - Reintroduce this at some point. Really nice for debugging! :)
// system_tick_time := time.stopwatch_duration(sw)
// fmt.printfln("System '%v' took %v ms.", s.name, time.duration_milliseconds(system_tick_time))
}
world.tick += 1