rippled
Loading...
Searching...
No Matches
TxMetrics.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2020 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_OVERLAY_TXMETRICS_H_INCLUDED
21#define RIPPLE_OVERLAY_TXMETRICS_H_INCLUDED
22
23#include <xrpl/json/json_value.h>
24#include <xrpl/protocol/messages.h>
25
26#include <boost/circular_buffer.hpp>
27
28#include <chrono>
29#include <mutex>
30
31namespace ripple {
32
33namespace metrics {
34
42{
47 SingleMetrics(bool ptu = true) : perTimeUnit(ptu)
48 {
49 }
51 clock_type::time_point intervalStart{clock_type::now()};
55 bool perTimeUnit{true};
56 boost::circular_buffer<std::uint64_t> rollingAvgAggreg{30, 0ull};
60 void
62};
63
67{
68 MultipleMetrics(bool ptu1 = true, bool ptu2 = true) : m1(ptu1), m2(ptu2)
69 {
70 }
71
77 void
83 void
85};
86
89{
91 // TMTransaction bytes and count per second
93 // TMHaveTransactions bytes and count per second
95 // TMGetLedger bytes and count per second
97 // TMLedgerData bytes and count per second
99 // TMTransactions bytes and count per second
101 // Peers selected to relay in each transaction sample average
103 // Peers suppressed to relay in each transaction sample average
105 // Peers with tx reduce-relay feature not enabled
107 // TMTransactions number of transactions count per second
113 void
114 addMetrics(protocol::MessageType type, std::uint32_t val);
120 void
122 std::uint32_t selected,
123 std::uint32_t suppressed,
128 void
129 addMetrics(std::uint32_t missing);
134 json() const;
135};
136
137} // namespace metrics
138
139} // namespace ripple
140
141#endif
Represents a JSON value.
Definition json_value.h:149
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
void addMetrics(std::uint32_t val2)
Add metrics to m2.
Definition TxMetrics.cpp:80
MultipleMetrics(bool ptu1=true, bool ptu2=true)
Definition TxMetrics.h:68
Run single metrics rolling average.
Definition TxMetrics.h:42
boost::circular_buffer< std::uint64_t > rollingAvgAggreg
Definition TxMetrics.h:56
clock_type::time_point intervalStart
Definition TxMetrics.h:51
SingleMetrics(bool ptu=true)
Class constructor.
Definition TxMetrics.h:47
void addMetrics(std::uint32_t val)
Add metrics value.
Definition TxMetrics.cpp:93
Run transaction reduce-relay feature related metrics.
Definition TxMetrics.h:89
SingleMetrics suppressedPeers
Definition TxMetrics.h:104
MultipleMetrics haveTx
Definition TxMetrics.h:94
MultipleMetrics transactions
Definition TxMetrics.h:100
MultipleMetrics getLedger
Definition TxMetrics.h:96
void addMetrics(protocol::MessageType type, std::uint32_t val)
Add protocol message metrics.
Definition TxMetrics.cpp:31
SingleMetrics selectedPeers
Definition TxMetrics.h:102
MultipleMetrics ledgerData
Definition TxMetrics.h:98
Json::Value json() const
Get json representation of the metrics.