Merge branch '72-setup-lttng-session-daemon' into 'master'

Start LTTng session daemon if there isn't one

Closes #72

See merge request micro-ROS/ros_tracing/ros2_tracing!155
This commit is contained in:
Christophe Bedard 2020-03-07 21:43:59 +00:00
commit 2691fae27f
2 changed files with 8 additions and 1 deletions

View file

@ -23,7 +23,6 @@ tracing_enabled:
image: $BASE_IMAGE_ID:$DISTRO image: $BASE_IMAGE_ID:$DISTRO
script: script:
- lttng --version && apt list lttng-tools liblttng-ust-dev python3-lttng python3-babeltrace - lttng --version && apt list lttng-tools liblttng-ust-dev python3-lttng python3-babeltrace
- lttng-sessiond --daemonize
- colcon build --symlink-install --event-handlers console_cohesion+ --packages-up-to $PACKAGES_LIST - colcon build --symlink-install --event-handlers console_cohesion+ --packages-up-to $PACKAGES_LIST
- . install/local_setup.sh - . install/local_setup.sh
- ./build/tracetools/status - ./build/tracetools/status

View file

@ -16,6 +16,7 @@
from distutils.version import StrictVersion from distutils.version import StrictVersion
import re import re
import subprocess
from typing import List from typing import List
from typing import Optional from typing import Optional
from typing import Set from typing import Set
@ -74,6 +75,13 @@ def setup(
:param channel_name_kernel: the kernel channel name :param channel_name_kernel: the kernel channel name
:return: the full path to the trace directory :return: the full path to the trace directory
""" """
# Check if there is a session daemon running
if lttng.session_daemon_alive() == 0:
# Otherwise spawn one without doing any error checks
subprocess.run(
['lttng-sessiond', '--daemonize'],
)
# Convert lists to sets # Convert lists to sets
if not isinstance(ros_events, set): if not isinstance(ros_events, set):
ros_events = set(ros_events) ros_events = set(ros_events)