Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support macOS 13 #44

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Support macOS 13 #44

wants to merge 4 commits into from

Conversation

SuperKenVery
Copy link

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.

Changed the 4 memory bandwiths to disk r/w and network i/o
@dvessel
Copy link

dvessel commented Oct 24, 2022

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

@SuperKenVery
Copy link
Author

SuperKenVery commented Oct 24, 2022

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.

🤔

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...

@dvessel
Copy link

dvessel commented Oct 24, 2022

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.

@jcm93
Copy link

jcm93 commented Oct 24, 2022

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.

@shailesh001
Copy link

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

@SuperKenVery
Copy link
Author

SuperKenVery commented Oct 25, 2022 via email

@shailesh001
Copy link

shailesh001 commented Oct 25, 2022

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)

@tzakharko
Copy link

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.

@SuperKenVery
Copy link
Author

SuperKenVery commented Oct 26, 2022 via email

@SuperKenVery
Copy link
Author

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
Copy link
Author

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

cpu_metric_dict["cpu_W"] = cpu_metrics["cpu_energy"]/1000
cpu_metric_dict["gpu_W"] = cpu_metrics["gpu_energy"]/1000
cpu_metric_dict["package_W"] = cpu_metrics["package_energy"]/1000
cpu_metric_dict["package_W"] = cpu_metrics["combined_power"]/1000
Copy link

@dvessel dvessel Nov 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combined_power is not a direct replacement for package_energy. This is why I was getting bad “Package power” readings.

cpu/gpu/ane _energy has to be added manually to get the combined_energy.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, according to (command-line invoked) powermetrics, combined_energy IS cpu+gpu+ane.

@dvessel
Copy link

dvessel commented Nov 7, 2022

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.

@SuperKenVery
Copy link
Author

SuperKenVery commented Nov 7, 2022 via email

@SuperKenVery
Copy link
Author

SuperKenVery commented Nov 7, 2022 via email

@dvessel
Copy link

dvessel commented Nov 7, 2022

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

@SuperKenVery
Copy link
Author

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.

@cryptoAlgorithm
Copy link

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.

@marianposaceanu
Copy link

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://git@github.com/SuperKenVery/asitop.git   # install asitop directly from this PR

@jlei523
Copy link

jlei523 commented Dec 9, 2022

Can we merge this in?

@nlgtuankiet
Copy link

@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.

@SuperKenVery
Copy link
Author

SuperKenVery commented Dec 10, 2022 via email

Please, something is better than nothing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants