Mactop uses an insane amount of compute resources
AndrewFarley opened this issue · 6 comments
Problem
For what it does, this tool uses an insane amount of compute resources. mactop
appears to have two threads, each using 50% of a CPU, so in total around 1 CPU constantly. Whereas similar tools, such as top
uses between 5-10% of a single CPU. We're talking 10-20x worse in performance for an (arguably) similar tool.

I don't know what the source is of the high cpu usage, you'd need to profile or perhaps disable certain widgets in your dashboard one at a time to isolate and determine which one(s) it is coming from. Once isolated, doing some research into why/how it is so poorly performant and fixing it would be great!
We utilize Apple's powermetrics
which is probably the culprit, will be looking into it further, thank you for reporting 👍
Also what M series chip are you running this on?
M3 Max 15" MBP 128GB. I wonder if it's just your refresh rate since it refreshes so often (the power usage dashboard anyway)? If that is, make that configurable perhaps (apologies if it is already, I missed it).
M3 Max 15" MBP 128GB. I wonder if it's just your refresh rate since it refreshes so often (the power usage dashboard anyway)? If that is, make that configurable perhaps (apologies if it is already, I missed it).
Thanks, to change the refresh rate, run mactop like sudo mactop -i 3000
it defaults to an interval of 1000. (1 second)
@metaspartan Changing that interval doesn't help, and it doesn't look like that refresh rate affects the "power" graph, which tell me that the interval is not the display interval, but an internal "update metrics" interval of the various CPU/GPU graphs. The "Total Power" area looks like it is refreshing maybe 50-100 times a second if I had to guess, which I could guess might be the source of this load. Just a thought though
Can you try perhaps reducing the "actual" refresh/render rate of the display to actually only once every second instead of whatever it is now hardcoded to?
The interval is for both the interval of powermetrics
and the UI refreshing, you can manually refresh the UI with r
and then to adjust the refresh and powermetrics intervals you would just use the -i 2000
for updating every 2 seconds for example. All of the stats like GPU, power usage, network, disk, P/E CPUs, ANE, are pulled from powermetrics at the same interval rate.
I was not able to replicate this at all on a M3 Max. There is a known bug with Apple's powermetrics for M3 Max P cluster residency data, next version of mactop will have fixes for this, which should be available later today! (Screenshot of it running below in Warp terminal)

Closing this for now, if I can get this replicated or have others with this issue, we can reopen.
Yep, fix seems to hold and uses a lot less resources especially when lowering the refresh rate. Thanks!