From ba9003edd99871c7a87825a320933a16b49cd89f Mon Sep 17 00:00:00 2001 From: h-suzuki Date: Thu, 18 Jan 2024 11:57:54 +0900 Subject: [PATCH 1/3] Add: tracepoint for generic pub/sub Signed-off-by: h-suzuki --- rmw_fastrtps_shared_cpp/src/rmw_publish.cpp | 1 + rmw_fastrtps_shared_cpp/src/rmw_take.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp b/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp index 9b85e49f2..fbb567da0 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp @@ -109,6 +109,7 @@ __rmw_publish_serialized_message( data.type = FASTRTPS_SERIALIZED_DATA_TYPE_CDR_BUFFER; data.data = &ser; data.impl = nullptr; // not used when type is FASTRTPS_SERIALIZED_DATA_TYPE_CDR_BUFFER + TRACETOOLS_TRACEPOINT(rmw_publish, serialized_message); if (!info->data_writer_->write(&data)) { RMW_SET_ERROR_MSG("cannot publish data"); return RMW_RET_ERROR; diff --git a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp index 7421d6211..44d9d86e5 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp @@ -348,7 +348,12 @@ _take_serialized_message( break; } } - + TRACETOOLS_TRACEPOINT( + rmw_take, + static_cast(subscription), + static_cast(serialized_message), + (message_info ? message_info->source_timestamp : 0LL), + *taken); return RMW_RET_OK; } From 68a10b3be9a7bcd0055146f5661067899bf3ee6e Mon Sep 17 00:00:00 2001 From: h-suzuki Date: Fri, 9 Feb 2024 07:13:21 +0000 Subject: [PATCH 2/3] Fix: correspond to PR 454 Signed-off-by: h-suzuki --- rmw_fastrtps_shared_cpp/src/rmw_publish.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp b/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp index fbb567da0..2d92b761f 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp @@ -109,7 +109,9 @@ __rmw_publish_serialized_message( data.type = FASTRTPS_SERIALIZED_DATA_TYPE_CDR_BUFFER; data.data = &ser; data.impl = nullptr; // not used when type is FASTRTPS_SERIALIZED_DATA_TYPE_CDR_BUFFER - TRACETOOLS_TRACEPOINT(rmw_publish, serialized_message); + eprosima::fastrtps::Time_t stamp; + eprosima::fastrtps::Time_t::now(stamp); + TRACETOOLS_TRACEPOINT(rmw_publish, publisher, serialized_message, stamp.to_ns()); if (!info->data_writer_->write(&data)) { RMW_SET_ERROR_MSG("cannot publish data"); return RMW_RET_ERROR; From 9e5f3547fafc4b0b49aaa99ed39e44b476872466 Mon Sep 17 00:00:00 2001 From: h-suzuki Date: Tue, 5 Mar 2024 08:40:31 +0000 Subject: [PATCH 3/3] Fix: change write to write_to_timestamp Signed-off-by: h-suzuki --- rmw_fastrtps_shared_cpp/src/rmw_publish.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp b/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp index 2d92b761f..51f6003cc 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp @@ -112,7 +112,7 @@ __rmw_publish_serialized_message( eprosima::fastrtps::Time_t stamp; eprosima::fastrtps::Time_t::now(stamp); TRACETOOLS_TRACEPOINT(rmw_publish, publisher, serialized_message, stamp.to_ns()); - if (!info->data_writer_->write(&data)) { + if (!info->data_writer_->write_w_timestamp(&data, eprosima::fastdds::dds::HANDLE_NIL, stamp)) { RMW_SET_ERROR_MSG("cannot publish data"); return RMW_RET_ERROR; }