Skip to content

Commit

Permalink
Network latency reports source participant (#2059)
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
  • Loading branch information
MiguelCompany authored Jul 14, 2021
1 parent 841d63f commit 18fa535
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
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

0 comments on commit 18fa535

Please sign in to comment.