syscl / CPUTune

An open source kernel extension enables dynamic CPU performance tuning at runtime for macOS.
162 stars 36 forks source link

Option to have 2 sets of settings for battery & AC + Options not updating on unload & reload #11

Open JJGadgets opened 4 years ago

JJGadgets commented 4 years ago

Hey there, great work on this program, it's helped me since I have a 2015 AMD 15" MacBook Pro, and for whatever reason when the dGPU is above 65-70C, or is utilised somewhat heavily, my CPU throttles like crazy. I've verified this by having the same usage but only the integrated GPU is enabled (dGPU forced disabled using gfxCardStatus), and it results in no throttling of any sorts. Together with VoltageShift for undervolting and setting power limits to get my frequencies similar to with BD PROCHOT enabled but no throttling, and Macs Fan Control, this is perfect for the way I want my MacBook Pro to be controlling its CPU (from my limited knowledge, it feels smooth and responsive at least this way rather than throttling seemingly randomly).

Back to my points. Firstly, a feature request: would it be possible to set all the settings based on power source? For my case, I'd like Turbo Boost enabled, BD PROCHOT disabled (for the dGPU throttling), and max frequency turbo rate limits when on AC power, since according to Apple, the battery is basically idle (un-utilised) and unplugged. On battery, I'd like Turbo disabled, BD PROCHOT enabled (I won't be using the dGPU when on battery anyway unless absolutely necessary like emergency photo editing or something), and some custom maximum frequency Turbo Rate Limits settings.

This leads to my second point, which is an issue: I could try to make a script for this, except I noticed one issue: when I change the settings (either in Info.plist or by using the echo commands in the README.md), it doesn't change immediately. As a matter of fact, it was so delayed that when I first enabled Turbo Boost while disabling BD PROCHOT (with both methods), I was expecting a kernel panic like you said in your blogpost, but it didn't happen until a solid 20 minutes later, despite multiple attempts to run sudo kextunload [path to CPUTune.kext] and sudo kextutil -v [path to CPUTune.kext]. I didn't get any further panics, reboots or shutdown after the initial one, and have since moved the .kext to /Library/Extensions, but if I was to make a script that changes these settings on the fly depending on power options (no clue about how to work with kexts heh, only thing I could do is change CPUTune settings and un+reload the kext using a shell script), having such a delayed update in settings would not be beneficial at all.

Thank you so much for this program, CPUTune + VoltageShift is like the ThrottleStop of macOS (not like I wanted to use Windows but the games I play don't run on macOS or Linux because of anti-cheat so I had to use ThrottleStop for some CPU issues on my desktop + Bootcamp).

(P.S. maybe you could work with the VoltageShift devs to make a full ThrottleStop alternative? hmm... I could only dream...)