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": [ "runArgs": [
"--privileged", // for real-time access "--privileged", // for real-time access
"--cap-add=sys_nice", "--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 to add to the dev container. More info: https://containers.dev/features.
// "features": {}, // "features": {},
@ -22,6 +31,9 @@
// Uncomment the next line to run commands after the container is created. // Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release", // "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. // Configure tool-specific properties.
"customizations": { "customizations": {
"vscode": { "vscode": {

4
.gitignore vendored
View file

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

6
.gitmodules vendored
View file

@ -1,3 +1,9 @@
[submodule "src/ros_edf"] [submodule "src/ros_edf"]
path = src/ros_edf path = src/ros_edf
url = git@git.niklashalle.net:niklas/ROS-Dynamic-Executor.git 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 PIP_BREAK_SYSTEM_PACKAGES=1
ENV DEBIAN_FRONTEND=noninteractive 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 # Set the default shell to bash for RUN commands
# This ensures all RUN commands use bash instead of sh # This ensures all RUN commands use bash instead of sh
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
@ -30,10 +45,11 @@ RUN apt-get update && \
add-apt-repository ppa:deadsnakes/ppa && \ add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \ apt-get update && \
apt-get install -y \ apt-get install -y \
python3.10 \ python3.8 \
python3.10-venv \ python3.8-venv \
python3.10-dev \ python3.8-dev \
python3.10-distutils \ python3.8-distutils \
nlohmann-json3-dev \
curl && \ curl && \
rm -rf /var/lib/apt/lists/* 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 # This ensures that ROS 2 commands are available in the shell
# rosdep is a tool for installing system dependencies for ROS packages # rosdep is a tool for installing system dependencies for ROS packages
RUN rosdep update && \ 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 /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" /root/.bashrc || echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> /root/.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) # 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 # Set Python 3.8 as default Python3
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
# Install modern nodejs (optional but good practice for JupyterLab widgets) # Install modern nodejs (optional but good practice for JupyterLab widgets)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ 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 # Install JupyterLab globally
RUN python3 -m pip install --upgrade jupyterlab 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": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -16,7 +16,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -27,9 +27,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 3,
"metadata": {}, "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": [ "source": [
"#experiment_folder = \"casestudy_example\"\n", "#experiment_folder = \"casestudy_example\"\n",
"#experiment_name = \"cs_example_edf\"\n", "#experiment_name = \"cs_example_edf\"\n",
@ -43,9 +51,22 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 4,
"metadata": {}, "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": [ "source": [
"with open(experiment_file) as f:\n", "with open(experiment_file) as f:\n",
" experiment_data_raw = json.load(f)" " experiment_data_raw = json.load(f)"
@ -53,7 +74,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -95,7 +116,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -142,7 +163,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -160,7 +181,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -205,7 +226,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -227,7 +248,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "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) experiment_parameters//node_0 (chain:0 end)
Calls: 499 Calls: 499
Avg time: 19848.2 µs Avg time: 32168.5 µs
Min time: 16832 µs Min time: 17109 µs
Max time: 40185 µs Max time: 70873 µs
Total time: 9904264 µs Total time: 16052061 µs
experiment_parameters//node_2 (chain:1 end) experiment_parameters//node_2 (chain:1 end)
Calls: 499 Calls: 499
Avg time: 24434 µs Avg time: 37592.9 µs
Min time: 20683 µs Min time: 21208 µs
Max time: 59658 µs Max time: 75984 µs
Total time: 12192560 µs Total time: 18758862 µs
experiment_parameters//parameter_events (chain:0) experiment_parameters//parameter_events (chain:0)
Calls: 1 Calls: 1
Avg time: 185 µs Avg time: 77 µs
Min time: 185 µs Min time: 77 µs
Max time: 185 µs Max time: 77 µs
Total time: 185 µs Total time: 77 µs
experiment_parameters/timer_100ms (chain:0 start) experiment_parameters/timer_100ms (chain:0 start)
Calls: 500 Calls: 500
Avg time: 11759.7 µs Avg time: 17089.5 µs
Min time: 8683 µs Min time: 8469 µs
Max time: 23513 µs Max time: 38304 µs
Total time: 5879840 µs Total time: 8544739 µs
experiment_parameters/timer_100ms (chain:1 start) experiment_parameters/timer_100ms (chain:1 start)
Calls: 500 Calls: 500
Avg time: 16964.2 µs Avg time: 25604.1 µs
Min time: 13176 µs Min time: 12897 µs
Max time: 32020 µs Max time: 55585 µs
Total time: 8482083 µs Total time: 12802033 µs

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
# Creates and sets up your Python 3.10 venv # Creates and sets up your Python 3.8 venv
python3.10 -m venv venv310 python3.8 -m venv venv38 --system-site-packages --symlinks
source venv310/bin/activate source venv38/bin/activate
# Make sure colcon doesn't try to index the venv310 directory # Make sure colcon doesn't try to index the venv310 directory
touch venv310/COLCON_IGNORE touch venv38/COLCON_IGNORE
# Install Python packages # Install Python packages
pip install --upgrade pip pip install --upgrade pip
@ -19,13 +19,7 @@ pip install \
jupyterlab-widgets \ jupyterlab-widgets \
ipykernel ipykernel
pip3 install --upgrade pytest colcon-common-extensions setuptools pip 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)"
# Make sure the venv310 is activated when starting a new shell # Make sure the venv310 is activated when starting a new shell
echo "source /workspaces/ROS-Dynamic-Executor-Experiments/venv310/bin/activate" >> /root/.bashrc echo "source /workspaces/ROS-Dynamic-Executor-Experiments/venv38/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"

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