Skip to content

Commit

Permalink
Refactor Statistics module IDL (#4638)
Browse files Browse the repository at this point in the history
* Refs #20714: refactor statistics module IDL

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #20714: regenerate types

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

* Refs #20714: correctly use new statistics IDL

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>

---------

Signed-off-by: JLBuenoLopez-eProsima <[email protected]>
  • Loading branch information
JLBuenoLopez committed Apr 2, 2024
1 parent a364ed8 commit 18d8c6e
Show file tree
Hide file tree
Showing 59 changed files with 4,257 additions and 3,933 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#ifndef _FAST_DDS_GENERATED_ADVANCEDCONFIGURATION_H_
#define _FAST_DDS_GENERATED_ADVANCEDCONFIGURATION_H_


#include <array>
#include <bitset>
#include <cstdint>
Expand All @@ -34,6 +35,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>

#if defined(_WIN32)
#if defined(EPROSIMA_USER_DLL_EXPORT)
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/dds/BasicConfigurationExample/HelloWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
1 change: 1 addition & 0 deletions examples/cpp/dds/ContentFilteredTopicExample/HelloWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
6 changes: 3 additions & 3 deletions examples/cpp/dds/DeadlineQoSExample/deadlinepayloadv1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ void HelloMsg::serializeKey(
eprosima::fastcdr::Cdr& scdr) const
{
(void) scdr;

scdr << m_deadlinekey;


}

/*!
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/dds/DiscoveryServerExample/types/HelloWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
1 change: 1 addition & 0 deletions examples/cpp/dds/Filtering/FilteringExample.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
1 change: 1 addition & 0 deletions examples/cpp/dds/FlowControlExample/FlowControlExample.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
1 change: 1 addition & 0 deletions examples/cpp/dds/HelloWorldExample/HelloWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
2 changes: 2 additions & 0 deletions examples/cpp/dds/HelloWorldExample/HelloWorldv1.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>

#if defined(_WIN32)
#if defined(EPROSIMA_USER_DLL_EXPORT)
#define eProsima_user_DllExport __declspec( dllexport )
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/dds/HelloWorldExampleSharedMem/HelloWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
1 change: 1 addition & 0 deletions examples/cpp/dds/RequestReplyExample/Calculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
1 change: 1 addition & 0 deletions examples/cpp/dds/SecureHelloWorldExample/HelloWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
1 change: 1 addition & 0 deletions examples/cpp/dds/StaticHelloWorldExample/HelloWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
1 change: 1 addition & 0 deletions examples/cpp/dds/WriterLoansExample/LoanableHelloWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
1 change: 1 addition & 0 deletions examples/cpp/dds/ZeroCopyExample/LoanableHelloWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <string>
#include <vector>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/external.hpp>
#include <fastcdr/xcdr/optional.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class LoanableHelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataTyp
eProsima_user_DllExport inline bool is_plain(
eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override
{
if (data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION)
if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION)
{
return is_plain_xcdrv2_impl();
}
Expand Down
73 changes: 36 additions & 37 deletions include/fastdds/statistics/types.idl
Original file line number Diff line number Diff line change
Expand Up @@ -119,54 +119,53 @@ struct PhysicalData
string process;
};

@bit_bound(32)
bitmask EventKind
module EventKind
{
@position(0) HISTORY2HISTORY_LATENCY,
@position(1) NETWORK_LATENCY,
@position(2) PUBLICATION_THROUGHPUT,
@position(3) SUBSCRIPTION_THROUGHPUT,
@position(4) RTPS_SENT,
@position(5) RTPS_LOST,
@position(6) RESENT_DATAS,
@position(7) HEARTBEAT_COUNT,
@position(8) ACKNACK_COUNT,
@position(9) NACKFRAG_COUNT,
@position(10) GAP_COUNT,
@position(11) DATA_COUNT,
@position(12) PDP_PACKETS,
@position(13) EDP_PACKETS,
@position(14) DISCOVERED_ENTITY,
@position(15) SAMPLE_DATAS,
@position(16) PHYSICAL_DATA
const unsigned long HISTORY2HISTORY_LATENCY = 1;
const unsigned long NETWORK_LATENCY = 2;
const unsigned long PUBLICATION_THROUGHPUT = 4;
const unsigned long SUBSCRIPTION_THROUGHPUT = 8;
const unsigned long RTPS_SENT = 16;
const unsigned long RTPS_LOST = 32;
const unsigned long RESENT_DATAS = 64;
const unsigned long HEARTBEAT_COUNT = 128;
const unsigned long ACKNACK_COUNT = 256;
const unsigned long NACKFRAG_COUNT = 512;
const unsigned long GAP_COUNT = 1024;
const unsigned long DATA_COUNT = 2048;
const unsigned long PDP_PACKETS = 4096;
const unsigned long EDP_PACKETS = 8192;
const unsigned long DISCOVERED_ENTITY = 16384;
const unsigned long SAMPLE_DATAS = 32768;
const unsigned long PHYSICAL_DATA = 65536;
};

union Data switch(EventKind)
union Data switch(unsigned long)
{
case HISTORY2HISTORY_LATENCY:
case EventKind::HISTORY2HISTORY_LATENCY:
WriterReaderData writer_reader_data;
case NETWORK_LATENCY:
case EventKind::NETWORK_LATENCY:
Locator2LocatorData locator2locator_data;
case PUBLICATION_THROUGHPUT:
case SUBSCRIPTION_THROUGHPUT:
case EventKind::PUBLICATION_THROUGHPUT:
case EventKind::SUBSCRIPTION_THROUGHPUT:
EntityData entity_data;
case RTPS_SENT:
case RTPS_LOST:
case EventKind::RTPS_SENT:
case EventKind::RTPS_LOST:
Entity2LocatorTraffic entity2locator_traffic;
case RESENT_DATAS:
case HEARTBEAT_COUNT:
case ACKNACK_COUNT:
case NACKFRAG_COUNT:
case GAP_COUNT:
case DATA_COUNT:
case PDP_PACKETS:
case EDP_PACKETS:
case EventKind::RESENT_DATAS:
case EventKind::HEARTBEAT_COUNT:
case EventKind::ACKNACK_COUNT:
case EventKind::NACKFRAG_COUNT:
case EventKind::GAP_COUNT:
case EventKind::DATA_COUNT:
case EventKind::PDP_PACKETS:
case EventKind::EDP_PACKETS:
EntityCount entity_count;
case DISCOVERED_ENTITY:
case EventKind::DISCOVERED_ENTITY:
DiscoveryTime discovery_time;
case SAMPLE_DATAS:
case EventKind::SAMPLE_DATAS:
SampleIdentityCount sample_identity_count;
case PHYSICAL_DATA:
case EventKind::PHYSICAL_DATA:
PhysicalData physical_data;
};

Expand Down
48 changes: 24 additions & 24 deletions src/cpp/statistics/fastdds/domain/DomainParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,44 +79,44 @@ constexpr const char* PHYSICAL_DATA_TOPIC_ALIAS = "PHYSICAL_DATA_TOPIC";
constexpr const char* MONITOR_SERVICE_TOPIC_ALIAS = "MONITOR_SERVICE_TOPIC";

static constexpr uint32_t participant_statistics_mask =
EventKindBits::RTPS_SENT | EventKindBits::RTPS_LOST | EventKindBits::NETWORK_LATENCY |
EventKindBits::EDP_PACKETS | EventKindBits::PDP_PACKETS |
EventKindBits::PHYSICAL_DATA | EventKindBits::DISCOVERED_ENTITY;
EventKind::RTPS_SENT | EventKind::RTPS_LOST | EventKind::NETWORK_LATENCY |
EventKind::EDP_PACKETS | EventKind::PDP_PACKETS |
EventKind::PHYSICAL_DATA | EventKind::DISCOVERED_ENTITY;

struct ValidEntry
{
const char* alias;
const char* name;
EventKind event_kind;
uint32_t event_kind;
};

static const ValidEntry valid_entries[] =
{
{HISTORY_LATENCY_TOPIC_ALIAS, HISTORY_LATENCY_TOPIC, HISTORY2HISTORY_LATENCY},
{NETWORK_LATENCY_TOPIC_ALIAS, NETWORK_LATENCY_TOPIC, NETWORK_LATENCY},
{PUBLICATION_THROUGHPUT_TOPIC_ALIAS, PUBLICATION_THROUGHPUT_TOPIC, PUBLICATION_THROUGHPUT},
{SUBSCRIPTION_THROUGHPUT_TOPIC_ALIAS, SUBSCRIPTION_THROUGHPUT_TOPIC, SUBSCRIPTION_THROUGHPUT},
{RTPS_SENT_TOPIC_ALIAS, RTPS_SENT_TOPIC, RTPS_SENT},
{RTPS_LOST_TOPIC_ALIAS, RTPS_LOST_TOPIC, RTPS_LOST},
{RESENT_DATAS_TOPIC_ALIAS, RESENT_DATAS_TOPIC, RESENT_DATAS},
{HEARTBEAT_COUNT_TOPIC_ALIAS, HEARTBEAT_COUNT_TOPIC, HEARTBEAT_COUNT},
{ACKNACK_COUNT_TOPIC_ALIAS, ACKNACK_COUNT_TOPIC, ACKNACK_COUNT},
{NACKFRAG_COUNT_TOPIC_ALIAS, NACKFRAG_COUNT_TOPIC, NACKFRAG_COUNT},
{GAP_COUNT_TOPIC_ALIAS, GAP_COUNT_TOPIC, GAP_COUNT},
{DATA_COUNT_TOPIC_ALIAS, DATA_COUNT_TOPIC, DATA_COUNT},
{PDP_PACKETS_TOPIC_ALIAS, PDP_PACKETS_TOPIC, PDP_PACKETS},
{EDP_PACKETS_TOPIC_ALIAS, EDP_PACKETS_TOPIC, EDP_PACKETS},
{DISCOVERY_TOPIC_ALIAS, DISCOVERY_TOPIC, DISCOVERED_ENTITY},
{SAMPLE_DATAS_TOPIC_ALIAS, SAMPLE_DATAS_TOPIC, SAMPLE_DATAS},
{PHYSICAL_DATA_TOPIC_ALIAS, PHYSICAL_DATA_TOPIC, PHYSICAL_DATA}
{HISTORY_LATENCY_TOPIC_ALIAS, HISTORY_LATENCY_TOPIC, EventKind::HISTORY2HISTORY_LATENCY},
{NETWORK_LATENCY_TOPIC_ALIAS, NETWORK_LATENCY_TOPIC, EventKind::NETWORK_LATENCY},
{PUBLICATION_THROUGHPUT_TOPIC_ALIAS, PUBLICATION_THROUGHPUT_TOPIC, EventKind::PUBLICATION_THROUGHPUT},
{SUBSCRIPTION_THROUGHPUT_TOPIC_ALIAS, SUBSCRIPTION_THROUGHPUT_TOPIC, EventKind::SUBSCRIPTION_THROUGHPUT},
{RTPS_SENT_TOPIC_ALIAS, RTPS_SENT_TOPIC, EventKind::RTPS_SENT},
{RTPS_LOST_TOPIC_ALIAS, RTPS_LOST_TOPIC, EventKind::RTPS_LOST},
{RESENT_DATAS_TOPIC_ALIAS, RESENT_DATAS_TOPIC, EventKind::RESENT_DATAS},
{HEARTBEAT_COUNT_TOPIC_ALIAS, HEARTBEAT_COUNT_TOPIC, EventKind::HEARTBEAT_COUNT},
{ACKNACK_COUNT_TOPIC_ALIAS, ACKNACK_COUNT_TOPIC, EventKind::ACKNACK_COUNT},
{NACKFRAG_COUNT_TOPIC_ALIAS, NACKFRAG_COUNT_TOPIC, EventKind::NACKFRAG_COUNT},
{GAP_COUNT_TOPIC_ALIAS, GAP_COUNT_TOPIC, EventKind::GAP_COUNT},
{DATA_COUNT_TOPIC_ALIAS, DATA_COUNT_TOPIC, EventKind::DATA_COUNT},
{PDP_PACKETS_TOPIC_ALIAS, PDP_PACKETS_TOPIC, EventKind::PDP_PACKETS},
{EDP_PACKETS_TOPIC_ALIAS, EDP_PACKETS_TOPIC, EventKind::EDP_PACKETS},
{DISCOVERY_TOPIC_ALIAS, DISCOVERY_TOPIC, EventKind::DISCOVERED_ENTITY},
{SAMPLE_DATAS_TOPIC_ALIAS, SAMPLE_DATAS_TOPIC, EventKind::SAMPLE_DATAS},
{PHYSICAL_DATA_TOPIC_ALIAS, PHYSICAL_DATA_TOPIC, EventKind::PHYSICAL_DATA}
};

ReturnCode_t DomainParticipantImpl::enable_statistics_datawriter(
const std::string& topic_name,
const efd::DataWriterQos& dwqos)
{
std::string use_topic_name;
EventKind event_kind;
uint32_t event_kind;
if (!transform_and_check_topic_name(topic_name, use_topic_name, event_kind))
{
return ReturnCode_t::RETCODE_BAD_PARAMETER;
Expand Down Expand Up @@ -215,7 +215,7 @@ ReturnCode_t DomainParticipantImpl::disable_statistics_datawriter(
{
ReturnCode_t ret = ReturnCode_t::RETCODE_OK;
std::string use_topic_name;
EventKind event_kind;
uint32_t event_kind;
if (!transform_and_check_topic_name(topic_name, use_topic_name, event_kind))
{
return ReturnCode_t::RETCODE_BAD_PARAMETER;
Expand Down Expand Up @@ -499,7 +499,7 @@ bool DomainParticipantImpl::is_statistics_topic_name(
bool DomainParticipantImpl::transform_and_check_topic_name(
const std::string& topic_name_or_alias,
std::string& topic_name,
EventKind& event_kind) noexcept
uint32_t& event_kind) noexcept
{
for (const ValidEntry& entry : valid_entries)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class DomainParticipantImpl : public efd::DomainParticipantImpl,
bool transform_and_check_topic_name(
const std::string& topic_name_or_alias,
std::string& topic_name,
EventKind& event_kind) noexcept;
uint32_t& event_kind) noexcept;

/**
* Auxiliary function to register the statistics type depending on the statistics topic name.
Expand Down
Loading

0 comments on commit 18d8c6e

Please sign in to comment.