From 0eafd0fed52367b7c2fb3c97c3b709b10b34e234 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Tue, 25 Jun 2013 19:46:40 +0200 Subject: [PATCH] add qps statistics --- pdns/dnsbulktest.cc | 3 ++- pdns/dnsdist.cc | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pdns/dnsbulktest.cc b/pdns/dnsbulktest.cc index e66fc9fa2b..6a22e617d6 100644 --- a/pdns/dnsbulktest.cc +++ b/pdns/dnsbulktest.cc @@ -238,8 +238,9 @@ int main(int argc, char** argv) vector domains; Inflighter, SendReceive> inflighter(domains, sr); - inflighter.d_maxInFlight = 100; + inflighter.d_maxInFlight = 1000; inflighter.d_timeoutSeconds = 3; + inflighter.d_burst = 100; string line; pair split; diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 35d497e12a..4e0dee9479 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -41,7 +41,7 @@ namespace po = boost::program_options; po::variables_map g_vm; bool g_verbose; -AtomicCounter g_pos; +AtomicCounter g_pos, g_numQueries; uint16_t g_maxOutstanding; void RuntimeError(const boost::format& fmt) @@ -165,7 +165,7 @@ void* clientThread(void* p) len = recvfrom(cs->fd, packet, sizeof(packet), 0, (struct sockaddr*) &remote, &socklen); if(len < 0) continue; - + g_numQueries++; /* right now, this is our simple round robin downstream selector */ DownstreamState& ss = g_dstates[(g_pos++) % g_numremotes]; unsigned int idOffset = (ss.idOffset++) % g_maxOutstanding; @@ -191,9 +191,10 @@ void* statThread(void*) int interval =g_vm["stats-interval"].as(); if(!interval) return 0; - + uint32_t lastQueries=0; for(;;) { sleep(interval); + unsigned int outstanding=0; for(unsigned int n=0; n < g_numremotes; ++n) { const DownstreamState& dss = g_dstates[n]; @@ -203,7 +204,8 @@ void* statThread(void*) outstanding++; } } - cout<