Add logs for trace action init and fini

This commit is contained in:
Christophe Bedard 2019-07-03 09:00:02 +02:00 committed by Christophe Bedard
parent c2776febad
commit 2e9b2b7ee8
3 changed files with 15 additions and 4 deletions

View file

@ -15,6 +15,7 @@
"""Interface for tracing with LTTng."""
from typing import List
from typing import Optional
try:
from . import lttng_impl
@ -38,7 +39,7 @@ def lttng_init(
ros_events: List[str] = DEFAULT_EVENTS_ROS,
kernel_events: List[str] = DEFAULT_EVENTS_KERNEL,
context_names: List[str] = DEFAULT_CONTEXT,
) -> None:
) -> Optional[str]:
"""
Set up and start LTTng session.
@ -47,9 +48,11 @@ def lttng_init(
:param ros_events: list of ROS events to enable
:param kernel_events: list of kernel events to enable
:param context_names: list of context elements to enable
:return: the full path to the trace directory
"""
_lttng.setup(session_name, base_path, ros_events, kernel_events, context_names)
trace_directory = _lttng.setup(session_name, base_path, ros_events, kernel_events, context_names)
_lttng.start(session_name)
return trace_directory
def lttng_fini(

View file

@ -15,6 +15,7 @@
"""Implementation of the interface for tracing with LTTng."""
from typing import List
from typing import Optional
import lttng
@ -33,7 +34,7 @@ def setup(
context_names: List[str] = DEFAULT_CONTEXT,
channel_name_ust: str = 'ros2',
channel_name_kernel: str = 'kchan',
) -> None:
) -> Optional[str]:
"""
Set up LTTng session, with events and context.
@ -46,6 +47,7 @@ def setup(
:param context_names: list of context elements to enable
:param channel_name_ust: the UST channel name
:param channel_name_kernel: the kernel channel name
:return: the full path to the trace directory
"""
# Resolve full tracing directory path
full_path = get_full_session_path(session_name, base_path=base_path)
@ -113,6 +115,8 @@ def setup(
enabled_handles = [h for h in [handle_ust, handle_kernel] if h is not None]
_add_context(enabled_handles, context_list)
return full_path
def start(
session_name: str,