Actually-useful instantaneous frame rate measurement
This commit is contained in:
parent
eb208f3a10
commit
74cb70bdf3
|
@ -519,15 +519,20 @@
|
||||||
(play-sound-sequence 270318)
|
(play-sound-sequence 270318)
|
||||||
(update-piece! g pos jump-vel)))
|
(update-piece! g pos jump-vel)))
|
||||||
|
|
||||||
(on (message (inbound (inbound (frame-event $counter _ $elapsed-ms _))))
|
(define start-time #f)
|
||||||
(when (zero? (modulo counter 10))
|
(on (message (inbound (inbound (frame-event $counter _ _ _))))
|
||||||
(log-info "Instantaneous frame rate at frame ~a: ~a Hz"
|
(let ((stop-time (current-inexact-milliseconds)))
|
||||||
counter
|
(when (not (eq? start-time #f))
|
||||||
(/ 1000.0 elapsed-ms)))
|
(define elapsed-ms (- stop-time start-time))
|
||||||
(previous-positions (positions))
|
(when (zero? (modulo counter 10))
|
||||||
(previous-velocities (velocities))
|
(log-info "Instantaneous frame rate at frame ~a: ~a Hz"
|
||||||
(for [((id g) (in-hash (configs))) #:when (game-piece-has-attribute? g 'mobile)]
|
counter
|
||||||
(update-game-piece! elapsed-ms id)))))
|
(/ 1000.0 elapsed-ms)))
|
||||||
|
(previous-positions (positions))
|
||||||
|
(previous-velocities (velocities))
|
||||||
|
(for [((id g) (in-hash (configs))) #:when (game-piece-has-attribute? g 'mobile)]
|
||||||
|
(update-game-piece! elapsed-ms id)))
|
||||||
|
(set! start-time stop-time)))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Player
|
;; Player
|
||||||
|
|
Loading…
Reference in New Issue