[modules/cpu] Add initial version of CPU utilization module

Re-enable the CPU utilization module as proof-of-concept for the new
core engine.

see #23
This commit is contained in:
Tobi-wan Kenobi 2016-12-04 17:45:42 +01:00
parent 8855f1155b
commit aacc56a4e2
9 changed files with 85 additions and 10 deletions

18
bumblebee/modules/cpu.py Normal file
View file

@ -0,0 +1,18 @@
# pylint: disable=C0111,R0903
"""Displays CPU utilization across all CPUs."""
import psutil
import bumblebee.engine
class Module(bumblebee.engine.Module):
def __init__(self, engine):
super(Module, self).__init__(engine)
self._utilization = psutil.cpu_percent(percpu=False)
def widgets(self):
self._utilization = psutil.cpu_percent(percpu=False)
return bumblebee.output.Widget(full_text="{:05.02f}%".format(self._utilization))
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4