I know emulation of all the hardware is cpu-intensive, but not to this extent.
With OProfile I noticed that one thread of sound.c was the guilty one. And after some investigation, I noticed that 'sound_cd_event' is set in the poll routine, checked in the sound_cd_thread() but nobody reset the poor little thing.
After applying the patch, I see no more CPU hogging and when pcem is idle, cpufreq barely needs to go above 1GHz on my i7-4770k.
Can someone tell me if this also helps on Windows?
PATCH:
Code: Select all
diff -r 36890fccc1ce src/sound.c
--- a/src/sound.c Sun Feb 04 20:35:34 2018 +0000
+++ b/src/sound.c Thu Feb 08 19:33:55 2018 +0100
@@ -150,6 +150,7 @@
int c;
thread_wait_event(sound_cd_event, -1);
+ thread_reset_event(sound_cd_event);
memset(cd_buffer, 0, CD_BUFLEN*2 * 2);
ioctl_audio_callback(cd_buffer, CD_BUFLEN*2);
image_audio_callback(cd_buffer, CD_BUFLEN*2);