Start a session daemon if there isn't one before setting up tracing

Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
This commit is contained in:
Christophe Bedard 2020-03-07 16:04:51 -05:00
parent e47e3f2663
commit e2893201b0

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)