Commit 1fadc93b authored by Christophe Bedard's avatar Christophe Bedard

Merge branch 'improve-ux' into 'master'

Improve UX

See merge request !101
parents cde12ea0 ce17f503
Pipeline #88810416 failed with stage
in 13 minutes and 52 seconds
......@@ -42,6 +42,14 @@ By default, it will enable all ROS tracepoints and a few kernel tracepoints. The
### Launch file trace action
Another option is to use the `Trace` action in a launch file along with your `Node` action(s).
Another option is to use the `Trace` action in a launch file along with your `Node` action(s). This way, tracing happens when launching the launch file.
```
$ ros2 launch tracetools_launch example.launch.py
```
See [this example launch file](./tracetools_launch/launch/example.launch.py) for more information.
## Design
See the [design document](./doc/design_ros_2.md).
......@@ -575,6 +575,12 @@ We could look into making analyses work on both ROS 1 and ROS 2, through a commo
* convert CTF traces to pickle files
* wrap trace events in Python `dict`
* handle and process trace events to gather data
* `ros2trace_analysis`
* provides a `ros2cli` extension with verbs
`$ ros2 trace-analysis`
* uses `tracetools_analysis` functions
`$ ros2 trace-analysis convert`
`$ ros2 trace-analysis process`
```plantuml
@startuml
......@@ -633,6 +639,11 @@ tracetools_read <-- tracetools_analysis
pandas <--- tracetools_analysis
bokeh <--- tracetools_analysis
package ros2trace_analysis <<Rectangle>> {
}
ros2cli <|-- ros2trace_analysis
tracetools_analysis <-- ros2trace_analysis
@enduml
```
......
......@@ -14,6 +14,7 @@
"""Module with functions for reading traces."""
import os
from typing import Iterable
from typing import List
......@@ -25,6 +26,22 @@ from . import DictEvent
BabeltraceEvent = babeltrace.babeltrace.Event
def is_trace_directory(path: str) -> bool:
"""
Check recursively if a path is a trace directory.
:param path: the path to check
:return: `True` if it is a trace directory, `False` otherwise
"""
path = os.path.expanduser(path)
if not os.path.isdir(path):
return False
tc = babeltrace.TraceCollection()
# Could still return an empty dict even if it is not a trace directory (recursively)
traces = tc.add_traces_recursive(path, 'ctf')
return traces is not None and len(traces) > 0
def get_trace_ctf_events(trace_directory: str) -> Iterable[BabeltraceEvent]:
"""
Get the events of a trace.
......
......@@ -40,26 +40,27 @@ def parse_args():
def add_arguments(parser):
parser.add_argument(
'--session-name', '-s', dest='session_name',
'-s', '--session-name', dest='session_name',
default=path.append_timestamp('session'),
help='the name of the tracing session (default: session-YYYYMMDDHHMMSS)')
parser.add_argument(
'--path', '-p', dest='path',
'-p', '--path', dest='path',
default=path.DEFAULT_BASE_PATH,
help='path of the base directory for trace data (default: %(default)s)')
arg = parser.add_argument(
'--ust', '-u', nargs='*', dest='events_ust', default=names.DEFAULT_EVENTS_ROS,
'-u', '--ust', nargs='*', dest='events_ust',
default=names.DEFAULT_EVENTS_ROS,
help='the ROS UST events to enable (default: all events) '
'[to disable all UST events, '
'provide this flag without any event name]')
arg.completer = DefaultArgValueCompleter(arg)
arg = parser.add_argument(
'--kernel', '-k', nargs='*', dest='events_kernel',
'-k', '--kernel', nargs='*', dest='events_kernel',
default=names.DEFAULT_EVENTS_KERNEL,
help='the kernel events to enable (default: all events) '
'[to disable all kernel events, '
'provide this flag without any event name]')
arg.completer = DefaultArgValueCompleter(arg)
parser.add_argument(
'--list', '-l', dest='list', action='store_true',
'-l', '--list', dest='list', action='store_true',
help='display lists of enabled events (default: %(default)s)')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment