Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not include service/client tracepoints for Jazzy #355

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions rmw_zenoh_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ target_link_libraries(rmw_zenoh_cpp
zenohcxx::zenohc
)

# Get distro from ros_environment and create config header
set(ROS_DISTRO "$ENV{ROS_DISTRO}")
set(ROS_DISTRO_JAZZY OFF)
set(ROS_DISTRO_ROLLING OFF)
if(ROS_DISTRO STREQUAL "jazzy")
set(ROS_DISTRO_JAZZY ON)
elseif(ROS_DISTRO STREQUAL "rolling")
set(ROS_DISTRO_ROLLING ON)
else()
message(WARNING "Unexpected ROS_DISTRO: ${ROS_DISTRO}")
endif()
configure_file(include/${PROJECT_NAME}/distro.hpp.in include/${PROJECT_NAME}/distro.hpp)
target_include_directories(rmw_zenoh_cpp PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
)

configure_rmw_library(rmw_zenoh_cpp)

target_compile_definitions(rmw_zenoh_cpp
Expand Down
21 changes: 21 additions & 0 deletions rmw_zenoh_cpp/include/rmw_zenoh_cpp/distro.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2024 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.

#ifndef RMW_ZENOH_CPP_DISTRO_HPP_
#define RMW_ZENOH_CPP_DISTRO_HPP_

#cmakedefine ROS_DISTRO_JAZZY
#cmakedefine ROS_DISTRO_ROLLING

#endif // RMW_ZENOH_CPP_DISTRO_HPP_
1 change: 1 addition & 0 deletions rmw_zenoh_cpp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<build_depend>ros_environment</build_depend>
<build_depend>zenoh_cpp_vendor</build_depend>
<build_export_depend>zenoh_cpp_vendor</build_export_depend>

Expand Down
3 changes: 3 additions & 0 deletions rmw_zenoh_cpp/src/detail/rmw_client_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "message_type_support.hpp"
#include "qos.hpp"
#include "rmw_context_impl_s.hpp"
#include "rmw_zenoh_cpp/distro.hpp"

#include "rcpputils/scope_exit.hpp"

Expand Down Expand Up @@ -365,11 +366,13 @@ rmw_ret_t ClientData::send_request(
size_t data_length = ser.get_serialized_data_length();
*sequence_id = sequence_number_++;

#ifndef ROS_DISTRO_JAZZY
TRACETOOLS_TRACEPOINT(
rmw_send_request,
static_cast<const void *>(rmw_client_),
static_cast<const void *>(ros_request),
*sequence_id);
#endif

// Send request
zenoh::Session::GetOptions opts = zenoh::Session::GetOptions::create_default();
Expand Down
3 changes: 3 additions & 0 deletions rmw_zenoh_cpp/src/detail/rmw_service_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "message_type_support.hpp"
#include "logging_macros.hpp"
#include "qos.hpp"
#include "rmw_zenoh_cpp/distro.hpp"

#include "rcpputils/scope_exit.hpp"

Expand Down Expand Up @@ -460,13 +461,15 @@ rmw_ret_t ServiceData::send_response(
return RMW_RET_ERROR;
}

#ifndef ROS_DISTRO_JAZZY
TRACETOOLS_TRACEPOINT(
rmw_send_response,
static_cast<const void *>(rmw_service_),
static_cast<const void *>(ros_response),
request_id->writer_guid,
request_id->sequence_number,
source_timestamp);
#endif
loaned_query.reply(service_ke, std::move(payload), std::move(options), &result);
if (result != Z_OK) {
RMW_SET_ERROR_MSG("unable to reply");
Expand Down
7 changes: 7 additions & 0 deletions rmw_zenoh_cpp/src/rmw_zenoh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "detail/serialization_format.hpp"
#include "detail/type_support_common.hpp"
#include "detail/zenoh_utils.hpp"
#include "rmw_zenoh_cpp/distro.hpp"

#include "rcpputils/scope_exit.hpp"

Expand Down Expand Up @@ -1509,10 +1510,12 @@ rmw_create_client(
free_rmw_client.cancel();
free_service_name.cancel();

#ifndef ROS_DISTRO_JAZZY
TRACETOOLS_TRACEPOINT(
rmw_client_init,
static_cast<const void *>(rmw_client),
client_data->copy_gid().data());
#endif
return rmw_client;
}

Expand Down Expand Up @@ -1609,13 +1612,15 @@ rmw_take_response(
RMW_CHECK_ARGUMENT_FOR_NULL(request_header, RMW_RET_INVALID_ARGUMENT);

rmw_ret_t ret = client_data->take_response(request_header, ros_response, taken);
#ifndef ROS_DISTRO_JAZZY
TRACETOOLS_TRACEPOINT(
rmw_take_response,
static_cast<const void *>(client),
static_cast<const void *>(ros_response),
request_header->request_id.sequence_number,
request_header->source_timestamp,
*taken);
#endif
return ret;
}

Expand Down Expand Up @@ -1838,13 +1843,15 @@ rmw_take_request(
request_header,
ros_request,
taken);
#ifndef ROS_DISTRO_JAZZY
TRACETOOLS_TRACEPOINT(
rmw_take_request,
static_cast<const void *>(service),
static_cast<const void *>(ros_request),
request_header->request_id.writer_guid,
request_header->request_id.sequence_number,
*taken);
#endif
return ret;
}

Expand Down
Loading