Skip to content

Commit 98d0975

Browse files
committed
Introduce Endpoint#messages_received_per_type
1 parent 3dd7b15 commit 98d0975

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

lib/remote/endpoint.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,16 @@ double Endpoint::GetBytesReceivedPerSecond() const
149149
{
150150
return m_BytesReceived.CalculateRate(Utility::GetTime(), 60);
151151
}
152+
153+
Dictionary::Ptr Endpoint::GetMessagesReceivedPerType() const
154+
{
155+
DictionaryData result;
156+
157+
for (auto& [afunc, cnt] : m_MessageCounters) {
158+
if (auto v (cnt.load(std::memory_order_relaxed)); v) {
159+
result.emplace_back(afunc->GetName(), v);
160+
}
161+
}
162+
163+
return new Dictionary(std::move(result));
164+
}

lib/remote/endpoint.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class Endpoint final : public ObjectImpl<Endpoint>
5656
double GetBytesSentPerSecond() const override;
5757
double GetBytesReceivedPerSecond() const override;
5858

59+
Dictionary::Ptr GetMessagesReceivedPerType() const override;
60+
5961
protected:
6062
void OnAllConfigLoaded() override;
6163

lib/remote/endpoint.ti

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ class Endpoint : ConfigObject
5454
[no_user_modify, no_storage] double bytes_received_per_second {
5555
get;
5656
};
57+
58+
[no_user_modify, no_storage] Dictionary::Ptr messages_received_per_type {
59+
get;
60+
};
5761
};
5862

5963
}

0 commit comments

Comments
 (0)