I was running a very heavy test - my JavaFX Balls benchmark - in a configuration thatshould deliver a performance of only ~2fps. But the program was reporting more than double, with a custom FPS counter that relies on invocations of the main animation Timeline (that uses time:0). I investingated this by logging the nanoTime(0 for each call to the Timeline's action, and I got this:
244768994737808 (delta: 467ms)
244769462624160 (delta: 13ms)
244769475647323 (delta: 13ms)
244769941612132 (delta: 465ms)
244769954661486 (delta: 13ms)
...
So it seems that frames are produced each ~465ms, but the timeline is sometimes fired more than once between consecutive frames. This breaks my FPS score because I increment the frame counter in these events. The keyframe has canSkip:true, so any skipped animation frame should also skip the keyframe's action. The docs of canSkip say: "Timeline cycles are skipped between time pulses. If true, only one call to the action() function will occur for each time pulse, regardless of how many cycles have occured since the last time pulse was processed." Although it mentions "each time pulse" and not "each rendered frame", I see no reason for the observed behavior.
To reproduce: run the attached project, click G to start animation, right arrow several times to select 512 Balls, then E to activate Effects and/or I for toggling to Vector rendering. This will make the animation extremely slow, and it's easy to notice that reported FPS is too high.
244768994737808 (delta: 467ms)
244769462624160 (delta: 13ms)
244769475647323 (delta: 13ms)
244769941612132 (delta: 465ms)
244769954661486 (delta: 13ms)
...
So it seems that frames are produced each ~465ms, but the timeline is sometimes fired more than once between consecutive frames. This breaks my FPS score because I increment the frame counter in these events. The keyframe has canSkip:true, so any skipped animation frame should also skip the keyframe's action. The docs of canSkip say: "Timeline cycles are skipped between time pulses. If true, only one call to the action() function will occur for each time pulse, regardless of how many cycles have occured since the last time pulse was processed." Although it mentions "each time pulse" and not "each rendered frame", I see no reason for the observed behavior.
To reproduce: run the attached project, click G to start animation, right arrow several times to select 512 Balls, then E to activate Effects and/or I for toggling to Vector rendering. This will make the animation extremely slow, and it's easy to notice that reported FPS is too high.
- relates to
-
JDK-8106321 0-frame action() evaluated one too few times on 0-duration Timeline
- Closed
-
JDK-8106682 Timeline with only a 0ms KeyFrame fails to play
- Closed
-
JDK-8107870 General FPS reporting (RT-997) broken in Marina b11
- Closed
-
JDK-8099037 Need general mechanism to report FPS
- Resolved