I was wondering how you extract the temperature and CPU stats into the variables, and if you use powermeterics, would it be possible to also extract the Power usage of the Mac as well.
- Code: Select all
sudo powermetrics -i 1000 --samplers cpu_power,gpu_power -a --hide-cpu-duty-cycle --show-usage-summary --show-extra-power-info
I believe this works on both Intel and Apple silicon and would be useful to monitor the power consumption of our always on Macs.
example output
- Code: Select all
*** Summary system activity (Mon Mar 13 10:46:28 2023 +0000) (105101.74ms elapsed) ***
**** Processor usage ****
Intel energy model derived package power (CPUs+GT+SA): 22.66W
Intel energy model derived CPU core power: 18.3W
Intel energy model derived GT power: 0.872W
Intel energy model derived DRAM power: 1.27W
LLC flushed residency: 5.59%