asitop
asitop copied to clipboard
fix: restore compatibility with macOS 12 Monterey
Fixes #51 where the power usage key was renamed from package_energy to combined_power in macOS Ventura, resulting in the following error when attempting to run asitop under Monterey:
[3/3] Waiting for first reading...
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.11/site-packages/asitop/utils.py", line 18, in parse_powermetrics
cpu_metrics_dict = parse_cpu_metrics(powermetrics_parse)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/asitop/parsers.py", line 133, in parse_cpu_metrics
cpu_metric_dict["package_W"] = cpu_metrics["combined_power"]/1000
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'combined_power'
Fixes #51
@tlkh could we please merge in this fix?
bump @tlkh