asdfjkl / jfxchess

JFXChess - Chess Program
https://asdfjkl.github.io/jfxchess
GNU General Public License v2.0
100 stars 22 forks source link

100 percent cpu usage on Linux #112

Closed ExtremeCoolDude closed 3 years ago

ExtremeCoolDude commented 3 years ago

Stockfish is off but the jar uses 100% cpu anyway, pc gets very hot upto 72C in my case. Using OpenJDk 11. The only warning is (java:12299): Gdk-WARNING **: XSetErrorHandler() called with a GDK error trap pushed. Don't do that. but its related to gtk theme. Not sure what's causing the issue.

ExtremeCoolDude commented 3 years ago

Ran the exe in windows 7 vm, CPU usage immediately starting the program jumps to 57% to 100%, (engine is off).

asdfjkl commented 3 years ago

This is currently expected behaviour, since the engine is off, but the thread that takes care of starting/stopping/interfacing with the engine is not.

Therefore on an N-thread system, expect 1/N CPU usage. For example on my Core i3, I have 2 cores and 4 four threads (hyperthreading). Therefore Jerry will use around 25% CPU.

Are you using a single-core system?

In future I will look in putting the thread to sleep if no engine is running...

ExtremeCoolDude commented 3 years ago

Thank you! That makes sense, in the 2 core vm it was 57%, I'm using 4 core 8 thread and the laptop gets uncomfortably hot with top command showing 100%. I guess I'll just use cpulimit tool while stockfish is not running.

asdfjkl commented 3 years ago

(reminder to myself): todo:

asdfjkl commented 3 years ago

(probably fixed in 2083610e81058610a7656e16a6e1a9eb9246a0cf but needs more testing! )

ExtremeCoolDude commented 3 years ago

Perfect so far! Thanks a lot!