ros-tracing/tracetools_analysis

RequiredEventNotFoundError: missing events: {'CpuTimeHandler': {'sched_switch'}} on humble branch

Closed this issue · 2 comments

When trying the jupyter notebook example from the README.md I get the following error:

RequiredEventNotFoundError Traceback (most recent call last)
Cell In[1], line 15
12 ros2_handler = Ros2Handler()
13 cpu_handler = CpuTimeHandler()
---> 15 Processor(ros2_handler, cpu_handler).process(events)
17 # Use data model utils to extract information
18 # ros2_util = Ros2DataModelUtil(ros2_handler.data)
19 # cpu_util = CpuTimeDataModelUtil(cpu_handler.data)
(...)
30
31 # print(time_per_thread)

File ~/tracetools_analysis/tracetools_analysis/tracetools_analysis/processor/init.py:417, in Processor.process(self, events, erase_progress, no_required_events_check)
409 """
410 Process all events.
411
(...)
414 :param no_required_events_check: whether to skip the check for required events
415 """
416 if not no_required_events_check:
--> 417 self._check_required_events(events)
419 if not self._processing_done:
420 # Split into two versions so that performance is optimal
421 if self._progress_display is None:

File ~/tracetools_analysis/tracetools_analysis/tracetools_analysis/processor/init.py:399, in Processor._check_required_events(self, events)
397 missing_events[handler.class.name].add(name)
398 if missing_events:
--> 399 raise self.RequiredEventNotFoundError(
400 f'missing events: {dict(missing_events)}'
401 )

RequiredEventNotFoundError: missing events: {'CpuTimeHandler': {'sched_switch'}}

I am on branch humble and generated the trace with the example launch file in ros2_tracing (converted file attached as txt due to github limitations:

converted.txt

If you want to use CpuTimeHandler, you need to enable kernel tracing and enable the sched_switch event, which is what the error message says. See:

Otherwise, you can try to run that example without the Cpu* stuff. Or use of this as an example: https://github.com/ros-tracing/tracetools_analysis/blob/rolling/tracetools_analysis/analysis/callback_duration.ipynb.

Ok thank you!