Jump to content

GPU (Graphics Card) Workload Usage Percentage for Apple Silicon M-series Mac? (Xcode & Swift)

Is there a way to display the GPU (graphics card) workload usage as a percentage for Apple Silicon M-series Mac with Swift & Xcode? CPU monitoring works. GPU monitoring seems impossible. I only get the workload for the current app, but total GPU workload for the whole system is impossible to figure out for me. Any ideas how to do this?

 

Link to comment
Share on other sites

Link to post
Share on other sites

You can get that with the built-in powermetrics tool:

image.thumb.png.c944d265a43907ad89c8b6f020b83670.png

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, igormp said:

You can get that with the built-in powermetrics tool:

image.thumb.png.c944d265a43907ad89c8b6f020b83670.png

This seems like it requires the users to enter their admin password every time it updates, so they have to enter their password every second... any ideas?

Link to comment
Share on other sites

Link to post
Share on other sites

21 minutes ago, creat0r said:

This seems like it requires the users to enter their admin password every time it updates, so they have to enter their password every second... any ideas?

I'm not aware of any other APIs that province such data, so either look for another one or have your application require sudo to run

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

11 minutes ago, igormp said:

I'm not aware of any other APIs that province such data, so either look for another one or have your application require sudo to run

Hmmm... I found this thread: https://apple.stackexchange.com/questions/430403/graphically-display-the-information-collected-by-powermetrics and it seems to be a way to do this without having to re-enter the password every second since Mx Power Gadget can read the GPU workload usage percentage without any admin password... 

Link to comment
Share on other sites

Link to post
Share on other sites

I'm not a Swift developer, but it looks like you can get system device properties with IORegistryEntryCreateCFProperties. You can get the registry entry handle from IOServiceGetMatchingServices, scoping that to your graphics device by matching by the IOAccelerator class type.

 

At the very least, that should let you see what properties are available to you from the accelerator device. Maybe there will be some performance statistics/metrics.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×