(except in cases that are shared by with auth).
I changed two AtomicCounters to atomic<int32>; their range is limited and
they are not updated very frequently.
#pragma once
#include <algorithm>
-#include <atomic>
#include <limits>
#include <stdexcept>
#include <string>
#include <vector>
+#include "stat_t.hh"
+
namespace pdns
{
const std::string d_name;
const uint64_t d_boundary{0};
- mutable std::atomic<uint64_t> d_count{0};
+ mutable stat_t d_count{0};
};
template <class B, class SumType>
using Histogram = BaseHistogram<Bucket, uint64_t>;
-using AtomicHistogram = BaseHistogram<AtomicBucket, std::atomic<uint64_t>>;
+using AtomicHistogram = BaseHistogram<AtomicBucket, pdns::stat_t>;
} // namespace pdns
static listenSocketsAddresses_t g_listenSocketsAddresses; // is shared across all threads right now
static set<int> g_fromtosockets; // listen sockets that use 'sendfromto()' mechanism (without actually using sendfromto())
-static AtomicCounter counter;
+static std::atomic<uint32_t> counter;
static std::shared_ptr<SyncRes::domainmap_t> g_initialDomainMap; // new threads needs this to be setup
static std::shared_ptr<NetmaskGroup> g_initialAllowFrom; // new thread needs to be setup with this
static NetmaskGroup g_XPFAcl;
--s_currentConnections;
}
-AtomicCounter TCPConnection::s_currentConnections;
+std::atomic<uint32_t> TCPConnection::s_currentConnections;
static void terminateTCPConnection(int fd)
{
#include <array>
#include "histogram.hh"
+#include "stat_t.hh"
#include "dnspacket.hh"
private:
struct Counter
{
- mutable std::atomic<uint64_t> value;
+ mutable pdns::stat_t value;
};
std::array<Counter, 65536> d_qtypecounters;
pdns::AtomicHistogram cumulativeAnswers;
pdns::AtomicHistogram cumulativeAuth4Answers;
pdns::AtomicHistogram cumulativeAuth6Answers;
- std::atomic<double> avgLatencyUsec;
- std::atomic<double> avgLatencyOursUsec;
+ pdns::stat_t_trait<double> avgLatencyUsec;
+ pdns::stat_t_trait<double> avgLatencyOursUsec;
pdns::stat_t qcounter; // not increased for unauth packets
pdns::stat_t ipv6qcounter;
pdns::stat_t tcpqcounter;
static unsigned int getCurrentConnections() { return s_currentConnections; }
private:
const int d_fd;
- static AtomicCounter s_currentConnections; //!< total number of current TCP connections
+ static std::atomic<uint32_t> s_currentConnections; //!< total number of current TCP connections
};
class ImmediateServFailException