Merge branch 'improve-ux' into 'master'
Improve UX See merge request micro-ROS/ros_tracing/ros2_tracing!101
This commit is contained in:
commit
1fadc93b76
4 changed files with 43 additions and 6 deletions
10
README.md
10
README.md
|
@ -42,6 +42,14 @@ By default, it will enable all ROS tracepoints and a few kernel tracepoints. The
|
||||||
|
|
||||||
### Launch file trace action
|
### 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.
|
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
|
* convert CTF traces to pickle files
|
||||||
* wrap trace events in Python `dict`
|
* wrap trace events in Python `dict`
|
||||||
* handle and process trace events to gather data
|
* 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
|
```plantuml
|
||||||
@startuml
|
@startuml
|
||||||
|
@ -633,6 +639,11 @@ tracetools_read <-- tracetools_analysis
|
||||||
pandas <--- tracetools_analysis
|
pandas <--- tracetools_analysis
|
||||||
bokeh <--- tracetools_analysis
|
bokeh <--- tracetools_analysis
|
||||||
|
|
||||||
|
package ros2trace_analysis <<Rectangle>> {
|
||||||
|
}
|
||||||
|
ros2cli <|-- ros2trace_analysis
|
||||||
|
tracetools_analysis <-- ros2trace_analysis
|
||||||
|
|
||||||
@enduml
|
@enduml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
"""Module with functions for reading traces."""
|
"""Module with functions for reading traces."""
|
||||||
|
|
||||||
|
import os
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
@ -25,6 +26,22 @@ from . import DictEvent
|
||||||
BabeltraceEvent = babeltrace.babeltrace.Event
|
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]:
|
def get_trace_ctf_events(trace_directory: str) -> Iterable[BabeltraceEvent]:
|
||||||
"""
|
"""
|
||||||
Get the events of a trace.
|
Get the events of a trace.
|
||||||
|
|
|
@ -40,26 +40,27 @@ def parse_args():
|
||||||
|
|
||||||
def add_arguments(parser):
|
def add_arguments(parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--session-name', '-s', dest='session_name',
|
'-s', '--session-name', dest='session_name',
|
||||||
default=path.append_timestamp('session'),
|
default=path.append_timestamp('session'),
|
||||||
help='the name of the tracing session (default: session-YYYYMMDDHHMMSS)')
|
help='the name of the tracing session (default: session-YYYYMMDDHHMMSS)')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--path', '-p', dest='path',
|
'-p', '--path', dest='path',
|
||||||
default=path.DEFAULT_BASE_PATH,
|
default=path.DEFAULT_BASE_PATH,
|
||||||
help='path of the base directory for trace data (default: %(default)s)')
|
help='path of the base directory for trace data (default: %(default)s)')
|
||||||
arg = parser.add_argument(
|
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) '
|
help='the ROS UST events to enable (default: all events) '
|
||||||
'[to disable all UST events, '
|
'[to disable all UST events, '
|
||||||
'provide this flag without any event name]')
|
'provide this flag without any event name]')
|
||||||
arg.completer = DefaultArgValueCompleter(arg)
|
arg.completer = DefaultArgValueCompleter(arg)
|
||||||
arg = parser.add_argument(
|
arg = parser.add_argument(
|
||||||
'--kernel', '-k', nargs='*', dest='events_kernel',
|
'-k', '--kernel', nargs='*', dest='events_kernel',
|
||||||
default=names.DEFAULT_EVENTS_KERNEL,
|
default=names.DEFAULT_EVENTS_KERNEL,
|
||||||
help='the kernel events to enable (default: all events) '
|
help='the kernel events to enable (default: all events) '
|
||||||
'[to disable all kernel events, '
|
'[to disable all kernel events, '
|
||||||
'provide this flag without any event name]')
|
'provide this flag without any event name]')
|
||||||
arg.completer = DefaultArgValueCompleter(arg)
|
arg.completer = DefaultArgValueCompleter(arg)
|
||||||
parser.add_argument(
|
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)')
|
help='display lists of enabled events (default: %(default)s)')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue