ppd: Adjust the detection of 'performance-degraded'
In rare cases, 'lap-mode' and 'no-turbo' files may be empty. Do not attempt to convert their content into integers. Instead check if it's directly equal to "1" (after stripping whitespace).
This commit is contained in:
parent
b2ed1258c7
commit
31b21edc8a
1 changed files with 4 additions and 6 deletions
|
|
@ -105,12 +105,10 @@ class Controller(exports.interfaces.ExportableInterface):
|
|||
|
||||
def _check_performance_degraded(self):
|
||||
performance_degraded = PerformanceDegraded.NONE
|
||||
if os.path.exists(NO_TURBO_PATH):
|
||||
if int(self._cmd.read_file(NO_TURBO_PATH)) == 1:
|
||||
performance_degraded = PerformanceDegraded.HIGH_OPERATING_TEMPERATURE
|
||||
if os.path.exists(LAP_MODE_PATH):
|
||||
if int(self._cmd.read_file(LAP_MODE_PATH)) == 1:
|
||||
performance_degraded = PerformanceDegraded.LAP_DETECTED
|
||||
if os.path.exists(NO_TURBO_PATH) and self._cmd.read_file(NO_TURBO_PATH).strip() == "1":
|
||||
performance_degraded = PerformanceDegraded.HIGH_OPERATING_TEMPERATURE
|
||||
if os.path.exists(LAP_MODE_PATH) and self._cmd.read_file(LAP_MODE_PATH).strip() == "1":
|
||||
performance_degraded = PerformanceDegraded.LAP_DETECTED
|
||||
if performance_degraded != self._performance_degraded:
|
||||
log.info("Performance degraded: %s" % performance_degraded)
|
||||
self._performance_degraded = performance_degraded
|
||||
|
|
|
|||
Loading…
Reference in a new issue