Centralize default trace location
This commit is contained in:
parent
078ebc411a
commit
1eacc66c97
7 changed files with 69 additions and 23 deletions
|
@ -22,8 +22,7 @@ from tracetools_launch.action import Trace
|
|||
def generate_launch_description():
|
||||
return LaunchDescription([
|
||||
Trace(
|
||||
session_name='my-tracing-session',
|
||||
base_path='/tmp'),
|
||||
session_name='my-tracing-session'),
|
||||
Node(
|
||||
package='tracetools_test',
|
||||
node_executable='test_ping',
|
||||
|
|
|
@ -24,6 +24,7 @@ from launch.event_handlers import OnShutdown
|
|||
from launch.launch_context import LaunchContext
|
||||
from tracetools_trace.tools import lttng
|
||||
from tracetools_trace.tools import names
|
||||
from tracetools_trace.tools import path
|
||||
|
||||
|
||||
class Trace(Action):
|
||||
|
@ -37,7 +38,7 @@ class Trace(Action):
|
|||
self,
|
||||
*,
|
||||
session_name: str,
|
||||
base_path: str = '/tmp',
|
||||
base_path: str = path.DEFAULT_BASE_PATH,
|
||||
events_ust: List[str] = names.DEFAULT_EVENTS_ROS,
|
||||
events_kernel: List[str] = names.DEFAULT_EVENTS_KERNEL,
|
||||
**kwargs,
|
||||
|
@ -46,13 +47,13 @@ class Trace(Action):
|
|||
Constructor.
|
||||
|
||||
:param session_name: the name of the tracing session
|
||||
:param base_path: the base directory in which to create the trace directory
|
||||
:param base_path: the path to the base directory in which to create the tracing session directory
|
||||
:param events_ust: the list of ROS UST events to enable
|
||||
:param events_kernel: the list of kernel events to enable
|
||||
"""
|
||||
super().__init__(**kwargs)
|
||||
self.__session_name = session_name
|
||||
self.__path = os.path.join(base_path, session_name)
|
||||
self.__base_path = base_path
|
||||
self.__events_ust = events_ust
|
||||
self.__events_kernel = events_kernel
|
||||
|
||||
|
@ -65,7 +66,7 @@ class Trace(Action):
|
|||
def _setup(self) -> None:
|
||||
lttng.lttng_init(
|
||||
self.__session_name,
|
||||
self.__path,
|
||||
self.__base_path,
|
||||
ros_events=self.__events_ust,
|
||||
kernel_events=self.__events_kernel)
|
||||
|
||||
|
@ -76,7 +77,7 @@ class Trace(Action):
|
|||
return (
|
||||
"Trace("
|
||||
f"session_name='{self.__session_name}', "
|
||||
f"path='{self.__path}', "
|
||||
f"base_path='{self.__base_path}', "
|
||||
f"num_events_ust={len(self.__events_ust)}, "
|
||||
f"num_events_kernel={len(self.__events_kernel)})"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue