took the tracetools_read and tracetools_trace from upstream (rolling)

This commit is contained in:
Niklas Halle 2025-05-20 16:27:27 +02:00
parent e8637c9043
commit 1b96054945
25 changed files with 1555 additions and 438 deletions

View file

@ -2,11 +2,68 @@
Changelog for package tracetools_read
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.0.6 (2023-05-27)
8.7.0 (2025-04-24)
------------------
* Merge branch 'version-1-0-5' into 'foxy'
8.6.0 (2025-04-17)
------------------
* Improve Python typing annotations (`#152 <https://github.com/ros2/ros2_tracing/issues/152>`_)
* Expose types for tracing tools (`#153 <https://github.com/ros2/ros2_tracing/issues/153>`_)
* Contributors: Christophe Bedard, Michael Carlstrom
8.5.0 (2024-12-20)
------------------
8.4.1 (2024-11-25)
------------------
8.4.0 (2024-10-15)
------------------
8.3.0 (2024-04-26)
------------------
8.2.0 (2024-04-16)
------------------
* Replace all occurences of index.ros.org (`#114 <https://github.com/ros2/ros2_tracing/issues/114>`_)
* Improve tracetools_test and simplify test_tracetools code (`#109 <https://github.com/ros2/ros2_tracing/issues/109>`_)
* Contributors: Chris Lalancette, Christophe Bedard
8.1.0 (2024-03-27)
------------------
* Allow tracing tests to be run in parallel with other tests (`#95 <https://github.com/ros2/ros2_tracing/issues/95>`_)
* Contributors: Christophe Bedard
8.0.0 (2024-01-23)
------------------
7.1.0 (2023-08-23)
------------------
7.0.0 (2023-06-09)
------------------
6.4.1 (2023-05-11)
------------------
6.4.0 (2023-04-28)
------------------
6.3.0 (2023-04-18)
------------------
6.2.0 (2023-04-18)
------------------
6.1.0 (2023-04-13)
------------------
6.0.0 (2023-04-12)
------------------
5.1.0 (2023-03-02)
------------------
0.2.11 (2019-12-09)
-------------------
* Register Python packages in the ament index

View file

@ -1,12 +1,15 @@
<?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">
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>tracetools_read</name>
<version>1.0.6</version>
<version>8.7.0</version>
<description>Tools for reading traces.</description>
<maintainer email="bedard.christophe@gmail.com">Christophe Bedard</maintainer>
<maintainer email="ingo.luetkebohle@de.bosch.com">Ingo Luetkebohle</maintainer>
<license>Apache 2.0</license>
<url type="website">https://docs.ros.org/en/rolling/p/tracetools_read/</url>
<url type="repository">https://github.com/ros2/ros2_tracing</url>
<url type="bugtracker">https://github.com/ros2/ros2_tracing/issues</url>
<author email="fixed-term.christophe.bourquebedard@de.bosch.com">Christophe Bedard</author>
<exec_depend>python3-babeltrace</exec_depend>

View file

@ -1,4 +1,6 @@
[develop]
script-dir=$base/lib/tracetools_read
script_dir=$base/lib/tracetools_read
[install]
install-scripts=$base/lib/tracetools_read
install_scripts=$base/lib/tracetools_read
[mypy]
warn-unused-ignores = True

View file

@ -5,7 +5,7 @@ package_name = 'tracetools_read'
setup(
name=package_name,
version='1.0.6',
version='8.7.0',
packages=find_packages(exclude=['test']),
data_files=[
('share/' + package_name, ['package.xml']),
@ -23,7 +23,7 @@ setup(
),
author='Christophe Bedard',
author_email='fixed-term.christophe.bourquebedard@de.bosch.com',
url='https://gitlab.com/ros-tracing/ros2_tracing',
url='https://github.com/ros2/ros2_tracing',
keywords=[],
description='Tools for reading traces.',
license='Apache 2.0',

View file

@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from ament_flake8.main import main
from ament_flake8.main import main_with_errors
import pytest
@pytest.mark.flake8
@pytest.mark.linter
def test_flake8():
rc = main(argv=[])
assert rc == 0, 'Found errors'
rc, errors = main_with_errors(argv=[])
assert rc == 0, \
'Found %d code style errors / warnings:\n' % len(errors) + \
'\n'.join(errors)

View file

@ -16,6 +16,7 @@
from typing import Any
from typing import Dict
from typing import List
DictEvent = Dict[str, Any]
@ -54,5 +55,45 @@ def get_event_timestamp(event: DictEvent) -> int:
return event['_timestamp']
def get_event_pid(event: DictEvent) -> int:
return event['vpid']
def get_procname(event: DictEvent) -> str:
return event['procname']
def get_tid(event: DictEvent) -> str:
return event['vtid']
def get_events_with_name(
event_name: str,
events: List[DictEvent],
) -> List[DictEvent]:
"""
Get all events with the given name.
:param event_name: the event name
:param events: the events to check
:return: the list of events with the given name
"""
return [e for e in events if get_event_name(e) == event_name]
def get_events_with_field_value(
field_name: str,
field_values: Any,
events: List[DictEvent],
) -> List[DictEvent]:
"""
Get all events with the given field:value.
:param field_name: the name of the field to check
:param field_values: the value(s) of the field to check
:param events: the events to check
:return: the events with the given field:value pair
"""
if not isinstance(field_values, (list, set)):
field_values = [field_values]
return [e for e in events if get_field(e, field_name, None) in field_values]

View file

@ -0,0 +1 @@