Closed LuisBlanche closed 10 months ago
I have spend quite some time, it seems that we can get all the info we need using powermetrics
but the problem is that powermetric
needs sudo rights, and asitop is built on top of powermetrics, so same problem.
There is no command line associated to MX Power Gadget so no way to use it the same way as Intel Power Gadget.
I have read here that there is actually no known alternatives : https://www.green-coding.berlin/blog/power-measurement-on-macos/
Only solution I have for now is :
sudo visudo
and add
username ALL = (root) NOPASSWD: /usr/bin/powermetrics
which allows username
to use powermetrics without prompting password
Which seems to be raising security issues
Hey @LuisBlanche thanks for this!
Indeed there is no way right now to measure Apple M1/M2 performances. Feel free to give it a try!
About the need for sudo
, we have a similar issue with Linux and RAPL (https://github.com/mlco2/codecarbon/issues/244).
For the case of M1/M2 and powermetrics
, maybe there is a way to know specifically which classes/files need sudo
permissions and give only to those?
@inimaz powermetrics
is not open source so there is no way to access a lower level of permissions. The only way I found for now is giving it sudo
permission. I've spent some time looking for other solutions but it seems that there is no other solution that does not necessitate administrative rights
It may be the same security reason but it's a shame that in 2023 we need to be root to get hardware consumption... Low level API could send aggregated energy data to avoid security risk.
Hi
I am on MacBook m2 pro 16'', my goal is to store the codecarbon logs in emission.csv and then use it with Dash App to have a dashboard regarding carbon emissions. But in my case codecarbon is outputting the logs in a file called powermetrics_log.txt, how can I visualize it on a dashboard (private)?
I'm following this portion of the documentation: codecarbon/visualize.html
Specs of my MacBook:
Model Name: MacBook Pro
Model Identifier: Mac14,10
Chip: Apple M2 Pro
Total Number of Cores: 12 (8 performance and 4 efficiency)
Memory: 16 GB
Description
Test intel power gadget is not passing on Apple M1/M2 (Silicon) Processors. It is not possible to install Intel Power Gagdet there (moreover it will be deprecated soon cf #457)
What I Did
I found an alternative to check power consumption on Apple Silicon here : MX Power Gadget. I tested the app on my mac and it works well.
Suggestion
I can easily detect wether the processor is from Apple :
Now all I need to find out is how to retrieve power consumption information
Two options :
powermetrics
, a native macos utilityI will start exploring option 2