19 #ifndef FASTDDS_STATISTICS_RTPS__STATISTICSCOMMON_HPP
20 #define FASTDDS_STATISTICS_RTPS__STATISTICSCOMMON_HPP
23 #include <type_traits>
25 #include <fastdds/rtps/common/Guid.hpp>
26 #include <fastdds/rtps/common/SampleIdentity.hpp>
27 #include <fastdds/rtps/common/Time_t.hpp>
28 #include <fastdds/statistics/IListeners.hpp>
29 #include <fastdds/utils/TimedMutex.hpp>
37 class RTPSMessageGroup;
41 namespace statistics {
43 #ifdef FASTDDS_STATISTICS
46 struct StatisticsAncillary;
48 class StatisticsListenersImpl
50 std::unique_ptr<StatisticsAncillary> members_;
59 void init_statistics()
62 std::is_base_of<StatisticsAncillary, A>::value,
63 "Auxiliary structure must derive from StatisticsAncillary");
67 members_.reset(
new A);
75 StatisticsAncillary* get_aux_members()
const;
82 bool add_statistics_listener_impl(
83 std::shared_ptr<fastdds::statistics::IListener> listener);
90 bool remove_statistics_listener_impl(
91 std::shared_ptr<fastdds::statistics::IListener> listener);
98 void set_enabled_statistics_writers_mask_impl(
99 uint32_t enabled_writers);
107 bool are_statistics_writers_enabled(
108 uint32_t checked_enabled_writers);
115 template<
class Function>
116 Function for_each_listener(
123 virtual fastdds::RecursiveTimedMutex& get_statistics_mutex() = 0;
129 virtual const fastdds::rtps::GUID_t& get_guid()
const = 0;
133 struct StatisticsWriterAncillary;
135 class StatisticsWriterImpl
136 :
protected StatisticsListenersImpl
144 StatisticsWriterAncillary* get_members()
const;
150 fastdds::RecursiveTimedMutex& get_statistics_mutex() final;
156 const fastdds::rtps::GUID_t& get_guid() const final;
163 StatisticsWriterImpl();
173 const fastdds::rtps::SampleIdentity& sample_identity,
174 size_t num_sent_submessages);
188 size_t num_destinations);
212 struct StatisticsReaderAncillary;
214 class StatisticsReaderImpl
215 : protected StatisticsListenersImpl
223 StatisticsReaderAncillary* get_members()
const;
229 fastdds::RecursiveTimedMutex& get_statistics_mutex() final;
235 const fastdds::rtps::GUID_t& get_guid() const final;
242 StatisticsReaderImpl();
252 const fastdds::rtps::GUID_t& writer_guid,
253 const fastdds::rtps::Time_t& source_timestamp);
273 void on_subscribe_throughput(
281 friend class fastdds::rtps::RTPSMessageGroup;
348 friend class fastdds::rtps::RTPSMessageGroup;
This class is used to specify a sample.
Definition: SampleIdentity.hpp:34
Structure Time_t, used to describe times at RTPS protocol.
Definition: Time_t.hpp:38
Definition: StatisticsCommon.hpp:347
void on_acknack(int32_t)
Report that an ACKNACK message is sent Parameter: current count of ACKNACKs.
Definition: StatisticsCommon.hpp:369
void on_nackfrag(int32_t)
Report that a NACKFRAG message is sent Parameter: current count of NACKFRAGs.
Definition: StatisticsCommon.hpp:378
void on_data_notify(const fastdds::rtps::GUID_t &, const fastdds::rtps::Time_t &)
Report that a sample has been notified to the user.
Definition: StatisticsCommon.hpp:359
void on_subscribe_throughput(uint32_t)
Reports subscription throughtput based on last added sample to reader's history Parameter: size of th...
Definition: StatisticsCommon.hpp:387
Definition: StatisticsCommon.hpp:280
void on_publish_throughput(uint32_t)
Reports publication throughtput based on last added sample to writer's history Parameter: size of the...
Definition: StatisticsCommon.hpp:325
void on_gap()
Report that a GAP message is sent.
Definition: StatisticsCommon.hpp:331
void on_data_sent()
Notify listeners of DATA / DATA_FRAG counts.
Definition: StatisticsCommon.hpp:317
void on_data_generated(size_t)
Report that a DATA / DATA_FRAG message is generated Parameter: number of locators to which the messag...
Definition: StatisticsCommon.hpp:311
friend class fastdds::rtps::RTPSMessageGroup
Definition: StatisticsCommon.hpp:281
void on_resent_data(uint32_t)
Definition: StatisticsCommon.hpp:339
void on_heartbeat(uint32_t)
Report that a HEARTBEAT message is sent Parameter: current count of heartbeats.
Definition: StatisticsCommon.hpp:302
void on_sample_datas(const fastdds::rtps::SampleIdentity &, size_t)
Report a change on the number of DATA / DATAFRAG submessages sent for a specific sample.
Definition: StatisticsCommon.hpp:292
Structure GUID_t, entity identifier, unique in DDS-RTPS Domain.
Definition: Guid.hpp:40