asitop
asitop copied to clipboard
Fix for M3 Max - Using average of cores instead of relying on cluster idle ratio
Seems like the idle ratio of Cluster is reporting as zero in powermetrics
which might be causing the CPU gauges to show 100%. This code fix simply averages the individual core idle ratios.
Before fix on M3 Max (40 core GPU)
After fix
please @tlkh merge this one 🙏
@gavi Thank you so much! Your fix worked for me.
I tried the patch. It helped a little bit but seems wrong still. I am using M3 Max 16C/40GPU with just chrome browser running to test.
M3 max 16c/40gpu still showing 90% usage on e-Cores and 42-100% usage on P-cores.
Comparing this to
istatmenu (4 cpus - probably E-cores pegged near 90%, and 12 other CPU (I assume P-cores) showing nothing 1% here and there. Activity monitor is matching the istatsmenu
At least it's no longer pegging both e-cores and p-cores at 100% but something is still wrong.
I wonder how the youtubers are checking the stats these days with asitop. :)
I am not sure what to trust though. If you look at the plist file that is generated by powermetrics
, the p-cores were showing usage but like you said iStats and the activity monitor were not. I believe this will be a temporary fix until they actually fix powermetrics
itself.
Using a M3 Max here. The readings with this PR seem OK when the P-cores are actives, but they are overestimated when they are not. I think it is because the calculations do not take into account the P-Clusters and the P-Cores can also be down a part of the time, and that must be added to the "idle" time. I got something more plausible when I replace line 97
total_idle_ratio += cpu["idle_ratio"]
with this:
total_idle_ratio += cluster["down_ratio"] + (1 - cluster["down_ratio"]) * (cpu["idle_ratio"] + cpu["down_ratio"])
@phgrosjean I think your change is much better. I am updating my PR
Oh yes awesome. I noticed the down CPUs counter last night when I ran powermetrics manually to understand the output. Didn’t know how to account for them yet.
I did notice that the graph looks more accurate when I stress the computer to actually use the P-cores and that could explain what you just wrote.
Will try soon. Thank you!
On Wed, Jan 10, 2024 at 12:03 PM Philippe Grosjean @.***> wrote:
Using a M3 Max here. The readings with this PR seem OK when the P-cores are actives, but they are overestimated when they are not. I think it is because the calculations do not take into account the P-Clusters and the P-Cores can also be down a part of the time, and that must be added to the "idle" time. I got something more plausible when I replace line 97
total_idle_ratio += cpu["idle_ratio"]
with this:
total_idle_ratio += cluster["down_ratio"] + (1 - cluster["down_ratio"]) * (cpu["idle_ratio"] + cpu["down_ratio"])
— Reply to this email directly, view it on GitHub https://github.com/tlkh/asitop/pull/68#issuecomment-1885246502, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLJ5PU5N7PDC26IYKVG7H3YN3CUPAVCNFSM6AAAAABBGYINLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBVGI2DMNJQGI . You are receiving this because you commented.Message ID: @.***>
I updated the PR
Looks a lot better to me! thank you both.
@gavi thanks for the fix! would be great to see this merged.
For anyone who are not sure how to port this changes to your own machine, just replace the parsers.py
file with the changed parsers.py
file in this PR, for reference, I installed asitop via pip and it's located at /opt/homebrew/lib/python3.11/site-packages/asitop
for me. Then run asitop
again in the terminal, you are good to go.
pip install git+https://github.com/gavi/asitop.git
should work too.
Looking forward to this being merged and released, thanks @gavi !
Looking forward to this being merged and released, thanks @gavi !
Not likely, seems the repo author is off the planet to Mars.