def _get_max_temperature(self):
        """Get temperature of hottest sensor in Celsius.

        @returns float of temperature of hottest sensor.
        """
        temperature = utils.get_current_temperature_max()
        if not temperature:
            temperature = 0
        return temperature
Beispiel #2
0
 def __init__(self):
     self._service_stopper = None
     # Keep a copy of the current state for cleanup.
     self._temperature_init = utils.get_current_temperature_max()
     self._temperature_critical = utils.get_temperature_critical()
     self._original_governors = utils.set_high_performance_mode()
     self._error_reason = None
     if not utils.wait_for_idle_cpu(60.0, 0.1):
         self._error_reason = 'Could not get idle CPU.'
         return
     if not utils.wait_for_cool_machine():
         self._error_reason = 'Could not get cold machine.'
         return
     self._temperature_cold = utils.get_current_temperature_max()
     self._temperature_max = self._temperature_cold
     threading.Thread(target=self._monitor_performance_state).start()
     # Should be last just in case we had a runaway process.
     self._stop_thermal_throttling()
Beispiel #3
0
 def _monitor_performance_state(self):
     """
     Checks machine temperature once per second.
     TODO(ihf): make this more intelligent with regards to governor,
                CPU, GPU and maybe zram as needed.
     """
     while True:
         time.sleep(1)
         current_temperature = utils.get_current_temperature_max()
         self._temperature_max = max(self._temperature_max,
                                     current_temperature)
         # TODO(ihf): Remove this spew once PerfControl is stable.
         logging.info('PerfControl CPU temperature = %.1f',
                      current_temperature)
 def get_current_temperature_max(self):
     """
     Returns the highest reported board temperature (all sensors) in Celsius.
     """
     return utils.get_current_temperature_max()