diff --git a/ecs.odin b/ecs.odin index 227c24f..a00b015 100644 --- a/ecs.odin +++ b/ecs.odin @@ -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