Stopwatch for seeing different system's tick-duration.
This commit is contained in:
14
ecs.odin
14
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,11 +298,24 @@ create_system :: proc(
|
||||
}
|
||||
|
||||
tick :: proc(world: ^World) {
|
||||
sw: time.Stopwatch
|
||||
|
||||
for &s in &world.systems {
|
||||
assert(&s != nil)
|
||||
assert(s.tick != nil)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user