Add 'ros2trace/' from commit '9eb99e7d9d
'
git-subtree-dir: ros2trace git-subtree-mainline:c9d2f35887
git-subtree-split:9eb99e7d9d
This commit is contained in:
commit
ffd1faa1f7
11 changed files with 204 additions and 0 deletions
3
ros2trace/.gitignore
vendored
Normal file
3
ros2trace/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
*~
|
||||||
|
*.pyc
|
||||||
|
|
25
ros2trace/package.xml
Normal file
25
ros2trace/package.xml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
||||||
|
<package format="2">
|
||||||
|
<name>ros2trace</name>
|
||||||
|
<version>0.0.1</version>
|
||||||
|
<description>
|
||||||
|
The trace command for ROS 2 command line tools.
|
||||||
|
</description>
|
||||||
|
<maintainer email="fixed-term.christophe.bourquebedard@de.bosch.com">Christophe Bedard</maintainer>
|
||||||
|
<license>TODO</license>
|
||||||
|
<author email="fixed-term.christophe.bourquebedard@de.bosch.com">Christophe Bedard</author>
|
||||||
|
|
||||||
|
<depend>ros2cli</depend>
|
||||||
|
<depend>tracetools_trace</depend>
|
||||||
|
|
||||||
|
<test_depend>ament_copyright</test_depend>
|
||||||
|
<test_depend>ament_flake8</test_depend>
|
||||||
|
<test_depend>ament_pep257</test_depend>
|
||||||
|
<test_depend>ament_xmllint</test_depend>
|
||||||
|
<test_depend>python3-pytest</test_depend>
|
||||||
|
|
||||||
|
<export>
|
||||||
|
<build_type>ament_python</build_type>
|
||||||
|
</export>
|
||||||
|
</package>
|
0
ros2trace/ros2trace/__init__.py
Normal file
0
ros2trace/ros2trace/__init__.py
Normal file
42
ros2trace/ros2trace/api/__init__.py
Normal file
42
ros2trace/ros2trace/api/__init__.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
from tracetools_trace.tools import args
|
||||||
|
from tracetools_trace.tools import lttng
|
||||||
|
|
||||||
|
|
||||||
|
def add_trace_arguments(parser):
|
||||||
|
args.add_arguments(parser)
|
||||||
|
|
||||||
|
|
||||||
|
def init(args):
|
||||||
|
session_name = args.session_name
|
||||||
|
base_path = args.path
|
||||||
|
full_path = os.path.join(base_path, session_name)
|
||||||
|
ros_events = args.events_ust
|
||||||
|
kernel_events = args.events_kernel
|
||||||
|
|
||||||
|
ust_enabled = len(ros_events) > 0
|
||||||
|
kernel_enabled = len(kernel_events) > 0
|
||||||
|
if ust_enabled:
|
||||||
|
print(f'UST tracing enabled ({len(ros_events)} events)')
|
||||||
|
if args.list:
|
||||||
|
print(f'\tevents: {ros_events}')
|
||||||
|
else:
|
||||||
|
print('UST tracing disabled')
|
||||||
|
if kernel_enabled:
|
||||||
|
print(f'kernel tracing enabled ({len(kernel_events)} events)')
|
||||||
|
if args.list:
|
||||||
|
print(f'\tevents: {kernel_events}')
|
||||||
|
else:
|
||||||
|
print('kernel tracing disabled')
|
||||||
|
|
||||||
|
print(f'writting tracing session to: {full_path}')
|
||||||
|
input('press enter to start...')
|
||||||
|
lttng.lttng_init(session_name, full_path, ros_events=ros_events, kernel_events=kernel_events)
|
||||||
|
|
||||||
|
|
||||||
|
def fini(args):
|
||||||
|
session_name = args.session_name
|
||||||
|
input('press enter to stop...')
|
||||||
|
print('stopping & destroying tracing session')
|
||||||
|
lttng.lttng_fini(session_name)
|
0
ros2trace/ros2trace/command/__init__.py
Normal file
0
ros2trace/ros2trace/command/__init__.py
Normal file
16
ros2trace/ros2trace/command/trace.py
Normal file
16
ros2trace/ros2trace/command/trace.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
from ros2cli.command import CommandExtension
|
||||||
|
from ros2trace.api import add_trace_arguments
|
||||||
|
from ros2trace.api import init
|
||||||
|
from ros2trace.api import fini
|
||||||
|
|
||||||
|
|
||||||
|
class TraceCommand(CommandExtension):
|
||||||
|
"""Trace ROS."""
|
||||||
|
|
||||||
|
def add_arguments(self, parser, cli_name):
|
||||||
|
add_trace_arguments(parser)
|
||||||
|
|
||||||
|
def main(self, *, parser, args):
|
||||||
|
init(args)
|
||||||
|
fini(args)
|
||||||
|
return 0
|
26
ros2trace/setup.py
Normal file
26
ros2trace/setup.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
from setuptools import find_packages
|
||||||
|
from setuptools import setup
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name='ros2trace',
|
||||||
|
version='0.0.1',
|
||||||
|
packages=find_packages(exclude=['test']),
|
||||||
|
install_requires=['ros2cli'],
|
||||||
|
zip_safe=True,
|
||||||
|
maintainer='Christophe Bedard',
|
||||||
|
maintainer_email='fixed-term.christophe.bourquebedard@de.bosch.com',
|
||||||
|
author='Christophe Bedard',
|
||||||
|
author_email='fixed-term.christophe.bourquebedard@de.bosch.com',
|
||||||
|
# url=',
|
||||||
|
keywords=[],
|
||||||
|
description='The run command for ROS 2 command line tools.',
|
||||||
|
long_description="""\
|
||||||
|
The package provides the trace command for the ROS 2 command line tools.""",
|
||||||
|
license='TODO',
|
||||||
|
tests_require=['pytest'],
|
||||||
|
entry_points={
|
||||||
|
'ros2cli.command': [
|
||||||
|
'trace = ros2trace.command.trace:TraceCommand',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
)
|
23
ros2trace/test/test_copyright.py
Normal file
23
ros2trace/test/test_copyright.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# 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 ament_copyright.main import main
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.copyright
|
||||||
|
@pytest.mark.linter
|
||||||
|
def test_copyright():
|
||||||
|
rc = main(argv=['.', 'test'])
|
||||||
|
assert rc == 0, 'Found errors'
|
23
ros2trace/test/test_flake8.py
Normal file
23
ros2trace/test/test_flake8.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# 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 ament_flake8.main import main
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.flake8
|
||||||
|
@pytest.mark.linter
|
||||||
|
def test_flake8():
|
||||||
|
rc = main(argv=[])
|
||||||
|
assert rc == 0, 'Found errors'
|
23
ros2trace/test/test_pep257.py
Normal file
23
ros2trace/test/test_pep257.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# 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 ament_pep257.main import main
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.linter
|
||||||
|
@pytest.mark.pep257
|
||||||
|
def test_pep257():
|
||||||
|
rc = main(argv=[])
|
||||||
|
assert rc == 0, 'Found code style errors / warnings'
|
23
ros2trace/test/test_xmllint.py
Normal file
23
ros2trace/test/test_xmllint.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Copyright 2019 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 ament_xmllint.main import main
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.linter
|
||||||
|
@pytest.mark.xmllint
|
||||||
|
def test_xmllint():
|
||||||
|
rc = main(argv=[])
|
||||||
|
assert rc == 0, 'Found errors'
|
Loading…
Add table
Add a link
Reference in a new issue