New code structure
[deliverable/lttng-analyses.git] / lttnganalyses / lttnganalyses / iotop.py
1 from .analysis import Analysis
2
3
4 class Iotop(Analysis):
5 def __init__(self, state, split, split_count):
6 self._state = state
7 self._split = split
8 self._split_count = split_count
9 self._ev_count = 0
10 self._tmp_ev_count = 0
11 self._buckets = []
12 self._last_reset_hello = state.hello
13
14 if not self._split:
15 self._buckets.append(0)
16
17 def process_event(self, ev):
18 self._ev_count += 1
19 self._tmp_ev_count += 1
20
21 if self._split:
22 if self._tmp_ev_count == self._split_count:
23 self._tmp_ev_count = 0
24 cur_hello_diff = self._state.hello - self._last_reset_hello
25 self._last_reset_hello = self._state.hello
26 self._buckets.append(cur_hello_diff)
27 else:
28 self._buckets[0] = self._state.hello
29
30 @property
31 def buckets(self):
32 return self._buckets
33
34 @property
35 def event_count(self):
36 return self._ev_count
This page took 0.033888 seconds and 5 git commands to generate.