1 ! Copyright (C) 2009 Joe Groff.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors alien.c-types classes.struct game.loop
4 game.loop.private kernel sequences specialized-vectors
6 IN: game.loop.benchmark
8 STRUCT: game-loop-benchmark
9 { benchmark-data-pair benchmark-data-pair }
11 { frame# ulonglong } ;
13 SPECIALIZED-VECTOR: game-loop-benchmark
15 : <game-loop-benchmark> ( benchmark-data-pair tick frame -- obj )
16 \ game-loop-benchmark <struct>
19 swap >>benchmark-data-pair ; inline
21 : ensure-benchmark-data ( loop -- vector )
22 dup benchmark-data>> [
23 game-loop-benchmark-vector{ } clone
26 benchmark-data>> ; inline
28 M: game-loop record-benchmarking ( loop quot: ( loop -- benchmark-data-pair ) -- )
30 [ [ call( loop -- ) ] with-benchmarking ]
36 [ drop ensure-benchmark-data ]