Skip to content

Commit e140ca4

Browse files
authored
Enable rosbag2_performance_benchmarking package to be built by default (#2093)
* Enable performance benchmarking to be built by default - Note: the tests from the performance benchmarking package are excluded from the build by default and should be explicitly enabled during the build time via ``--cmake-args -DENABLE_ROSBAG2_BENCHMARK_TESTS=1` Signed-off-by: Michael Orlov <[email protected]> * Fix grammar issue in the README.md file according to the code review Signed-off-by: Michael Orlov <[email protected]> * Fix for Windows build failure Address error message: LINK : fatal error LNK1181: cannot open input file 'yaml-cpp.lib' Signed-off-by: Michael Orlov <[email protected]> --------- Signed-off-by: Michael Orlov <[email protected]>
1 parent 1e03b74 commit e140ca4

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ jobs:
2525
{
2626
"build": {
2727
"cmake-args": [
28-
"-DCMAKE_CXX_FLAGS=\"-Werror\"",
29-
"-DBUILD_ROSBAG2_BENCHMARKS=1"
28+
"-DCMAKE_CXX_FLAGS=\"-Werror\""
3029
],
3130
"packages-up-to": [
3231
"mcap_vendor",

rosbag2_performance/rosbag2_performance_benchmarking/CMakeLists.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
cmake_minimum_required(VERSION 3.20)
22
project(rosbag2_performance_benchmarking)
33

4-
option(BUILD_ROSBAG2_BENCHMARKS "Build rosbag2 performance benchmarks" OFF)
5-
6-
if(NOT BUILD_ROSBAG2_BENCHMARKS)
7-
return()
8-
endif()
4+
option(ENABLE_ROSBAG2_BENCHMARK_TESTS "Enables rosbag2 performance benchmark tests" OFF)
95

106
# Default to C++17
117
if(NOT CMAKE_CXX_STANDARD)
@@ -61,7 +57,7 @@ target_link_libraries(benchmark_publishers
6157
rosbag2_storage::rosbag2_storage
6258
${rosbag2_performance_benchmarking_msgs_TARGETS}
6359
${sensor_msgs_TARGETS}
64-
yaml-cpp
60+
yaml-cpp::yaml-cpp
6561
)
6662

6763
target_link_libraries(results_writer
@@ -93,7 +89,7 @@ install(DIRECTORY
9389
DESTINATION share/${PROJECT_NAME}
9490
)
9591

96-
if(BUILD_TESTING)
92+
if(BUILD_TESTING AND ENABLE_ROSBAG2_BENCHMARK_TESTS)
9793
find_package(ament_lint_auto REQUIRED)
9894
ament_lint_auto_find_test_dependencies()
9995

rosbag2_performance/rosbag2_performance_benchmarking/README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ For human friendly output, a postprocess report generation tool can be used. Lau
2626
```bash
2727
scripts/report_gen.py -i <BENCHMARK_RESULT_DIR>
2828
```
29+
2930
#### Binaries
3031

3132
These are used in the launch file:
@@ -45,12 +46,25 @@ In the case of the `benchmark_publishers` binary, a pool of threads is created t
4546
the number of threads is equal to the number of publishers. It is possible to change the number of threads
4647
using the optional `number_of_threads` parameter.
4748

48-
## Building
49+
## Running builtin Rosbag2 benchmark tests on CI or local setup
50+
51+
The package contains a set of builtin tests that can be run to verify the performance of the
52+
Rosbag2 recorder. However, these tests are excluded from the build by default, so you need to enable
53+
them by setting the `ENABLE_ROSBAG2_BENCHMARK_TESTS` CMake flag to `ON` when building the package.
54+
To enable and run the rosbag2 benchmark tests with colcon, you need to:
55+
First build the package with the `ENABLE_ROSBAG2_BENCHMARK_TESTS` CMake option enabled:
56+
57+
```bash
58+
colcon build --packages-select rosbag2_performance_benchmarking --cmake-args -DENABLE_ROSBAG2_BENCHMARK_TESTS=1
59+
```
60+
61+
Then, you can run the tests using the `colcon test` command.
4962

50-
To build the package in the rosbag2 build process, make sure to turn `BUILD_ROSBAG2_BENCHMARKS` flag on (e.g. `colcon build --cmake-args -DBUILD_ROSBAG2_BENCHMARKS=1`)
63+
```bash
64+
colcon test --packages-select rosbag2_performance_benchmarking
65+
```
5166

52-
If you already built rosbag2, you can use `packages-select` option to build benchmarks.
53-
Example: `colcon build --packages-select rosbag2_performance_benchmarking --cmake-args -DBUILD_ROSBAG2_BENCHMARKS=1`.
67+
This will execute the tests defined in the "rosbag2_performance_benchmarking/test/benchmark_test.py".
5468

5569
## General knowledge: I/O benchmarking
5670

rosbag2_performance/rosbag2_performance_benchmarking_msgs/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 3.20)
22

33
project(rosbag2_performance_benchmarking_msgs)
44

5-
option(BUILD_ROSBAG2_BENCHMARKS "Build rosbag2 performance benchmarks" OFF)
6-
7-
if(NOT BUILD_ROSBAG2_BENCHMARKS)
8-
return()
9-
endif()
10-
115
find_package(ament_cmake REQUIRED)
126
find_package(rosidl_default_generators REQUIRED)
137

0 commit comments

Comments
 (0)