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>
208 ::google::protobuf::Message
const& message,
209 protocol::MessageType type,
218 "ripple::TrafficCount::addCount : valid category input");
228 it->second.bytesIn += bytes;
229 ++it->second.messagesIn;
233 it->second.bytesOut += bytes;
234 ++it->second.messagesOut;
270 {
ld_tsc_get,
"ledger_data_Transaction_Set_candidate_get"},
271 {
ld_tsc_share,
"ledger_data_Transaction_Set_candidate_share"},
272 {
ld_txn_get,
"ledger_data_Transaction_Node_get"},
274 {
ld_asn_get,
"ledger_data_Account_State_Node_get"},
276 {
ld_get,
"ledger_data_get"},
278 {
gl_tsc_share,
"ledger_Transaction_Set_candidate_share"},
279 {
gl_tsc_get,
"ledger_Transaction_Set_candidate_get"},
283 {
gl_asn_get,
"ledger_Account_State_node_get"},
309 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.