No description
Find a file
Christophe Bedard a510cd8b4c Merge branch 'ci-set-distro-to-rolling' into 'master'
Change CI variable to use rolling instead of galactic for latest state

See merge request micro-ROS/ros_tracing/tracetools_analysis!82
2020-08-18 21:59:12 +00:00
ros2trace_analysis 1.0.1 2020-06-02 18:11:41 -04:00
tracetools_analysis Make tracetools_analysis's conf.py file a standalone config 2020-06-27 10:50:58 -04:00
.gitlab-ci.yml Change CI variable to use rolling instead of galactic for latest state 2020-08-18 17:42:14 -04:00
codecov.yml Fix paths for codecov 2020-06-26 16:00:39 -04:00
get_branch.py Simplify get_branch script 2020-03-21 19:51:27 -04:00
LICENSE Add license 2019-06-24 16:44:03 +02:00
pytest.ini Add pytest.ini file to suppress pytest warnings 2020-06-21 16:46:22 -04:00
README.md Add codecov badge to README 2020-06-26 16:01:00 -04:00

tracetools_analysis

pipeline status codecov

Analysis tools for ROS 2 tracing.

Trace analysis

After generating a trace (see ros2_tracing), we can analyze it to extract useful execution data.

Commands

Since CTF traces (the output format of the LTTng tracer) are very slow to read, we first convert them into a single file which can be read much faster.

$ ros2 trace-analysis convert /path/to/trace/directory

Then we can process it to create a data model which could be queried for analysis.

$ ros2 trace-analysis process /path/to/trace/directory

Jupyter

The last command will process and output the raw data models, but to actually display results, process and analyze using a Jupyter Notebook.

$ jupyter notebook

Then navigate to the analysis/ directory, and select one of the provided notebooks, or create your own!

For example:

from tracetools_analysis import loading
from tracetools_analysis import processor
from tracetools_analysis import utils

# Load trace directory or converted trace file
events = loading.load_file('/path/to/trace/or/converted/file')

# Process
ros2_handler = processor.Ros2Handler()
cpu_handler = processor.CpuTimeHandler()

processor.Processor(ros2_handler, cpu_handler).process(events)

# Use data model utils to extract information
ros2_util = utils.ros2.Ros2DataModelUtil(ros2_handler.data)
cpu_util = utils.cpu_time.CpuTimeDataModelUtil(cpu_handler.data)

callback_durations = ros2_util.get_callback_durations()
time_per_thread = cpu_util.get_time_per_thread()
# ...

# Display, e.g. with bokeh or matplotlib
# ...

Note: bokeh has to be installed manually, e.g. with pip:

$ pip3 install bokeh

Design

See the ros2_tracing design document, especially the Goals and requirements and Analysis sections.

Packages

ros2trace_analysis

Package containing a ros2cli extension to perform trace analysis.

tracetools_analysis

Package containing tools for analyzing trace data.

See the API documentation.