20#ifndef RIPPLE_OVERLAY_TRAFFIC_H_INCLUDED
21#define RIPPLE_OVERLAY_TRAFFIC_H_INCLUDED
23#include <xrpl/beast/utility/instrumentation.h>
24#include <xrpl/protocol/messages.h>
206 ::google::protobuf::Message
const& message,
207 protocol::MessageType type,
216 "ripple::TrafficCount::addCount : valid category input");
226 it->second.bytesIn += bytes;
227 ++it->second.messagesIn;
231 it->second.bytesOut += bytes;
232 ++it->second.messagesOut;
267 {
ld_tsc_get,
"ledger_data_Transaction_Set_candidate_get"},
268 {
ld_tsc_share,
"ledger_data_Transaction_Set_candidate_share"},
269 {
ld_txn_get,
"ledger_data_Transaction_Node_get"},
271 {
ld_asn_get,
"ledger_data_Account_State_Node_get"},
273 {
ld_get,
"ledger_data_get"},
275 {
gl_tsc_share,
"ledger_Transaction_Set_candidate_share"},
276 {
gl_tsc_get,
"ledger_Transaction_Set_candidate_get"},
280 {
gl_asn_get,
"ledger_Account_State_node_get"},
306 if (
auto it = category_map.
find(cat); it != category_map.
end())
TrafficStats(TrafficStats const &ts)
std::atomic< std::uint64_t > bytesOut
TrafficStats(TrafficCount::category cat)
std::atomic< std::uint64_t > messagesOut
std::atomic< std::uint64_t > messagesIn
std::atomic< std::uint64_t > bytesIn
TrafficCount is used to count ingress and egress wire bytes and number of messages.
auto const & getCounts() const
An up-to-date copy of all the counters.
std::unordered_map< category, TrafficStats > counts_
static category categorize(::google::protobuf::Message const &message, protocol::MessageType type, bool inbound)
Given a protocol message, determine which traffic category it belongs to.
static std::string to_string(category cat)
void addCount(category cat, bool inbound, int bytes)
Account for traffic associated with the given category.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.