mirror of https://github.com/nicolargo/glances.git
Fix quicklook in case psutil.cpu_freq().max=0.0
This commit is contained in:
parent
7b22761c75
commit
bd246fe966
|
|
@ -84,7 +84,7 @@ class CpuPercent:
|
|||
self.cpu_info['cpu_hz_current'] = cpu_freq.current
|
||||
else:
|
||||
self.cpu_info['cpu_hz_current'] = None
|
||||
if hasattr(cpu_freq, 'max'):
|
||||
if hasattr(cpu_freq, 'max') and cpu_freq.max != 0.0:
|
||||
self.cpu_info['cpu_hz'] = cpu_freq.max
|
||||
else:
|
||||
self.cpu_info['cpu_hz'] = None
|
||||
|
|
|
|||
|
|
@ -205,12 +205,18 @@ class QuicklookPlugin(GlancesPluginModel):
|
|||
if (
|
||||
'cpu_hz_current' in self.stats
|
||||
and self.stats['cpu_hz_current'] is not None
|
||||
and 'cpu_hz' in self.stats
|
||||
and self.stats['cpu_hz'] is not None
|
||||
):
|
||||
msg_freq = ' {:.2f}/{:.2f}GHz'.format(
|
||||
self._hz_to_ghz(self.stats['cpu_hz_current']), self._hz_to_ghz(self.stats['cpu_hz'])
|
||||
)
|
||||
if (
|
||||
'cpu_hz' in self.stats
|
||||
and self.stats['cpu_hz'] is not None
|
||||
):
|
||||
msg_freq = ' {:.2f}/{:.2f}GHz'.format(
|
||||
self._hz_to_ghz(self.stats['cpu_hz_current']), self._hz_to_ghz(self.stats['cpu_hz'])
|
||||
)
|
||||
else:
|
||||
msg_freq = ' {:.2f}GHz'.format(
|
||||
self._hz_to_ghz(self.stats['cpu_hz_current'])
|
||||
)
|
||||
else:
|
||||
msg_freq = ''
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue