asitop icon indicating copy to clipboard operation
asitop copied to clipboard

Support macOS 13

Open SuperKenVery opened this issue 3 years ago • 23 comments

I changed the bandwidths to disk r/w and network i/o.

I think those are more useful, and they avoided the problem that bandwiths are not available on macOS 13.

SuperKenVery avatar Oct 24 '22 06:10 SuperKenVery

Thanks for the PR. It’s finally working again!

About the i/o bandwidth changes. I don’t think they belong in here. The focus on asitop was entirely on the SoC and IMO, I think it should stay that way. Nothing wrong with removing the bandwidth section entirely.

BTW, not related to this but it seems like it’s underreporting power usage by about 5 watts or Ventura is being more power efficient. I can create a consistent load and it used to use up 7w. Now it’s down to 2w.

The graph is way off as well. Screenshot 2022-10-24 at 4 24 46 AM

dvessel avatar Oct 24 '22 08:10 dvessel

About the i/o bandwidth changes. I don’t think they belong in here. The focus on asitop was entirely on the SoC and IMO, I think it should stay that way.

Good point! But what do you think should belong here? Those are as far as I can get. Looking for ideas!

it seems like it’s underreporting power usage by about 5 watts

I indeed made some changes to that. The package power key is no longer available under macOS 13, but I saw a combined power, and I used it without further investigation.

:thinking:

What does combined power mean and what's the different between that and package power? Maybe someone could shed some light on that?

The graph is way off as well.

Your GPU load is high, that's correct; but its frequency is very low --- The lowest frequency, as far as I know. So maybe it's normal that its power consumption is low.

BTW, I remember seeing something like 6MHz or 9MHz GPU on macOS 12. However, on macOS13 the powermetrics just never report these frequencies. powermetrics would report the portion of time of each frequency, and 9MHz simply isn't on that list. I don't know what happened...

SuperKenVery avatar Oct 24 '22 14:10 SuperKenVery

Good point! But what do you think should belong here? Those are as far as I can get. Looking for ideas!

I wouldn’t mind if the section was removed entirely. Bandwidth was really useful and I’m sad to see it go but a possible replacement could be a swap memory graph. It would be in the perfect spot under memory. It shouldn’t be that big though since I seldom swap, lol. but it seems like it could be useful extension of the memory even though it’s not related to the SoC.

I indeed made some changes to that. The package power key is no longer available under macOS 13... What does combined power mean and what's the different between that and package power? Maybe someone could shed some light on that?

Package power I think included the memory controller. Possibly other components but I’m not certain. Combined power sums up cpu, gpu and ane according to powermetrics output.

CPU Power: 295 mW
GPU Power: 50 mW
ANE Power: 0 mW
Combined Power (CPU + GPU + ANE): 345 mW

asitop often shows the “Package Power” being lower than CPU Power. They don’t add up so I don’t think it’s only because of the change to combined power.

Screenshot 2022-10-24 at 1 27 06 PM

Your GPU load is high, that's correct; but its frequency is very low --- The lowest frequency, as far as I know. So maybe it's normal that its power consumption is low.

BTW, I remember seeing something like 6MHz or 9MHz GPU on macOS 12. However, on macOS13 the powermetrics just never report these frequencies. powermetrics would report the portion of time of each frequency, and 9MHz simply isn't on that list. I don't know what happened…

That makes sense. I know Activity Monitor can be misleading but the discrepancy between Activity Monitor and asitop was never to this degree.

dvessel avatar Oct 24 '22 17:10 dvessel

Just wanted to pipe up as a user, unsolicited; the memory bandwidth area was quite useful, particularly for gaining some visibility into what the media engine is up to. Understand if it goes away based on reading here, but it would be nice if there is some other way to peek into media engine usage in particular.

jcm93 avatar Oct 24 '22 17:10 jcm93

Temporary files in /tmp not being deleted on start up. Get the error on startup:

rm: "/tmp/asitop_powermetrics1666643878": No such file or directory rm: "/tmp/asitop_powermetrics1666646351": No such file or directory rm: "/tmp/asitop_powermetrics1666646428": No such file or directory

shailesh001 avatar Oct 24 '22 21:10 shailesh001

Well, that’s a little problem. I changed os.rmfile to subprocess.Popen(“sudo rm …”) so that you can run asitop without sudo. This makes debugging easier. But I don’t think it means that the files are not being deleted; it means that they have already been deleted by the OS (I guess).  Temporary files in /tmp not being deleted on start up. Get the error on startup: rm: "/tmp/asitop_powermetrics1666643878": No such file or directory rm: "/tmp/asitop_powermetrics1666646351": No such file or directory rm: "/tmp/asitop_powermetrics1666646428": No such file or directory

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

SuperKenVery avatar Oct 25 '22 04:10 SuperKenVery

Well, that’s a little problem. I changed os.rmfile to subprocess.Popen(“sudo rm …”) so that you can run asitop without sudo. This makes debugging easier. But I don’t think it means that the files are not being deleted; it means that they have already been deleted by the OS (I guess).  Temporary files in /tmp not being deleted on start up. Get the error on startup: rm: "/tmp/asitop_powermetrics1666643878": No such file or directory rm: "/tmp/asitop_powermetrics1666646351": No such file or directory rm: "/tmp/asitop_powermetrics1666646428": No such file or directory —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

Noted the change made and yes definitely makes debugging easier but checked the directory:

-rw-r--r--  1 root  wheel  627583 24 Oct 21:38 /tmp/asitop_powermetrics1666643878
-rw-r--r--  1 root  wheel       0 24 Oct 22:19 /tmp/asitop_powermetrics1666646351
-rw-r--r--  1 root  wheel  117439 24 Oct 22:20 /tmp/asitop_powermetrics1666646428
-rw-r--r--  1 root  wheel       0 24 Oct 22:20 /tmp/asitop_powermetrics1666646439

Tried on my MBA and MSU and I get the same results after the first execution.

Tried the following fix which seems to work:

    cmd = ["sudo", "rm"]
    files = glob.glob("/tmp/asitop_powermetrics*")
    if files:
        args = cmd + files
        subprocess.Popen(args)

shailesh001 avatar Oct 25 '22 06:10 shailesh001

Package power I think included the memory controller. Possibly other components but I’m not certain. Combined power sums up cpu, gpu and ane according to powermetrics output.

CPU Power: 295 mW
GPU Power: 50 mW
ANE Power: 0 mW
Combined Power (CPU + GPU + ANE): 345 mW

asitop often shows the “Package Power” being lower than CPU Power. They don’t add up so I don’t think it’s only because of the change to combined power.

I think you are spot on. I now have the suspicion that powermetrics never really reported the actual package power (as in, SoC power), in the old versions it was CPU+GPU+ANE+DRAM but it was still missing the power usage of the interconnect and other processors. So they probably renamed it to make it less confusing. Rather annoying that they dropped the DRAM info at the same time, that was really useful.

tzakharko avatar Oct 26 '22 11:10 tzakharko

I have a genius (stupid) idea. Can we use the powermetrics binary from macOS 12 directly on macOS 13? Are all the system calls still there?

SuperKenVery avatar Oct 26 '22 12:10 SuperKenVery

Well, that’s a little problem. I changed os.rmfile to subprocess.Popen(“sudo rm …”) so that you can run asitop without sudo. This makes debugging easier. But I don’t think it means that the files are not being deleted; it means that they have already been deleted by the OS (I guess).  Temporary files in /tmp not being deleted on start up. Get the error on startup: rm: "/tmp/asitop_powermetrics1666643878": No such file or directory rm: "/tmp/asitop_powermetrics1666646351": No such file or directory rm: "/tmp/asitop_powermetrics1666646428": No such file or directory —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

Noted the change made and yes definitely makes debugging easier but checked the directory:

-rw-r--r--  1 root  wheel  627583 24 Oct 21:38 /tmp/asitop_powermetrics1666643878
-rw-r--r--  1 root  wheel       0 24 Oct 22:19 /tmp/asitop_powermetrics1666646351
-rw-r--r--  1 root  wheel  117439 24 Oct 22:20 /tmp/asitop_powermetrics1666646428
-rw-r--r--  1 root  wheel       0 24 Oct 22:20 /tmp/asitop_powermetrics1666646439

Tried on my MBA and MSU and I get the same results after the first execution.

Tried the following fix which seems to work:

    cmd = ["sudo", "rm"]
    files = glob.glob("/tmp/asitop_powermetrics*")
    if files:
        args = cmd + files
        subprocess.Popen(args)

Now fixed.

SuperKenVery avatar Nov 05 '22 11:11 SuperKenVery

asitop often shows the “Package Power” being lower than CPU Power.

This never happened to me.

The code for package power is at file parsers.py line 128. Maybe you could check it out yourself. My favorite way of seeing what keys are available is by setting breakpoints :D

SuperKenVery avatar Nov 05 '22 11:11 SuperKenVery

I have a genius (stupid) idea. Can we use the powermetrics binary from macOS 12 directly on macOS 13? Are all the system calls still there?

This actually works. I assumed it wouldn’t and didn’t try until I was informed by someone who actually tried it. So, if you have a copy of Monterey, you can copy it over to Ventura.

What I did was rename it to powermetrics@12 and throw it into a bin folder in my home directory. ~/.local/bin/powermetrics@12, need to add a path in your .zshrc file so it reads it. asitop needs to be modified to call it.

It’s not something that can be included with asitop so it’s something you have to fix locally.

dvessel avatar Nov 07 '22 11:11 dvessel

Wow!

I think we can let asitop download that thing automatically. macOS 12 won’t change anymore, so powermetrics would be in a fixed position in the recovery image I guess. Would that be possible?

SuperKenVery avatar Nov 07 '22 11:11 SuperKenVery

Well, most importantly, are memory bandwidths available?

SuperKenVery avatar Nov 07 '22 11:11 SuperKenVery

The license isn't compatible and it can’t be hosted on GitHub. And yes, memory bandwidth is working again.

dvessel avatar Nov 07 '22 11:11 dvessel

The license isn't compatible and it can’t be hosted on GitHub.

Yeah but I think it's ok to download it from apple. We can write the script to download from Apple.

SuperKenVery avatar Nov 07 '22 12:11 SuperKenVery

This actually works. I assumed it wouldn’t and didn’t try until I was informed by someone who actually tried it. So, if you have a copy of Monterey, you can copy it over to Ventura.

Thats kinda amazing, Windows users can only wish! Maybe a cli flag could be added to invoke a custom powermetrics binary to facilitate those that have access to a Monterey image.

cryptoAlgorithm avatar Nov 10 '22 11:11 cryptoAlgorithm

Hi there - it seems googling for asitop & Ventura support it leads to this PR.

I figure until it gets merged/fixed and someone still wants to run/test asitop on Ventura this can be of use:

➜ pip remove asitop                                              # remove original install
➜ pip install git+ssh://[email protected]/SuperKenVery/asitop.git   # install asitop directly from this PR

marianposaceanu avatar Nov 17 '22 10:11 marianposaceanu

Can we merge this in?

jlei523 avatar Dec 09 '22 05:12 jlei523

@SuperKenVery FYI I can invoke the sudo powermetrics on my local machine running Ventura without any issue. I didn't download anything. My Ventura is upgraded from Monterey. And please keep the memory bandwidth or make a command line args for replacing the memory bandwidth with disk bandwidth.

nlgtuankiet avatar Dec 10 '22 14:12 nlgtuankiet

Yeah powermetrics runs but doesn’t report memory bandwidth anymore, at least on my machine. One of our ideas is to run macOS 12’s powermetrics on macOS 13 but I haven’t had time to verify/work on that. 发自我的 iPhone在 2022年12月10日,22:40,nlgtuankiet @.***> 写道: @SuperKenVery FYI I can invoke the sudo powermetrics on my local machine running Ventura without any issue. I didn't download anything. My Ventura is upgraded from Monterey. And please keep the memory bandwidth or make a command line args for replacing the memory bandwidth with disk bandwidth.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

SuperKenVery avatar Dec 10 '22 14:12 SuperKenVery