Cpu gadget: add compatibility with older psutil
not tested yet, will try tomorrow..but should work
This commit is contained in:
parent
7cdd484427
commit
4386c386e4
|
@ -106,10 +106,16 @@ class Gadget(e.Gadget):
|
|||
|
||||
def popups_poller_cb(self):
|
||||
# build an orderd list of all running procs (pid, name, cpu_perc, mun_t)
|
||||
self.top_procs = [ (p.pid, p.name(),
|
||||
p.cpu_percent(interval=0) / self.num_cores,
|
||||
p.num_threads())
|
||||
for p in psutil.process_iter() ]
|
||||
if psutil.version_info[0] < 2:
|
||||
self.top_procs = [ (p.pid, p.name,
|
||||
p.get_cpu_percent(interval=0) / self.num_cores,
|
||||
p.get_num_threads())
|
||||
for p in psutil.process_iter() ]
|
||||
else:
|
||||
self.top_procs = [ (p.pid, p.name(),
|
||||
p.cpu_percent(interval=0) / self.num_cores,
|
||||
p.num_threads())
|
||||
for p in psutil.process_iter() ]
|
||||
self.top_procs.sort(key=itemgetter(2), reverse=True)
|
||||
|
||||
# update all the visible genlists
|
||||
|
|
Loading…
Reference in New Issue