installed ros2 tracing

This commit is contained in:
Niklas Halle 2025-04-29 09:31:19 +02:00
parent 4e7c63701a
commit 40a5d3653c
19 changed files with 74617 additions and 75507 deletions

View file

@ -11,7 +11,16 @@
"runArgs": [
"--privileged", // for real-time access
"--cap-add=sys_nice",
"--ulimit", "rtprio=99" // for real-time access
"--cap-add=SYS_ADMIN",
"--cap-add=SYS_PTRACE",
"--ulimit", "rtprio=99", // for real-time access
// explicitly mount /sys and /dev to allow access to the host's devices
// and system information
"--mount", "type=bind,source=/sys,target=/sys",
"--mount", "type=bind,source=/dev,target=/dev",
// mount /lib/modules and /usr/lib/modules to allow access to the host's kernel modules
"--mount", "type=bind,source=/lib/modules,target=/lib/modules",
"--mount", "type=bind,source=/usr/lib/modules,target=/usr/lib/modules"
],
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
@ -22,6 +31,9 @@
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",
// Uncomment the next line to run commands after the container is created and started.
"postStartCommand": "sudo modprobe lttng-tracer && sudo modprobe lttng-ring-buffer-client-discard && sudo modprobe lttng-probe-sched && sudo modprobe lttng-probe-irq && sudo modprobe lttng-probe-timer && (sudo lttng-sessiond --daemonize || true)",
// Configure tool-specific properties.
"customizations": {
"vscode": {

4
.gitignore vendored
View file

@ -70,8 +70,8 @@ AMENT_IGNORE
## custom stuff
# python 3.10 venv
venv310/
# python venv
venv*/
# analysis output dir
analysis/

6
.gitmodules vendored
View file

@ -1,3 +1,9 @@
[submodule "src/ros_edf"]
path = src/ros_edf
url = git@git.niklashalle.net:niklas/ROS-Dynamic-Executor.git
[submodule "src/tools/ros2_tracing"]
path = src/tools/ros2_tracing
url = git@gitlab.com:ros-tracing/ros2_tracing.git
[submodule "src/tools/tracetools_analysis"]
path = src/tools/tracetools_analysis
url = git@gitlab.com:ros-tracing/tracetools_analysis.git

View file

@ -11,6 +11,21 @@ LABEL maintainer="Niklas Halle <niklas@niklashalle.net>"
ENV PIP_BREAK_SYSTEM_PACKAGES=1
ENV DEBIAN_FRONTEND=noninteractive
# User and group IDs
ARG USERNAME=dev
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
# Set the default shell to bash for RUN commands
# This ensures all RUN commands use bash instead of sh
SHELL ["/bin/bash", "-c"]
@ -30,10 +45,11 @@ RUN apt-get update && \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install -y \
python3.10 \
python3.10-venv \
python3.10-dev \
python3.10-distutils \
python3.8 \
python3.8-venv \
python3.8-dev \
python3.8-distutils \
nlohmann-json3-dev \
curl && \
rm -rf /var/lib/apt/lists/*
@ -47,14 +63,14 @@ RUN apt-get update -q && \
# This ensures that ROS 2 commands are available in the shell
# rosdep is a tool for installing system dependencies for ROS packages
RUN rosdep update && \
grep -F "source /opt/ros/${ROS_DISTRO}/setup.bash" /root/.bashrc || echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /root/.bashrc && \
grep -F "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" /root/.bashrc || echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> /root/.bashrc
grep -F "source /opt/ros/${ROS_DISTRO}/setup.bash" /home/dev/.bashrc || echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/dev/.bashrc && \
grep -F "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" /home/dev/.bashrc || echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> /home/dev/.bashrc
# Bootstrap pip manually (recommended way)
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
RUN curl -sS https://bootstrap.pypa.io/pip/3.8/get-pip.py | python3.8
# Set Python 3.10 as default Python3
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
# Set Python 3.8 as default Python3
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
# Install modern nodejs (optional but good practice for JupyterLab widgets)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
@ -63,3 +79,14 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
# Install JupyterLab globally
RUN python3 -m pip install --upgrade jupyterlab
# Install dependencies for ros2_tracing
RUN apt-get update -q && \
apt-get install -y lttng-tools lttng-modules-dkms liblttng-ust-dev
RUN apt-get install -y python3-babeltrace python3-lttng python3-pytest
# Add user to the "tracing" group
RUN usermod -aG tracing $USERNAME
# [Optional] Set the default user. Omit if you want to keep the default as root.
USER $USERNAME

View file

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@ -27,9 +27,17 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Experiment file not found: /workspaces/ROS-Dynamic-Executor-Experiments/results/existing_system_monitor/uas_edf.json\n"
]
}
],
"source": [
"#experiment_folder = \"casestudy_example\"\n",
"#experiment_name = \"cs_example_edf\"\n",
@ -43,9 +51,22 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "FileNotFoundError",
"evalue": "[Errno 2] No such file or directory: '/workspaces/ROS-Dynamic-Executor-Experiments/results/existing_system_monitor/uas_edf.json'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[4], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28;43mopen\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mexperiment_file\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mas\u001b[39;00m f:\n\u001b[1;32m 2\u001b[0m experiment_data_raw \u001b[38;5;241m=\u001b[39m json\u001b[38;5;241m.\u001b[39mload(f)\n",
"File \u001b[0;32m/workspaces/ROS-Dynamic-Executor-Experiments/venv310/lib/python3.10/site-packages/IPython/core/interactiveshell.py:324\u001b[0m, in \u001b[0;36m_modified_open\u001b[0;34m(file, *args, **kwargs)\u001b[0m\n\u001b[1;32m 317\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m file \u001b[38;5;129;01min\u001b[39;00m {\u001b[38;5;241m0\u001b[39m, \u001b[38;5;241m1\u001b[39m, \u001b[38;5;241m2\u001b[39m}:\n\u001b[1;32m 318\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 319\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mIPython won\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mt let you open fd=\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mfile\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m by default \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 320\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mas it is likely to crash IPython. If you know what you are doing, \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 321\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124myou can use builtins\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m open.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 322\u001b[0m )\n\u001b[0;32m--> 324\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mio_open\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfile\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: '/workspaces/ROS-Dynamic-Executor-Experiments/results/existing_system_monitor/uas_edf.json'"
]
}
],
"source": [
"with open(experiment_file) as f:\n",
" experiment_data_raw = json.load(f)"
@ -53,7 +74,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": null,
"metadata": {},
"outputs": [
{
@ -95,7 +116,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@ -142,7 +163,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"metadata": {},
"outputs": [
{
@ -160,7 +181,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": null,
"metadata": {},
"outputs": [
{
@ -205,7 +226,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@ -227,7 +248,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": null,
"metadata": {},
"outputs": [
{

File diff suppressed because it is too large Load diff

View file

@ -9,38 +9,38 @@ Callback Execution Report:
experiment_parameters//node_0 (chain:0 end)
Calls: 499
Avg time: 19848.2 µs
Min time: 16832 µs
Max time: 40185 µs
Total time: 9904264 µs
Avg time: 32168.5 µs
Min time: 17109 µs
Max time: 70873 µs
Total time: 16052061 µs
experiment_parameters//node_2 (chain:1 end)
Calls: 499
Avg time: 24434 µs
Min time: 20683 µs
Max time: 59658 µs
Total time: 12192560 µs
Avg time: 37592.9 µs
Min time: 21208 µs
Max time: 75984 µs
Total time: 18758862 µs
experiment_parameters//parameter_events (chain:0)
Calls: 1
Avg time: 185 µs
Min time: 185 µs
Max time: 185 µs
Total time: 185 µs
Avg time: 77 µs
Min time: 77 µs
Max time: 77 µs
Total time: 77 µs
experiment_parameters/timer_100ms (chain:0 start)
Calls: 500
Avg time: 11759.7 µs
Min time: 8683 µs
Max time: 23513 µs
Total time: 5879840 µs
Avg time: 17089.5 µs
Min time: 8469 µs
Max time: 38304 µs
Total time: 8544739 µs
experiment_parameters/timer_100ms (chain:1 start)
Calls: 500
Avg time: 16964.2 µs
Min time: 13176 µs
Max time: 32020 µs
Total time: 8482083 µs
Avg time: 25604.1 µs
Min time: 12897 µs
Max time: 55585 µs
Total time: 12802033 µs

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,11 @@
#!/bin/bash
# Creates and sets up your Python 3.10 venv
python3.10 -m venv venv310
source venv310/bin/activate
# Creates and sets up your Python 3.8 venv
python3.8 -m venv venv38 --system-site-packages --symlinks
source venv38/bin/activate
# Make sure colcon doesn't try to index the venv310 directory
touch venv310/COLCON_IGNORE
touch venv38/COLCON_IGNORE
# Install Python packages
pip install --upgrade pip
@ -19,13 +19,7 @@ pip install \
jupyterlab-widgets \
ipykernel
pip3 install --upgrade pytest colcon-common-extensions setuptools
# Register venv310 as Jupyter kernel
python -m ipykernel install --user --name=venv310 --display-name="Python 3.10 (venv310)"
pip install --upgrade pytest colcon-common-extensions setuptools
# Make sure the venv310 is activated when starting a new shell
echo "source /workspaces/ROS-Dynamic-Executor-Experiments/venv310/bin/activate" >> /root/.bashrc
echo "Setup complete! Activate with: source venv310/bin/activate"
echo "Then start JupyterLab with: jupyter lab --ip=0.0.0.0 --port=8888 --allow-root"
echo "source /workspaces/ROS-Dynamic-Executor-Experiments/venv38/bin/activate" >> /root/.bashrc

1
src/ros2trace Symbolic link
View file

@ -0,0 +1 @@
tools/ros2_tracing/ros2trace

1
src/ros2trace_analysis Symbolic link
View file

@ -0,0 +1 @@
tools/tracetools_analysis/ros2trace_analysis

@ -0,0 +1 @@
Subproject commit 449a0123fd12032519ca6bea2209cc0505304771

@ -0,0 +1 @@
Subproject commit 18577974cf842b4f35bf0d22611695dcddb30f6d

1
src/tracetools Symbolic link
View file

@ -0,0 +1 @@
tools/ros2_tracing/tracetools

1
src/tracetools_analysis Symbolic link
View file

@ -0,0 +1 @@
tools/tracetools_analysis/tracetools_analysis

1
src/tracetools_launch Symbolic link
View file

@ -0,0 +1 @@
tools/ros2_tracing/tracetools_launch

1
src/tracetools_read Symbolic link
View file

@ -0,0 +1 @@
tools/ros2_tracing/tracetools_read

1
src/tracetools_test Symbolic link
View file

@ -0,0 +1 @@
tools/ros2_tracing/tracetools_test

1
src/tracetools_trace Symbolic link
View file

@ -0,0 +1 @@
tools/ros2_tracing/tracetools_trace