Skip to content

Commit

Permalink
feat: add feature to record multi-host system (#163)
Browse files Browse the repository at this point in the history
* check lttng session

Signed-off-by: ymski <[email protected]>

* fix terminate order

Signed-off-by: ymski <[email protected]>

* changed to be able to loads multiple trace data

Signed-off-by: ymski <[email protected]>

* Added message to check_ctf for loading multiple trace data. Verification of multiple trace data is not possible with CARET.

Signed-off-by: ymski <[email protected]>

* fix: modify method to verify the existence of an active lttng session

Signed-off-by: ymski <[email protected]>

* remove unnecessary options

Signed-off-by: ymski <[email protected]>

* remove unused funtions

Signed-off-by: ymski <[email protected]>

* fix: remove type annotations for which no use case exists

Signed-off-by: ymski <[email protected]>

* fix: fix validate option when passing single data

Signed-off-by: ymski <[email protected]>

---------

Signed-off-by: ymski <[email protected]>
  • Loading branch information
ymski authored May 10, 2024
1 parent d2240f1 commit 0bf9117
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 172 deletions.
58 changes: 0 additions & 58 deletions ros2caret/verb/callback_graph.py

This file was deleted.

53 changes: 0 additions & 53 deletions ros2caret/verb/chain_latency.py

This file was deleted.

5 changes: 4 additions & 1 deletion ros2caret/verb/check_ctf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CheckCTFVerb(VerbExtension):

def add_arguments(self, parser, cli_name):
parser.add_argument(
'trace_dir', type=str,
'trace_dir', type=str, nargs='+',
help='the path to the trace directory to be checked')
parser.add_argument(
'-m', '--max_callback_construction_order_on_path_searching',
Expand All @@ -40,6 +40,9 @@ def add_arguments(self, parser, cli_name):
)

def main(self, *, args):
if len(args.trace_dir) >= 2:
print('Validating multiple trace data is not supported.')
exit(0)
try:
if args.max_callback_construction_order_on_path_searching >= 0:
Lttng(args.trace_dir)
Expand Down
4 changes: 2 additions & 2 deletions ros2caret/verb/create_architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CreateArchitectureVerb(VerbExtension):

def add_arguments(self, parser, cli_name):
parser.add_argument(
'trace_dir', type=str,
'trace_dir', type=str, nargs='+',
help='the path to the main trace directory'
)
parser.add_argument(
Expand Down Expand Up @@ -92,7 +92,7 @@ class CreateArchitecture:

def __init__(
self,
trace_dir: str,
trace_dir: list[str],
max_callback_construction_order_on_path_searching: int,
architecture: Optional[Architecture] = None
) -> None:
Expand Down
49 changes: 0 additions & 49 deletions ros2caret/verb/message_flow.py

This file was deleted.

2 changes: 1 addition & 1 deletion ros2caret/verb/node_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class NodeSummaryVerb(VerbExtension):

def add_arguments(self, parser, cli_name):
parser.add_argument(
'trace_dir', type=str,
'trace_dir', type=str, nargs='+',
help='the path to the trace directory'
)
parser.add_argument(
Expand Down
9 changes: 8 additions & 1 deletion ros2caret/verb/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ def main(self, *, args):
context_names = names.DEFAULT_CONTEXT
events_kernel = []

# check lttng session exist
command = "lttng list | grep --quiet \'\\[active\\]\'"
ps = subprocess.run(command, shell=True)
if ps.returncode == 0:
print('LTTng session is already active.')
exit(0)

rclpy.init()
node = CaretSessionNode()

Expand Down Expand Up @@ -229,12 +236,12 @@ def _run():

def _fini():
node.stop_progress()
node.end()
if clock_recorder:
# cspell: ignore killpg, getpgid
os.killpg(os.getpgid(clock_recorder.pid), signal.SIGTERM)
print('stopping & destroying tracing session')
lttng.lttng_fini(session_name=args.session_name)
node.end()

if args.record_clock:
# cspell: ignore preexec, setpgrp
Expand Down
3 changes: 2 additions & 1 deletion ros2caret/verb/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def __init__(

filters = self._get_filters(args.d_filter_args,
args.s_filter_args)
self._lttng = Lttng(args.trace_dir, event_filters=filters)
self._lttng = Lttng(args.trace_dir, event_filters=filters,
validate=len(args.trace_dir) == 1)
self._summary_df = self._get_summary_df(self._lttng, groupby)
self._filtered = len(filters) > 0

Expand Down
2 changes: 1 addition & 1 deletion ros2caret/verb/topic_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TopicSummaryVerb(VerbExtension):

def add_arguments(self, parser, cli_name):
parser.add_argument(
'trace_dir', type=str,
'trace_dir', type=str, nargs='+',
help='the path to the trace directory'
)
parser.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion ros2caret/verb/trace_point_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TracePointSummaryVerb(VerbExtension):

def add_arguments(self, parser, cli_name):
parser.add_argument(
'trace_dir', type=str,
'trace_dir', type=str, nargs='+',
help='the path to the trace directory'
)
parser.add_argument(
Expand Down
4 changes: 0 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@
ros2caret.verb.record:RecordVerb',
'version = \
ros2caret.verb.version:CaretVersionVerb',
# 'callback_graph = \
# ros2caret.verb.callback_graph:CallbackGraphVerb',
# 'chain_latency = ros2caret.verb.chain_latency:ChainLatencyVerb',
# 'message_flow = ros2caret.verb.message_flow:MessageFlowVerb',
]
},
)

0 comments on commit 0bf9117

Please sign in to comment.