diff options
Diffstat (limited to 'resources/tools/telemetry/bundle_bpf.py')
-rw-r--r-- | resources/tools/telemetry/bundle_bpf.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/resources/tools/telemetry/bundle_bpf.py b/resources/tools/telemetry/bundle_bpf.py index c376da9d63..58cfd5d0b6 100644 --- a/resources/tools/telemetry/bundle_bpf.py +++ b/resources/tools/telemetry/bundle_bpf.py @@ -52,12 +52,15 @@ class BundleBpf: self.obj = BPF(text=self.code) - def attach(self, duration): + + def attach(self, sample_period): """ Attach events to BPF. - :param duration: Trial duration. - :type duration: int + :param sample_period: A "sampling" event is one that generates + an overflow notification every N events, where N is given by + sample_period. + :type sample_period: int """ try: for event in self.events: @@ -65,15 +68,16 @@ class BundleBpf: ev_type=event[u"type"], ev_config=event[u"name"], fn_name=event[u"target"], - sample_period=duration + sample_period=sample_period ) except AttributeError: - getLogger("console_stderr").error(u"Could not attach BPF events!") + getLogger("console_stderr").error(f"Could not attach BPF event: " + f"{event[u'name']}") sys.exit(Constants.err_linux_attach) def detach(self): """ - Dettach events from BPF. + Detach events from BPF. """ try: for event in self.events: @@ -98,6 +102,9 @@ class BundleBpf: for _, metric_list in self.metrics.items(): for metric in metric_list: + if table_name != metric[u"name"]: + table_name = metric[u"name"] + text += f"{table_name}\n" for (key, val) in self.obj.get_table(metric[u"name"]).items(): item = dict() labels = dict() |