Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions sysmonitor_common/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ class NvGPUSensor(BaseSensor):

def get_value(self, sensor):
if sensor == 'nvgpu':
return "{:02.0f}%".format(self._fetch_gpu())
return "{:.0f}%".format(self._fetch_gpu())

def _fetch_gpu(self):
try:
Expand All @@ -388,7 +388,7 @@ class AmdGpuSensor(BaseSensor):

def get_value(self, sensor):
if sensor == 'amdgpu':
return "{:02.0f}%".format(self._fetch_gpu())
return "{:.0f}%".format(self._fetch_gpu())

def _fetch_gpu(self):
result = subprocess.check_output(['cat', '/sys/class/drm/card0/device/gpu_busy_percent'])
Expand All @@ -401,7 +401,7 @@ class AmdGpu1Sensor(BaseSensor):

def get_value(self, sensor):
if sensor == 'amdgpu':
return "{:02.0f}%".format(self._fetch_gpu())
return "{:.0f}%".format(self._fetch_gpu())

def _fetch_gpu(self):
result = subprocess.check_output(['cat', '/sys/class/drm/card1/device/gpu_busy_percent'])
Expand Down Expand Up @@ -473,10 +473,10 @@ def check(self, sensor):

def get_value(self, sensor):
if sensor == 'cpu':
return "{:02.0f}%".format(self._fetch_cpu())
return "{:.0f}%".format(self._fetch_cpu())
elif CPUSensor.cpus.match(sensor):
cpus = self._fetch_cpu(percpu=True)
return "{:02.0f}%".format(cpus[int(sensor[3:])])
return "{:.0f}%".format(cpus[int(sensor[3:])])

return None

Expand All @@ -498,7 +498,7 @@ class MemSensor(BaseSensor):
desc = _('Physical memory in use.')

def get_value(self, sensor_data):
return '{:02.0f}%'.format(self._fetch_mem())
return '{:.0f}%'.format(self._fetch_mem())

def _fetch_mem(self):
"""It gets the total memory info and return the used in percent."""
Expand Down Expand Up @@ -670,7 +670,7 @@ def check(self, sensor):
def get_value(self, sensor):
if BatSensor.bat.match(sensor):
bat_id = int(sensor[3:]) if len(sensor) > 3 else 0
return '{:02.0f}%'.format(self._fetch_bat(bat_id))
return '{:.0f}%'.format(self._fetch_bat(bat_id))

return None

Expand Down Expand Up @@ -728,7 +728,7 @@ class SwapSensor(BaseSensor):
desc = _("Average swap usage")

def get_value(self, sensor):
return '{:02.0f}%'.format(self._fetch_swap())
return '{:.0f}%'.format(self._fetch_swap())

def _fetch_swap(self):
"""Return the swap usage in percent"""
Expand Down Expand Up @@ -845,9 +845,9 @@ def get_value(self, sensor):
# degrees symbol is unicode U+00B0

if self.fahrenheit:
return "{:02.0f}\u00B0F".format(self._fetch_cputemp())
return "{:.0f}\u00B0F".format(self._fetch_cputemp())
else:
return "{:02.0f}\u00B0C".format(self._fetch_cputemp())
return "{:.0f}\u00B0C".format(self._fetch_cputemp())

def _fetch_cputemp(self):
# http://www.mjmwired.net/kernel/Documentation/hwmon/sysfs-interface
Expand Down