Improved documentation [WIP], cleaned up temporary functions

This commit is contained in:
Maximilian Schmeller 2022-11-07 17:46:09 +09:00
parent a1369890bf
commit 6db22c4d32
3 changed files with 344 additions and 174 deletions

View file

@ -1,6 +1,6 @@
# MA Autoware Trace Analysis
Automatically extract data dependencies and end-to-end (E2E) latencies from ROS2 trace data.
Automatically extract data dependencies and end-to-end (E2E) latencies from ROS2 trace data and source code.
## Prerequisites
* Python 3.10 or newer (this is crucial!)
@ -9,6 +9,12 @@ Automatically extract data dependencies and end-to-end (E2E) latencies from ROS2
* [Tracetools Analysis](https://gitlab.com/ros-tracing/tracetools_analysis)
* `python3-babeltrace` and `python3-lttng`, e.g. via `sudo apt install`, **for Python 3.10** (this requires either Ubuntu 22.04 or custom installation)
## Requirements for Optional Features
* `ros2_internal_dependency_analyzer` for finding intra-node dependencies via static analysis, which can then be
utilized by this tool
* `ros2 multitopic bw` for recording message sizes which can then be processed by this tool
## Installation
```shell
@ -36,7 +42,9 @@ E2E_ENABLED = True
```shell
# In the shell of your choice (choose Bash!):
# Each setting is named the same as in the notebook but prefixed by "ANA_NB_".
ANA_NB_TR_PATH="path/to/trace/dir"
# For strings, quotes have to be included IN THE VARIABLE VALUE, i.e. double quotation "'...'"
# has to be used in most cases
ANA_NB_TR_PATH="'path/to/trace/dir'"
ANA_NB_E2E_ENABLED="True"
```
@ -46,7 +54,7 @@ from the command line:
jupyter nbconvert --to notebook --execute trace-analysis.ipynb
```
nbconvert can also be called from Python directly,
read more info on nbconvert [here](https://nbconvert.readthedocs.io/en/latest/execute_api.html).
The notebook also supports invocation via [Papermill](https://papermill.readthedocs.io/en/latest/).
The output files are found in the configured output dir (default: `out/`). Inputs are processed and cached in `cache/`.
The output files are found in the configured output dir (default: `out/`).
Inputs are processed and cached in `cache/`.

View file

@ -347,3 +347,27 @@ def aggregate_e2e_paths(paths: List[List[TrPublishInstance | TrCallbackInstance]
path_cohorts[key].append(path)
return path_cohorts
def label_latency_item(item: E2EBreakdownItem):
match item.type:
case "cpu":
return f"{_repr(item.location[0])}"
case "idle":
cb_inst: TrCallbackInstance = item.location[0]
owner = cb_inst.callback_obj.owner
match owner:
case TrTimer() as tmr:
tmr: TrTimer
node_name = tmr.node.path
case TrSubscriptionObject() as sub:
sub: TrSubscriptionObject
node_name = sub.subscription.node.path
case _:
raise TypeError()
return f"{node_name}"
case "dds":
msg_inst: TrPublishInstance = item.location[0]
return f"{msg_inst.publisher.topic_name}"
case _:
return ValueError()

File diff suppressed because one or more lines are too long