-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create start/pause/resume/stop sub-commands for 'ros2 trace'
Signed-off-by: Christophe Bedard <[email protected]>
- Loading branch information
1 parent
4f54501
commit 353f609
Showing
12 changed files
with
550 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Copyright 2017 Open Source Robotics Foundation, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from ros2cli.plugin_system import PLUGIN_SYSTEM_VERSION | ||
from ros2cli.plugin_system import satisfies_version | ||
|
||
|
||
class VerbExtension: | ||
""" | ||
The extension point for 'trace' verb extensions. | ||
The following properties must be defined: | ||
* `NAME` (will be set to the entry point name) | ||
The following methods must be defined: | ||
* `main` | ||
The following methods can be defined: | ||
* `add_arguments` | ||
""" | ||
|
||
NAME = None | ||
EXTENSION_POINT_VERSION = '0.1' | ||
|
||
def __init__(self): | ||
super(VerbExtension, self).__init__() | ||
satisfies_version(PLUGIN_SYSTEM_VERSION, '^0.1') | ||
|
||
def add_arguments(self, parser, cli_name): | ||
pass | ||
|
||
def main(self, *, args): | ||
raise NotImplementedError() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2023 Apex.AI, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from ros2trace.verb import VerbExtension | ||
from tracetools_trace.tools import args | ||
from tracetools_trace.trace import pause | ||
|
||
|
||
class PauseVerb(VerbExtension): | ||
"""Pause tracing after starting.""" | ||
|
||
def add_arguments(self, parser, cli_name) -> None: | ||
args.add_arguments_session_name(parser) | ||
|
||
def main(self, *, args) -> int: | ||
return pause(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2023 Apex.AI, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from ros2trace.verb import VerbExtension | ||
from tracetools_trace.tools import args | ||
from tracetools_trace.trace import resume | ||
|
||
|
||
class ResumeVerb(VerbExtension): | ||
"""Resume tracing after pausing.""" | ||
|
||
def add_arguments(self, parser, cli_name) -> None: | ||
args.add_arguments_session_name(parser) | ||
|
||
def main(self, *, args) -> int: | ||
return resume(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2023 Apex.AI, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from ros2trace.verb import VerbExtension | ||
from tracetools_trace.tools import args | ||
from tracetools_trace.trace import start | ||
|
||
|
||
class StartVerb(VerbExtension): | ||
"""Configure tracing session and start tracing.""" | ||
|
||
def add_arguments(self, parser, cli_name) -> None: | ||
args.add_arguments_noninteractive(parser) | ||
|
||
def main(self, *, args) -> int: | ||
return start(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2023 Apex.AI, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from ros2trace.verb import VerbExtension | ||
from tracetools_trace.tools import args | ||
from tracetools_trace.trace import stop | ||
|
||
|
||
class StopVerb(VerbExtension): | ||
"""Stop tracing after starting or resuming.""" | ||
|
||
def add_arguments(self, parser, cli_name) -> None: | ||
args.add_arguments_session_name(parser) | ||
|
||
def main(self, *, args) -> int: | ||
return stop(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.