RetroDebugger icon indicating copy to clipboard operation
RetroDebugger copied to clipboard

It creates a lot of heat and drains battery in older Macbooks (Catalina)

Open JJRomanV opened this issue 10 months ago • 21 comments

It is awesome to have this app on a Mac but just with the program on standby it drains the battery and has the cpu/gpu (MBP Retina mid 2015 15" 16GB ram i7-4790 and SSD) on fire. It's got a 8900mAh new battery, and it hasn't been abused, only for pro audio so it's on a very good state despite of its age. I run Blender 3.6 without issues unless you produce a big scene with tens of thousands of triangles. So, it drains the battery. It produces similar charge on the system as Unreal Engine 4 editor with a full project.

Dunno if it's a general issue with laptops. Are you planning on making it more cpu efficient to be able to run it on any smaller system? Maybe it is one of the modules only.

To Reproduce Steps to reproduce the behavior:

  1. Start the program
  2. It starts Vice
  3. Leave the monitor on standby (without loading any software on the c64)
  4. Fans (clean) go to full speed.

Expected behavior: Keep the system cool until you start tweaking things.

Desktop:

  • OS: Mac OSX Catalina 10.15.7
  • Version 0.64.64

JJRomanV avatar Feb 23 '25 09:02 JJRomanV

This is how emulation works, it does not matter if you are doing something ie prg is started or not, it runs a program (basic prompt in this case), so it needs to gather a lot of data and statistics. To lower the usage you can switch off heavy features in Settings:

  • change SID engine to FastSID
  • switch off timeline rewind feature or limit time between snapshots
  • switch off gathering statistics for VIC Display
  • switch off views (ie create empty workspace) so they do not need to update

slajerek avatar Feb 26 '25 10:02 slajerek

Thanks for the follow up. I will keep on supporting this amazing project and congratulations again for your amazing work.

I followed all your steps and had these results:

Image With all windows closed, Timeline deactivated and SID set to Fast SID I still get 82 to 99% CPU load.



Image If I open C64 screen (Vice, either 100% or 200% screen) I reach 100% CPU load and fans go crazy in a minute.



Image If I shut down the app and open Vice I have a 5 to 10% CPU load.




Image I closed Vice and open Retrodebugger with only 1 active window: Dissasembly. CPU load raises again and battery goes down quickly.

Something´s there that makes the cpu extremely busy. GPU load does not go over 12% on average though. Even on idle (empty workspace, no prg loaded, no activity monitored) CPU goes up to 87 to 92% load.

JJRomanV avatar Feb 26 '25 18:02 JJRomanV

Which macOS do you have installed? I am running on 2,3 GHz 8-Core Intel Core i9 and after upgrading to Sequoia it decreased CPU usage a lot.

No fans even.

Image

og2t avatar Feb 26 '25 19:02 og2t

Which macOS do you have installed? I am running on 2,3 GHz 8-Core Intel Core i9 and after upgrading to Sequoia it decreased CPU usage a lot.

No fans even.

I´m running Catalina 10.15 OSX on a 2,2 Ghz Quad core i7 16GB Ram, Mac Book Pro mid 2015. @og2t Your CPU also looks hot on 85% load. Mine might be old but still runs fresh on heavy audio plugins and software. I even ran Unreal Engine 4 editor for simple stuff. Still Vice runs unnoticed.

JJRomanV avatar Feb 26 '25 19:02 JJRomanV

How about the older version? It seems to take less CPU but my fans start right away.

Image

og2t avatar Feb 26 '25 20:02 og2t

Have you changed VIC Display recording to None?

First of all, I see you are using Catalina and version is 0.64.64, which is very old version from 2023. We are now at 0.64.72. I added some optimizations and especially upgraded SDL and ImGui in most recent versions which should lower the CPU usage, but I think they are not supported by Catalina anymore due to Apple's restrictions in newest Xcode required by the new SDL library.

Regarding Vice taking less CPU, is it cycle-accurate version with full drive support? There are different options of Vice that are not accurate that work much quicker and take almost no CPU usage (i.e. not cycle-accurate), but these versions of course are not desired in case of debugging.

Just a side note, on my MacBook M2 i see 120fps and no fans at all... anyway, note the debugger has a lot, I mean a lot overhead to gather data it requires, thus emulation is more complex and does much more each emulated CPU cycle than Vice does.

slajerek avatar Feb 27 '25 11:02 slajerek

@slajerek I'm gonna check VIC recording straight away.

I can upgrade to Big Sur (preferably, due to external hardware-software compatibility) or Monterrey maximum (according to Apple) until I change to a new ARM Apple cpu. Do you know wich minimum OSX version is suitable for 0.64.72?

JJRomanV avatar Feb 27 '25 14:02 JJRomanV

Not sure, I haven't tested that. I have my another Mac from 2013 with Catalina and I tried it running, but there's something in new SDL2 related to joysticks that Catalina's API does not support. Probably it is possible to compile new version that supports Catalina by downgrading the SDL2.

I checked in profiler where most time is spent and 60% of RetroDebugger time accounts to CPU/VIC/SID emulation, then 30% to Render pipeline and ImGui and especially refreshing bitmaps each frame (screen, memory map, etc.), 10% is left for some other things OS related. Thus, it will be quite hard to optimize this further. I compiled the code with -O3 optimizations instead of -Os and I gained approx. 6% CPU's less load, thus not much.

slajerek avatar Feb 27 '25 17:02 slajerek

Thank you. Are there already compiled versions of 0.64.72 available on the repo? That would be of much help. I don't have any framework, just VS Code and a few extensions in my mac. I only use this unit for audio and retro computing. I'm going to upgrade to Big Sur and will try install your last ver, then cross fingers and then to Monterrey.

JJRomanV avatar Feb 27 '25 18:02 JJRomanV

OK, just updated to Big Sur and downloaded 0.64.72 (found it). It works on Big Sur (OSX 11.7). I disabled VIC Display Recording. Still getting a lot of CPU load. True that without VIC Display Recording it got some 8% relief. I don´t think there´s much that can be done. Maybe it´s too much for older machines. Weird thing: when you pause it drops CPU load to 52% but fans don´t settle down. Temp stays at 78ºC.

JJRomanV avatar Feb 28 '25 00:02 JJRomanV

Could you please also check About/ImGu metrics? How many FPS you have? There are approx 12k vertices to render.

slajerek avatar Feb 28 '25 08:02 slajerek

Image Image

JJRomanV avatar Feb 28 '25 10:02 JJRomanV

Pause button is very clever and convenient.

JJRomanV avatar Feb 28 '25 10:02 JJRomanV

Image

This profiler is amazing. Lots of work here I must say.

JJRomanV avatar Feb 28 '25 10:02 JJRomanV

Image

Too hot

JJRomanV avatar Feb 28 '25 10:02 JJRomanV

Please check this version: https://drive.google.com/file/d/1Cqe7sA2FUK1qlyQsaFgqqllKBavVxhvA/view?usp=share_link

I changed optimization compiler setting from Fast/Small to Fastest, I see a few % CPU gain in my setup. Note, I also changed OpenGL from old version to 4.1, hope this speeds up things too, if it does not work/crashes please let me know.

slajerek avatar Mar 01 '25 20:03 slajerek

It looks a little bit fresher on cpu temp with version .73. Thanks for your effort and continuos improving. The .73 does not crash until now.

Image Image

Have a look at this vid, without anything selected is it normal the continuos flickering? Might that be creating some extra ms on the draw? https://github.com/user-attachments/assets/b2be83c7-45ff-4b5e-b46e-bba5cb98c287

JJRomanV avatar Mar 02 '25 17:03 JJRomanV

You mean the Disassembly view? Yes, that's correct, you scrolled Disassembly to memory that constantly changes so it is reflected in realtime.

slajerek avatar Mar 07 '25 10:03 slajerek

Is it possible to reduce or change the refresh rate in the menus for those memory checks?

JJRomanV avatar Mar 07 '25 23:03 JJRomanV

It is not a check, it is just realtime rendering, so it does not matter. I however might add fps throttle to the Settings.

slajerek avatar Mar 11 '25 07:03 slajerek

Understood. Thank you.

JJRomanV avatar Mar 11 '25 07:03 JJRomanV