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

Network latency reports source participant [12020] #2059

Merged
merged 1 commit into from
Jul 14, 2021
Merged
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
13 changes: 10 additions & 3 deletions src/cpp/statistics/rtps/StatisticsBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,14 @@ void StatisticsParticipantImpl::on_network_statistics(
const rtps::StatisticsSubmessageData& data,
uint64_t datagram_size)
{
static_cast<void>(source_locator);
static_cast<void>(reception_locator);
process_network_timestamp(source_locator, data.destination, data.ts);
process_network_timestamp(source_participant, data.destination, data.ts);
process_network_sequence(source_participant, data.destination, data.seq, datagram_size);
}

void StatisticsParticipantImpl::process_network_timestamp(
const fastrtps::rtps::Locator_t& source_locator,
const fastrtps::rtps::GuidPrefix_t& source_participant,
const fastrtps::rtps::Locator_t& reception_locator,
const rtps::StatisticsSubmessageData::TimeStamp& ts)
{
Expand All @@ -351,7 +352,13 @@ void StatisticsParticipantImpl::process_network_timestamp(
auto latency = static_cast<float>((current_ts - source_ts).to_ns());

Locator2LocatorData notification;
notification.src_locator(to_statistics_type(source_locator));
notification.src_locator().port(0);
notification.src_locator().kind(reception_locator.kind);
auto locator_addr = notification.src_locator().address().data();
std::copy(source_participant.value, source_participant.value + source_participant.size, locator_addr);
locator_addr += source_participant.size;
std::copy(c_EntityId_RTPSParticipant.value, c_EntityId_RTPSParticipant.value + EntityId_t::size, locator_addr);

notification.dst_locator(to_statistics_type(reception_locator));
notification.data(latency);

Expand Down
4 changes: 2 additions & 2 deletions src/cpp/statistics/rtps/StatisticsBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,12 @@ class StatisticsParticipantImpl

/*
* Process a received statistics submessage timestamp, informing of network latency.
* @param [in] source_locator Locator indicating the sending address.
* @param [in] source_participant GUID prefix of the participant sending the message.
* @param [in] reception_locator Locator indicating the listening address.
* @param [in] ts The timestamp of the statistics submessage received.
*/
void process_network_timestamp(
const fastrtps::rtps::Locator_t& source_locator,
const fastrtps::rtps::GuidPrefix_t& source_participant,
const fastrtps::rtps::Locator_t& reception_locator,
const rtps::StatisticsSubmessageData::TimeStamp& ts);

Expand Down