mirror of
https://github.com/nicolargo/glances.git
synced 2025-01-04 07:34:49 +03:00
glances_percpu.py: use enumerate
This commit is contained in:
parent
8c30ab1942
commit
6fac3bae1f
@ -59,10 +59,9 @@ class Plugin(GlancesPlugin):
|
||||
# cpu_times_percent(percpu=True) methods
|
||||
if self.input_method == 'local':
|
||||
percpu_times_percent = psutil.cpu_times_percent(interval=0.0, percpu=True)
|
||||
cpu_number = 0
|
||||
for cputimes in percpu_times_percent:
|
||||
for cpu_number, cputimes in enumerate(percpu_times_percent):
|
||||
cpu = {'key': self.get_key(),
|
||||
'cpu_number': str(cpu_number),
|
||||
'cpu_number': cpu_number,
|
||||
'total': round(100 - cputimes.idle, 1),
|
||||
'user': cputimes.user,
|
||||
'system': cputimes.system,
|
||||
@ -83,7 +82,6 @@ class Plugin(GlancesPlugin):
|
||||
if hasattr(cputimes, 'guest_nice'):
|
||||
cpu['guest_nice'] = cputimes.guest_nice
|
||||
self.stats.append(cpu)
|
||||
cpu_number += 1
|
||||
else:
|
||||
# Update stats using SNMP
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user