@cryptotaxi247 / netdata-1 / commits / e643c3e7b

"cpuidle" module fixes

lgz committed Oct 13, 2017 at 17:50 UTC e643c3e7b0a115fcd2965892bb0fe83214347922
1 file changed +5 -18
python.d/cpuidle.chart.py
+5 -18
@@ -14,6 +14,7 @@ syscall = ctypes.CDLL('libc.so.6').syscall
14 # default module values (can be overridden per job in `config`)
15 # update_every = 2
16
17 +
18 class Service(SimpleService):
19 def __init__(self, configuration=None, name=None):
20 prefix = os.getenv('NETDATA_HOST_PREFIX', "")
@@ -24,11 +25,12 @@ class Service(SimpleService):
25 SimpleService.__init__(self, configuration=configuration, name=name)
26 self.order = []
27 self.definitions = {}
27 - self._orig_name = ""
28 + self.fake_name = 'cpu'
29 self.assignment = {}
30 self.last_schedstat = None
31
31 - def __gettid(self):
32 + @staticmethod
33 + def __gettid():
34 # This is horrendous. We need the *thread id* (not the *process id*),
35 # but there's no Python standard library way of doing that. If you need
36 # to enable this module on a non-x86 machine type, you'll have to find
@@ -108,8 +110,6 @@ class Service(SimpleService):
110 self.error("Cannot get thread ID. Stats would be completely broken.")
111 return False
112
111 - self._orig_name = self.chart_name
112 -
113 for path in sorted(glob.glob(self.sys_dir + '/cpu*/cpuidle/state*/name')):
114 # ['', 'sys', 'devices', 'system', 'cpu', 'cpu0', 'cpuidle', 'state3', 'name']
115 path_elem = path.split('/')
@@ -122,7 +122,7 @@ class Service(SimpleService):
122 self.order.append(orderid)
123 active_name = '%s_active_time' % (cpu,)
124 self.definitions[orderid] = {
125 - 'options': [None, 'C-state residency', 'time%', 'cpuidle', None, 'stacked'],
125 + 'options': [None, 'C-state residency', 'time%', 'cpuidle', 'cpuidle', 'stacked'],
126 'lines': [
127 [active_name, 'C0 (active)', 'percentage-of-incremental-row', 1, 1],
128 ],
@@ -146,16 +146,3 @@ class Service(SimpleService):
146
147 return True
148
149 - def create(self):
150 - self.chart_name = "cpu"
151 - status = SimpleService.create(self)
152 - self.chart_name = self._orig_name
153 - return status
154 -
155 - def update(self, interval):
156 - self.chart_name = "cpu"
157 - status = SimpleService.update(self, interval=interval)
158 - self.chart_name = self._orig_name
159 - return status
160 -
161 -# vim: set ts=4 sts=4 sw=4 et: