You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when sudo is available on MacOS, I believe it is unavoidable that powermetrics.is_powermetrics_available() will attempt to use it, even if a default power is supplied.
Although ways to avoid the need for sudo entirely would be significantly more useful (e.g. discussion in #731), a simple short term solution could be to swap the current check:
If instead the check against _default_cpu_power is performed first, this would enable avoiding the need to call powermetrics.is_powermetrics_available().
It may also be more efficient to swap this check for other branches of if statements, although I haven't encountered specific issues. (There's also cpu.is_rapl_available(), which doesn't check whether self._default_cpu_power is None. This seems inconsistent, but it may be intentional?)
Description
Currently, when
sudo
is available on MacOS, I believe it is unavoidable thatpowermetrics.is_powermetrics_available()
will attempt to use it, even if a default power is supplied.Although ways to avoid the need for
sudo
entirely would be significantly more useful (e.g. discussion in #731), a simple short term solution could be to swap the current check:If instead the check against
_default_cpu_power
is performed first, this would enable avoiding the need to callpowermetrics.is_powermetrics_available()
.It may also be more efficient to swap this check for other branches of
if
statements, although I haven't encountered specific issues. (There's alsocpu.is_rapl_available()
, which doesn't check whetherself._default_cpu_power is None
. This seems inconsistent, but it may be intentional?)What I Did
This currently prompts for a password, even when the supplied default will be used.
The text was updated successfully, but these errors were encountered: