def update(): temperatures = psutil.sensors_temperatures() chips = list(temperatures.keys()) sensor = temperatures[chips[0]][0].current update_max_temp(last_value) self.last_temp = last_value Source.update(self)
def update(): last_value = psutil.sensors_temperatures( )['coretemp'][0].current # Update max temp update_max_temp(last_value) self.last_temp = last_value Source.update(self)
def __init__(self, custom_temp=None, temp_thresh=None): Source.__init__(self) self.max_temp = 10 self.measurement_unit = 'C' self.last_temp = 0 logging.debug("arg temp " + str(custom_temp)) self.custom_temp = custom_temp self.is_available = True # Set update function self.update = self.init_update() # Initial update # Set temperature threshold if a custom one is set if temp_thresh is not None: try: if int(temp_thresh) > 0: self.temp_thresh = int(temp_thresh) logging.debug("Updated custom threshold to " + str(self.temp_thresh)) else: self.temp_thresh = self.THRESHOLD_TEMP except ValueError: self.temp_thresh = self.THRESHOLD_TEMP else: self.temp_thresh = self.THRESHOLD_TEMP self.update() logging.debug("Update is updated to " + str(self.update))
def update(): sensors_info = self.custom_temp.split(",") sensor_major = sensors_info[0] sensor_minor = sensors_info[1] last_value = psutil.sensors_temperatures()[sensor_major][ int(sensor_minor)].current update_max_temp(last_value) self.last_temp = last_value Source.update(self)
def update(): with os.popen(cmd) as temp_file: last_value = temp_file.read() logging.info("Recorded temp " + last_value) try: last_value = int(last_value) / 1000 except (ValueError): logging.debug("Thermal zone contains no data") self.is_available = False return empty_func update_max_temp(last_value) self.last_temp = last_value Source.update(self)
def __init__(self, custom_temp=None): Source.__init__(self) self.max_temp = 0 self.measurement_unit = 'C' self.last_temp = 0 self.custom_temp = custom_temp self.is_available = True self.update() # Initial update # If not relevant sensor found, do not register temperature if int(self.max_temp) <= 0: self.is_available = False logging.debug("Temperature sensor unavailable")
def update(): last_value = os.popen( 'cat /sys/class/thermal/thermal_zone0/temp 2> /dev/null' ).read() logging.info("Recorded temp " + last_value) try: last_value = int(last_value) / 1000 except (ValueError): logging.debug("Thermal zone contains no data") self.is_available = False return empty_func update_max_temp(last_value) self.last_temp = last_value Source.update(self)
def __init__(self): self.is_available = True self.last_util_list = [0] try: self.last_util_list = [0] * psutil.cpu_count() except AttributeError: logging.debug("cpu_freq is not available from psutil") self.is_available = False return self.update() Source.__init__(self)
def __init__(self, temp_thresh=None): Source.__init__(self) self.max_temp = 10 self.measurement_unit = 'C' self.last_temp = 0 self.temp_thresh = self.THRESHOLD_TEMP self.is_available = True self.available_sensors = [] sensors_dict = dict() try: sensors_dict = psutil.sensors_temperatures() except (AttributeError, IOError): logging.debug("Unable to create sensors dict") self.is_available = False return for key, value in sensors_dict.items(): sensor_name = "".join(key.title().split(" ")) for sensor_idx, sensor in enumerate(value): sensor_label = sensor.label full_name = "" if not sensor_label: full_name = sensor_name + "," + str(sensor_idx) else: full_name = ("".join(sensor_label.title().split(" ")) + "," + sensor_name) logging.debug("Temp sensor name " + full_name) self.available_sensors.append(full_name) # Set temperature threshold if a custom one is set if temp_thresh is not None: if int(temp_thresh) > 0: self.temp_thresh = int(temp_thresh) logging.debug("Updated custom threshold to " + str(self.temp_thresh)) self.update()
def __init__(self): self.is_available = True self.top_freq = -1 self.last_freq_list = [0] self.samples_taken = 0 self.stress_started = False try: self.last_freq_list = [0] * len(psutil.cpu_freq(True)) except AttributeError: logging.debug("cpu_freq is not available from psutil") self.is_available = False return self.update() try: # If top freq not available, take the current as top if max(self.last_freq_list) >= 0 and self.top_freq == -1: self.top_freq = max(self.last_freq_list) except ValueError: self.is_available = False Source.__init__(self)
def update(self): """ Read the latest Temperature reading. Reading for temperature might be different between systems Support for additional systems can be added here """ last_value = 0 # NOTE: Negative values might not be supported # Temperature on most common systems is in coretemp last_value = 0 if self.custom_temp is not None: # Use the manual sensor try: sensors_info = self.custom_temp.split(",") sensor_major = sensors_info[0] sensor_minor = sensors_info[1] logging.debug("Major" + str(sensor_major) + "Minor" + str(sensor_minor)) last_value = psutil.sensors_temperatures()[sensor_major][int( sensor_minor)].current except: self.is_available = False logging.debug("Illegal sensor") self.last_temp = 1 else: # Choose out a list of known sensors if last_value <= 0: try: last_value = psutil.sensors_temperatures( )['coretemp'][0].current except: last_value = 0 # Support for Ryzen 1700X if last_value <= 0: try: last_value = psutil.sensors_temperatures( )['k10temp'][0].current except: last_value = 0 # Support for Ryzen 7 + asus if last_value <= 0: try: last_value = psutil.sensors_temperatures( )['it8655'][0].current except: last_value = 0 # Support for specific systems if last_value <= 0: try: last_value = psutil.sensors_temperatures( )['it8622'][0].current except: last_value = 0 # Support for specific systems if last_value <= 0: try: last_value = psutil.sensors_temperatures( )['it8721'][0].current except: last_value = 0 # Raspberry pi 3 running Ubuntu 16.04 if last_value <= 0: try: last_value = psutil.sensors_temperatures( )['bcm2835_thermal'][0].current except: last_value = 0 # Raspberry pi + raspiban CPU temp if last_value <= 0: try: last_value = os.popen( 'cat /sys/class/thermal/thermal_zone0/temp 2> /dev/null' ).read() logging.info("Recorded temp " + last_value) last_value = int(last_value) / 1000 except: last_value = 0 # Fall back for most single processor systems # Take the first value of the first processor if last_value <= 0: try: temperatures = psutil.sensors_temperatures() chips = list(temperatures.keys()) last_value = temperatures[chips[0]][0].current except: last_value = 0 # self.cpu_temp = self.append_latest_value(self.cpu_temp, last_value) # Update max temp try: if int(last_value) > int(self.max_temp): self.max_temp = last_value except: self.max_temp = 0 self.last_temp = last_value # Run base update routines Source.update(self)
def update_func(sensor, idx): sample = psutil.sensors_temperatures() last_value = sample[sensor][idx].current update_max_temp(last_value) self.last_temp = last_value Source.update(self)
def update(): last_value = psutil.sensors_temperatures( )['bcm2835_thermal'][0].current update_max_temp(last_value) self.last_temp = last_value Source.update(self)
def update(): last_value = psutil.sensors_temperatures()['it8721'][0].current update_max_temp(last_value) self.last_temp = last_value Source.update(self)