From 3ebbfc60851faaab581cb5dbefe48defb431a2f0 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 10 Dec 2024 16:19:10 +0100 Subject: [PATCH] Introduce Endpoint#seconds_{reading,processing}_messages for the API --- lib/base/benchmark.hpp | 2 +- lib/remote/endpoint.cpp | 10 ++++++++++ lib/remote/endpoint.hpp | 3 +++ lib/remote/endpoint.ti | 8 ++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/base/benchmark.hpp b/lib/base/benchmark.hpp index 4c2c5f71595..01dd2fb5c0f 100644 --- a/lib/base/benchmark.hpp +++ b/lib/base/benchmark.hpp @@ -25,7 +25,7 @@ class Benchmark * @return The total accumulated time in seconds */ template - explicit operator T() const noexcept + operator T() const noexcept { return std::chrono::duration(Clock::duration(m_Sum.load(std::memory_order_relaxed))).count(); } diff --git a/lib/remote/endpoint.cpp b/lib/remote/endpoint.cpp index e534fc17840..1ad1c1c2bc8 100644 --- a/lib/remote/endpoint.cpp +++ b/lib/remote/endpoint.cpp @@ -136,3 +136,13 @@ double Endpoint::GetBytesReceivedPerSecond() const { return m_BytesReceived.CalculateRate(Utility::GetTime(), 60); } + +double Endpoint::GetSecondsReadingMessages() const +{ + return m_InputReadTime; +} + +double Endpoint::GetSecondsProcessingMessages() const +{ + return m_InputProcessTime; +} diff --git a/lib/remote/endpoint.hpp b/lib/remote/endpoint.hpp index 48b09b9d6c0..2fc6683f1fa 100644 --- a/lib/remote/endpoint.hpp +++ b/lib/remote/endpoint.hpp @@ -57,6 +57,9 @@ class Endpoint final : public ObjectImpl double GetBytesSentPerSecond() const override; double GetBytesReceivedPerSecond() const override; + double GetSecondsReadingMessages() const override; + double GetSecondsProcessingMessages() const override; + protected: void OnAllConfigLoaded() override; diff --git a/lib/remote/endpoint.ti b/lib/remote/endpoint.ti index 78551ecf0dd..c9870bc603a 100644 --- a/lib/remote/endpoint.ti +++ b/lib/remote/endpoint.ti @@ -54,6 +54,14 @@ class Endpoint : ConfigObject [no_user_modify, no_storage] double bytes_received_per_second { get; }; + + [no_user_modify, no_storage] double seconds_reading_messages { + get; + }; + + [no_user_modify, no_storage] double seconds_processing_messages { + get; + }; }; }