diff --git a/receiver/CMakeLists.txt b/receiver/CMakeLists.txt index 7af4ec6b8f0c733c6abcebb3da93dc5d1a2ec948..66e3f287721a6746fd92b16e408cc8070c89b8c2 100644 --- a/receiver/CMakeLists.txt +++ b/receiver/CMakeLists.txt @@ -6,6 +6,7 @@ set(SOURCE_FILES src/request.cpp src/request_handler_file_write.cpp src/statistics.cpp + src/statistics_sender_influx_db.cpp ) @@ -34,6 +35,7 @@ set_property(TARGET ${TARGET_NAME} PROPERTY ENABLE_EXPORTS true) set(TEST_SOURCE_FILES unittests/test_receiver.cpp unittests/test_connection.cpp + unittests/test_statistics.cpp unittests/test_request.cpp unittests/test_request_handler_file_write.cpp ) diff --git a/receiver/src/connection.cpp b/receiver/src/connection.cpp index dcc74e7295b334fabc4dbc7cb26330494b1a7058..8cd2f4a1595832e172e1e01f0df236e8898b9b08 100644 --- a/receiver/src/connection.cpp +++ b/receiver/src/connection.cpp @@ -47,8 +47,8 @@ Error Connection::ProcessRequest(const std::unique_ptr<Request>& request) const void Connection::ProcessStatisticsAfterRequest(const std::unique_ptr<Request>& request) const noexcept { statistics__->IncreaseRequestCounter(); - statistics__->IncreaseRequestDataVolume(request->GetDataSize() + sizeof(GenericNetworkRequestHeader)+ - sizeof(GenericNetworkResponse)); + statistics__->IncreaseRequestDataVolume(request->GetDataSize() + sizeof(GenericNetworkRequestHeader) + + sizeof(GenericNetworkResponse)); statistics__->SendIfNeeded(); } diff --git a/receiver/src/request.cpp b/receiver/src/request.cpp index ed5e66997f8d9f8b32616e726d3d4556c65daa07..c1d4f0a979ad74778244d47b760425a6760e92b6 100644 --- a/receiver/src/request.cpp +++ b/receiver/src/request.cpp @@ -37,10 +37,12 @@ Error Request::Handle(std::unique_ptr<Statistics>* statistics) { } } for (auto handler : handlers_) { + (*statistics)->StartTimer(handler->GetStatisticEntity()); auto err = handler->ProcessRequest(*this); if (err) { return err; } + (*statistics)->StopTimer(); } return nullptr; } diff --git a/receiver/src/request_handler.h b/receiver/src/request_handler.h index 2d208c636cf6eb8d3e8a62c961ecb6c2db054584..179171dfe63fb594437c16b5e2801560ad0aca91 100644 --- a/receiver/src/request_handler.h +++ b/receiver/src/request_handler.h @@ -2,6 +2,7 @@ #define HIDRA2_REQUEST_HANDLER_H #include "receiver_error.h" +#include "statistics.h" namespace hidra2 { @@ -10,6 +11,7 @@ class Request; class RequestHandler { public: virtual Error ProcessRequest(const Request& request) const = 0; + virtual StatisticEntity GetStatisticEntity() const = 0; virtual ~RequestHandler() = default; private: }; diff --git a/receiver/src/request_handler_file_write.cpp b/receiver/src/request_handler_file_write.cpp index 3b1a3c2bc4925502ed2789d3ac3e121f459edebb..3db786945e361be77064ea2cb4929c5611b6d1c4 100644 --- a/receiver/src/request_handler_file_write.cpp +++ b/receiver/src/request_handler_file_write.cpp @@ -21,4 +21,9 @@ RequestHandlerFileWrite::RequestHandlerFileWrite() : io__{GenerateDefaultIO()} { } +StatisticEntity RequestHandlerFileWrite::GetStatisticEntity() const { + return StatisticEntity::kDisk; +} + + } diff --git a/receiver/src/request_handler_file_write.h b/receiver/src/request_handler_file_write.h index 8b9828ccd7310c98ea5d9ceaae4c66a4abb12d3f..af81e2d959b54099dea75f6d494725e0de2db14e 100644 --- a/receiver/src/request_handler_file_write.h +++ b/receiver/src/request_handler_file_write.h @@ -12,6 +12,7 @@ const uint64_t kMaxFileSize = uint64_t(1024) * 1024 * 1024 * 2; //2GB class RequestHandlerFileWrite final: public RequestHandler { public: RequestHandlerFileWrite(); + StatisticEntity GetStatisticEntity() const override; Error ProcessRequest(const Request& request) const override; std::unique_ptr<IO> io__; }; diff --git a/receiver/src/statistics.cpp b/receiver/src/statistics.cpp index 4435f928447781d843089672fe62dff1f364991a..5d1443963e88aecf6db9d8c66b6ef8658ecdd09c 100644 --- a/receiver/src/statistics.cpp +++ b/receiver/src/statistics.cpp @@ -1,33 +1,41 @@ #include "statistics.h" +#include "statistics_sender_influx_db.h" using std::chrono::high_resolution_clock; namespace hidra2 { -void Statistics::SendIfNeeded() const { - +void Statistics::SendIfNeeded() noexcept { + auto elapsed_ms = GetTotalElapsedMs(); + if (elapsed_ms > write_interval_) { + statistics_sender__->SendStatistics(PrepareStatisticsToSend()); + ResetStatistics(); + } } -double Statistics::GetRate() const noexcept { - auto elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds> - ( high_resolution_clock::now() - last_timepoint_).count(); - if (elapsed_ms == 0) { - return 0.0; - } else { - return double(nrequests_) / elapsed_ms * 1000.0; +StatisticsToSend Statistics::PrepareStatisticsToSend() const noexcept { + StatisticsToSend stat; + stat.n_requests = nrequests_; + stat.data_volume = volume_counter_; + stat.elapsed_ms = GetTotalElapsedMs(); + for (auto i=0;i<kNStatisticEntities;i++){ + stat.entity_shares[i] = double(GetElapsedMs(StatisticEntity(i)))/stat.elapsed_ms; } + return stat; } -double Statistics::GetBandwidth() const noexcept { - auto elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds> - ( high_resolution_clock::now() - last_timepoint_).count(); - if (elapsed_ms == 0) { - return 0.0; - } else { - return double(volume_counter_) / elapsed_ms * 1000.0 / (1024.0 * 1024.0 * 1024.0); - } +uint64_t Statistics::GetTotalElapsedMs() const noexcept { + return std::chrono::duration_cast<std::chrono::milliseconds> + ( high_resolution_clock::now() - last_timepoint_).count(); } +uint64_t Statistics::GetElapsedMs(StatisticEntity entity) const noexcept { + return std::chrono::duration_cast<std::chrono::milliseconds>(time_counters_[current_statistic_entity_]).count(); +} + +void Statistics::SetWriteInterval(uint64_t interval_ms) { + write_interval_ = interval_ms; +} void Statistics::ResetStatistics() noexcept { last_timepoint_ = high_resolution_clock::now(); @@ -42,7 +50,7 @@ void Statistics::IncreaseRequestCounter() noexcept { nrequests_++; } -Statistics::Statistics() { +Statistics::Statistics(unsigned int write_frequency) : statistics_sender__{new StatisticsSenderInfluxDb},write_interval_{write_frequency}{ ResetStatistics(); } diff --git a/receiver/src/statistics.h b/receiver/src/statistics.h index a24b74da8775e322e6229e942afad05532c15344..78efec123f5e4ceeac553d20f9b9f1bb1967797a 100644 --- a/receiver/src/statistics.h +++ b/receiver/src/statistics.h @@ -2,34 +2,51 @@ #define HIDRA2_STATISTICS_H #include <chrono> +#include <memory> + +#include "statistics_sender.h" namespace hidra2 { +static const auto kNStatisticEntities = 3; enum StatisticEntity : int { kDatabase = 0, kDisk, kNetwork, }; +struct StatisticsToSend { + double entity_shares[kNStatisticEntities]; + uint64_t elapsed_ms; + uint64_t data_volume; + uint64_t n_requests; +}; + class Statistics { public: - virtual void SendIfNeeded() const; - Statistics(); - double GetRate() const noexcept; - double GetBandwidth() const noexcept; - void IncreaseRequestCounter() noexcept; - void StartTimer(const StatisticEntity& entity) noexcept; - void IncreaseRequestDataVolume(uint64_t transferred_data_volume) noexcept; - void StopTimer() noexcept; +// virtual needed for unittests, could be replaced with #define VIRTUAL ... in case of performance issues + virtual void SendIfNeeded() noexcept; + explicit Statistics(unsigned int write_interval = kDefaultStatisticWriteIntervalMs); + virtual void IncreaseRequestCounter() noexcept; + virtual void StartTimer(const StatisticEntity& entity) noexcept; + virtual void IncreaseRequestDataVolume(uint64_t transferred_data_volume) noexcept; + virtual void StopTimer() noexcept; + + void SetWriteInterval(uint64_t interval_ms); + std::unique_ptr<StatisticsSender> statistics_sender__; private: + uint64_t GetElapsedMs(StatisticEntity entity) const noexcept; void ResetStatistics() noexcept; - static const auto kNStatisticEntities = 3; + uint64_t GetTotalElapsedMs() const noexcept; + StatisticsToSend PrepareStatisticsToSend() const noexcept; + static const unsigned int kDefaultStatisticWriteIntervalMs = 10000; uint64_t nrequests_; std::chrono::high_resolution_clock::time_point last_timepoint_; std::chrono::high_resolution_clock::time_point current_timer_last_timepoint_; StatisticEntity current_statistic_entity_ = StatisticEntity::kDatabase; std::chrono::nanoseconds time_counters_[kNStatisticEntities]; uint64_t volume_counter_; + unsigned int write_interval_; }; diff --git a/receiver/src/statistics_sender.h b/receiver/src/statistics_sender.h new file mode 100644 index 0000000000000000000000000000000000000000..a079f4f5b703fc3b3eb7b0df4e9aa7398525866d --- /dev/null +++ b/receiver/src/statistics_sender.h @@ -0,0 +1,18 @@ +#ifndef HIDRA2_STATISTICS_SENDER_H +#define HIDRA2_STATISTICS_SENDER_H + +#include <cstdint> + +namespace hidra2 { + +struct StatisticsToSend; + +class StatisticsSender { + public: + virtual void SendStatistics(const StatisticsToSend& statistic) const noexcept = 0; + virtual ~StatisticsSender() = default; +}; + +} + +#endif //HIDRA2_STATISTICS_SENDER_H diff --git a/receiver/src/statistics_sender_influx_db.cpp b/receiver/src/statistics_sender_influx_db.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bcdafda4f3fd5f964e40dcddafff8a54018377db --- /dev/null +++ b/receiver/src/statistics_sender_influx_db.cpp @@ -0,0 +1,11 @@ +#include "statistics_sender_influx_db.h" +#include "statistics.h" + +namespace hidra2 { + +void StatisticsSenderInfluxDb::SendStatistics(const StatisticsToSend& statistic) const noexcept { + +} + + +} diff --git a/receiver/src/statistics_sender_influx_db.h b/receiver/src/statistics_sender_influx_db.h new file mode 100644 index 0000000000000000000000000000000000000000..908bfeafcce40589bd67fd17569c36ed86c51ebf --- /dev/null +++ b/receiver/src/statistics_sender_influx_db.h @@ -0,0 +1,14 @@ +#ifndef HIDRA2_STATISTICS_SENDER_INFLUX_DB_H +#define HIDRA2_STATISTICS_SENDER_INFLUX_DB_H + +#include "statistics_sender.h" + +namespace hidra2 { + +class StatisticsSenderInfluxDb : public StatisticsSender{ + virtual void SendStatistics(const StatisticsToSend& statistic) const noexcept override; +}; + +} + +#endif //HIDRA2_STATISTICS_SENDER_INFLUX_DB_H diff --git a/receiver/unittests/mock_statistics.h b/receiver/unittests/mock_statistics.h new file mode 100644 index 0000000000000000000000000000000000000000..1d7077fadb8a930b33e4808216cf1c5978278a6d --- /dev/null +++ b/receiver/unittests/mock_statistics.h @@ -0,0 +1,41 @@ +#ifndef HIDRA2_MOCK_STATISTICS_H +#define HIDRA2_MOCK_STATISTICS_H + +#include <gtest/gtest.h> +#include <gmock/gmock.h> + +#include "../src/statistics.h" + +namespace hidra2 { + +class MockStatistics : public hidra2::Statistics { + public: + void SendIfNeeded() noexcept override { + SendIfNeeded_t(); + } + void IncreaseRequestCounter() noexcept override { + IncreaseRequestCounter_t(); + } + void StartTimer(const hidra2::StatisticEntity &entity) noexcept override { + StartTimer_t(entity); + } + void IncreaseRequestDataVolume(uint64_t transferred_data_volume) noexcept override { + IncreaseRequestDataVolume_t(transferred_data_volume); + } + void StopTimer() noexcept override { + StopTimer_t(); + } + + MOCK_METHOD0(SendIfNeeded_t, void()); + MOCK_METHOD0(IncreaseRequestCounter_t, void()); + MOCK_METHOD0(StopTimer_t, void()); + MOCK_METHOD1(IncreaseRequestDataVolume_t, void (uint64_t + transferred_data_volume)); + MOCK_METHOD1(StartTimer_t, void( + const hidra2::StatisticEntity &entity)); + +}; + +} + +#endif //HIDRA2_MOCK_STATISTICS_H diff --git a/receiver/unittests/test_connection.cpp b/receiver/unittests/test_connection.cpp index 14b25f1ec4d83e37af6dca4a39406dd8e7f6021e..ccdfb640a9d65756166a439662380ac8550c051f 100644 --- a/receiver/unittests/test_connection.cpp +++ b/receiver/unittests/test_connection.cpp @@ -1,10 +1,12 @@ #include <gtest/gtest.h> #include <gmock/gmock.h> #include <unittests/MockIO.h> + #include "../src/connection.h" #include "../src/receiver_error.h" #include "../src/request.h" #include "../src/statistics.h" +#include "mock_statistics.h" using ::testing::Test; using ::testing::Return; @@ -33,6 +35,8 @@ using ::hidra2::Connection; using ::hidra2::MockIO; using hidra2::Request; using hidra2::Statistics; +using hidra2::StatisticEntity; +using hidra2::MockStatistics; namespace { @@ -55,10 +59,6 @@ class MockRequest: public Request { MOCK_CONST_METHOD0(Handle_t, ErrorInterface * ()); }; -class MockStatistics: public Statistics { - public: - MOCK_CONST_METHOD0(SendIfNeeded, void ()); -}; class MockRequestFactory: public hidra2::RequestFactory { public: @@ -82,7 +82,7 @@ class ConnectionTests : public Test { Connection connection{0, "some_address"}; MockIO mock_io; MockRequestFactory mock_factory; - MockStatistics mock_statictics; + NiceMock<MockStatistics> mock_statictics; void SetUp() override { connection.io__ = std::unique_ptr<hidra2::IO> {&mock_io}; connection.statistics__ = std::unique_ptr<hidra2::Statistics> {&mock_statictics}; @@ -200,7 +200,9 @@ TEST_F(ConnectionTests, SendsErrorToProducer) { } -void MockExitCycle(const MockIO& mock_io) { +void MockExitCycle(const MockIO& mock_io, MockStatistics& mock_statictics) { + EXPECT_CALL(mock_statictics, StartTimer_t(StatisticEntity::kNetwork)); + EXPECT_CALL(mock_io, ReceiveWithTimeout_t(_, _, _, _, _)) .WillOnce( DoAll(SetArgPointee<4>(new hidra2::IOError("", hidra2::IOErrorType::kUnknownIOError)), @@ -221,8 +223,12 @@ MockRequest* MockWaitRequest(const MockRequestFactory& mock_factory) { TEST_F(ConnectionTests, FillsStatistics) { InSequence sequence; + EXPECT_CALL(mock_statictics, StartTimer_t(StatisticEntity::kNetwork)); + EXPECT_CALL(mock_io, ReceiveWithTimeout_t(_, _, _, _, _)); + EXPECT_CALL(mock_statictics, StopTimer_t()); + auto request = MockWaitRequest(mock_factory); EXPECT_CALL(*request, Handle_t()).WillOnce( @@ -235,17 +241,21 @@ TEST_F(ConnectionTests, FillsStatistics) { Return(0) )); - EXPECT_CALL(mock_statictics, SendIfNeeded()); - MockExitCycle(mock_io); + EXPECT_CALL(mock_statictics, IncreaseRequestCounter_t()); + + EXPECT_CALL(mock_statictics, IncreaseRequestDataVolume_t(1 + sizeof(hidra2::GenericNetworkRequestHeader) + + sizeof(hidra2::GenericNetworkResponse))); + + + EXPECT_CALL(mock_statictics, SendIfNeeded_t()); + + MockExitCycle(mock_io, mock_statictics); connection.Listen(); std::this_thread::sleep_for(std::chrono::milliseconds(1)); - ASSERT_THAT(connection.statistics__->GetRate(), Gt(0.0)); - ASSERT_THAT(connection.statistics__->GetBandwidth(), Gt(0.0)); - } diff --git a/receiver/unittests/test_request.cpp b/receiver/unittests/test_request.cpp index 531826d443ddd25f2dfc6c03b1e1df24431f7d7a..278e149a553fea6191d408142f9af95bd23ec2b3 100644 --- a/receiver/unittests/test_request.cpp +++ b/receiver/unittests/test_request.cpp @@ -6,6 +6,7 @@ #include "../src/request.h" #include "../src/request_handler.h" #include "../src/request_handler_file_write.h" +#include "mock_statistics.h" using ::testing::Test; using ::testing::Return; @@ -31,6 +32,9 @@ using ::hidra2::Opcode; using ::hidra2::Connection; using ::hidra2::MockIO; using hidra2::Request; +using hidra2::MockStatistics; + +using hidra2::StatisticEntity; namespace { @@ -40,6 +44,10 @@ class MockReqestHandler : public hidra2::RequestHandler { return Error{ProcessRequest_t(request)}; } + StatisticEntity GetStatisticEntity() const { + return StatisticEntity::kDisk; + } + MOCK_CONST_METHOD1(ProcessRequest_t, ErrorInterface * (const Request& request)); }; @@ -125,6 +133,9 @@ TEST_F(RequestTests, HandleReturnsErrorOnDataReceive) { TEST_F(RequestTests, HandleProcessesRequests) { MockReqestHandler mock_request_handler; + MockStatistics mock_statistics; + + auto stat = std::unique_ptr<hidra2::Statistics>{&mock_statistics}; EXPECT_CALL(mock_request_handler, ProcessRequest_t(_)).WillOnce( Return(nullptr) @@ -135,9 +146,15 @@ TEST_F(RequestTests, HandleProcessesRequests) { request->AddHandler(&mock_request_handler); request->AddHandler(&mock_request_handler); - auto err = request->Handle(nullptr); + EXPECT_CALL(mock_statistics, StartTimer_t(hidra2::StatisticEntity::kDisk)).Times(2); + + EXPECT_CALL(mock_statistics, StopTimer_t()); + + + auto err = request->Handle(&stat); ASSERT_THAT(err, Eq(hidra2::IOErrorTemplates::kUnknownIOError)); + stat.release(); } TEST_F(RequestTests, DataIsNullAtInit) { diff --git a/receiver/unittests/test_request_handler_file_write.cpp b/receiver/unittests/test_request_handler_file_write.cpp index 7c3dc1d09a1f0cc8396cd961e1c5ac7de93a986d..5640ce4539a64d0dc036a2f5731e5c91bb06804e 100644 --- a/receiver/unittests/test_request_handler_file_write.cpp +++ b/receiver/unittests/test_request_handler_file_write.cpp @@ -62,6 +62,12 @@ class FileWriteHandlerTests : public Test { }; +TEST_F(FileWriteHandlerTests, CheckStatisticEntity) { + auto entity = handler.GetStatisticEntity(); + ASSERT_THAT(entity, Eq(hidra2::StatisticEntity::kDisk)); +} + + TEST_F(FileWriteHandlerTests, ErrorWhenZeroFileSize) { EXPECT_CALL(*mock_request, GetDataSize()) .WillOnce(Return(0)) diff --git a/receiver/unittests/test_statistics.cpp b/receiver/unittests/test_statistics.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c85f2eaf45e402dcccd3133191d3d6b9bb251fc7 --- /dev/null +++ b/receiver/unittests/test_statistics.cpp @@ -0,0 +1,167 @@ +#include <gtest/gtest.h> +#include <gmock/gmock.h> +#include <thread> + +#include "../src/statistics.h" +#include "../src/statistics_sender.h" +#include "../src/statistics_sender_influx_db.h" + +using ::testing::Test; +using ::testing::Gt; +using ::testing::Ge; +using ::testing::Eq; +using ::testing::Ne; +using ::testing::Ref; +using ::testing::_; + +using hidra2::Statistics; +using hidra2::StatisticEntity; +using hidra2::StatisticsSender; +using hidra2::StatisticsSenderInfluxDb; +using hidra2::StatisticsToSend; + + + +namespace { + + +TEST(StatisticTestsConstructor, Constructor) { + Statistics statistics; + ASSERT_THAT(dynamic_cast<hidra2::StatisticsSenderInfluxDb*>(statistics.statistics_sender__.get()), Ne(nullptr)); +} + + +class MockStatisticsSender: public StatisticsSender { + public: + void SendStatistics(const StatisticsToSend& statistics) const noexcept override { + SendStatistics_t(statistics); + } + MOCK_CONST_METHOD1(SendStatistics_t, void (const StatisticsToSend&)); +}; + +class StatisticTests : public Test { + public: + Statistics statistics{0}; + void TestTimer(const StatisticEntity& entity); + MockStatisticsSender mock_statistics_sender; + void SetUp() override { + statistics.statistics_sender__.reset(&mock_statistics_sender); + } + void TearDown() override { + statistics.statistics_sender__.release(); + } + StatisticsToSend ExtractStat(); +}; + + +ACTION_P(SaveArg1ToSendStat, value) { + auto resp = static_cast<const StatisticsToSend&>(arg0); + value->n_requests = resp.n_requests; + value->data_volume = resp.data_volume; + value->elapsed_ms = resp.elapsed_ms; + for (int i=0;i<hidra2::kNStatisticEntities;i++){ + value->entity_shares[i] = resp.entity_shares[i]; + } + +} + + +StatisticsToSend StatisticTests::ExtractStat() { + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + StatisticsToSend stat; + stat.elapsed_ms = 0; + stat.n_requests = 0; + stat.data_volume = 0; + for (int i=0;i<hidra2::kNStatisticEntities;i++){ + stat.entity_shares[i] = 0.0; + } + + EXPECT_CALL(mock_statistics_sender,SendStatistics_t(_)). + WillOnce(SaveArg1ToSendStat(&stat)); + + statistics.SendIfNeeded(); + return stat; +} + +TEST_F(StatisticTests, IncreaseRequestCounter) { + statistics.IncreaseRequestCounter(); + + auto stat = ExtractStat(); + + ASSERT_THAT(stat.n_requests, Eq(1)); +} + +TEST_F(StatisticTests, StatisticsResetAfterSend) { + statistics.IncreaseRequestCounter(); + + ExtractStat(); + auto stat = ExtractStat(); + + ASSERT_THAT(stat.n_requests, Eq(0)); +} + + +TEST_F(StatisticTests, ElapsedTime) { + + auto stat = ExtractStat(); + + ASSERT_THAT(stat.elapsed_ms, Ge(1)); +} + + + +TEST_F(StatisticTests, RequestCounterZeroAtInit) { + auto stat = ExtractStat(); + + ASSERT_THAT(stat.n_requests, Eq(0)); +} + +TEST_F(StatisticTests, GetDataVolume) { + statistics.IncreaseRequestDataVolume(100); + + auto stat = ExtractStat(); + + ASSERT_THAT(stat.data_volume, Eq(100)); +} + +TEST_F(StatisticTests, DataVolumeZeroAtInit) { + auto stat = ExtractStat(); + + ASSERT_THAT(stat.data_volume, Eq(0)); +} + +void StatisticTests::TestTimer(const StatisticEntity& entity){ + statistics.StartTimer(entity); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + + statistics.StopTimer(); + + auto stat = ExtractStat(); + + ASSERT_THAT(stat.entity_shares[entity], Ge(0.25)); + +} + +TEST_F(StatisticTests, TimerForDatabase) { + TestTimer(StatisticEntity::kDatabase); +} + +TEST_F(StatisticTests, TimerForNetwork) { + TestTimer(StatisticEntity::kNetwork); +} + +TEST_F(StatisticTests, TimerForDisk) { + TestTimer(StatisticEntity::kDisk); +} + + +TEST_F(StatisticTests, SendStaticsDoesCallsSender) { + statistics.SetWriteInterval(1000); + + EXPECT_CALL(mock_statistics_sender,SendStatistics_t(_)).Times(0); + + statistics.SendIfNeeded(); +} + + +}