
JAVA 60 FPS TIMER CODE
Source code follows for both source modules.

When running fedora 24 or Linux Mint 19, my actual result was the same as the expected result. Also, my actual result described here is when running fedora 27 and fedora 28.
JAVA 60 FPS TIMER MAC
Note: as reported to me by the author of the Java book, his actual results when running on Windows 10, Ubuntu, Linux Mint, and Mac are the expected results. Keyboard was pretty much unresponsive and pressed keys backed up, resulting in things like "killlllllllll" appearing when I'd typed "kill". Then tried to enter a kill command to end the process. Did manage to move to another terminal window, but it took awhile. The %CPU value for the program that is shown in another terminal window running top shows excessive CPU for the program (all in excess of 50 some 80s one 109).Ĥ.

Displayed "Elapsed Time:" value increases from 0 and keeps increasing manually computing fps yields approximately 200+ fps.ģ. Displayed "Elapsed Time:" value increases from 0 to 0.3 seconds. Note: as reported to me by the author of the Java book, his actual results when running on Windows 10, Ubuntu, Linux Mint, and Mac are the expected results.Ģ. While program is running, are able to easily move to other windows, use mouse, run other programs, etc. Displayed "Elapsed Time:" value increases from 0 and keeps increasing manually computing fps (frames per second) yields approximately 60 fps.ģ. Displayed "Frame number" value increases from 1 and keeps increasingĢ. Displayed "Elapsed Time:" value increases from 0 to 1 seconds.ġ. Displayed "Frame number" value increases from 1 to 60Ģ. From terminal window: "java SimpleAnimationStarter". From terminal window: "java Test02SimpleAnimationStarter". WARNING: Since running SimpleAnimationStarter causes the problem, run Test02SimpleAnimationStarter first! Continue to next step.Ĥ. Compile them using "javac " where is one of the 2 names.ģ.
JAVA 60 FPS TIMER DOWNLOAD
Download the 2 source modules, SimpleAnimationStarter.java and Test02SimpleAnimationStarter.java.Ģ. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :ġ. I am no expert, but it appears to me that something changed in the linux kernel between 4.15 and 4.16 that, together with JavaFX, is causing the problem. While it was running, top showed %CPU values of 109.2 (once) with other values above 50 until the program stopped the animation. I then started top in one terminal window then started the newer test program in another terminal window. More recently, thanks to a suggestion from the author of the book, I modified the original source to stop the animation after fixed number of frames were displayed. When this program was run, the displayed frame number was 60, as expected, and the displayed elapsed time was 0.3 seconds, not the expected 1 second. The Test02SimpleAnimationStarter.java source, shown below, does this. The original SimpleAnimationStarter.java source was modified to stop after 60 frames. It appears that something changed in Linux between kernel versions 4.15 and 4.16 that is causing the problem. Summary of my testing environment and results. I downloaded and ran Fedora 28 from a live USB. Next I rebooted an older Fedora 24 and tested the program there. I downloaded and ran the latest Linux Mint from a live USB, then tested the program there using the same Java as is used for Fedora 27.

When I notified the book's author, he responded that the program runs fine on all his PCs (Ubuntu, Linux Mint, Mac, Windows).
JAVA 60 FPS TIMER PC
When compiled and run on my PC it floods the application window so much that I am almost unable to move my mouse to another window so that I can kill the running program.

The expected output is to see "60 frames per second" that is, the displayed frame number divided by the displayed elapsed time should be 60. It is a very simple program that simply displays the current frame number and the elapsed time in seconds. The program source is SimpleAnimationTimer.java. While proofreading a new version of an online Java textbook I ran into a problem running a sample program from the book that illustrates JavaFX AnimationTimer. PC has 16GiB memory CPU is an Athlon FX-8320 Black Edition 8-core processor. Video is handled by whatever is provided by fedora (that is, I am not using proprietary video drivers).
