From: Bert Hubert Date: Thu, 16 Sep 2010 21:10:02 +0000 (+0000) Subject: add loads of statistics to dnsbulktest, no worries X-Git-Tag: rec-3.3~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=830515d84d6ed86eaeaa63eb68b7291cd62d67bf;p=pdns add loads of statistics to dnsbulktest, no worries git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1718 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/dnsbulktest.cc b/pdns/dnsbulktest.cc index 9aed7a1c5..7b2903df0 100644 --- a/pdns/dnsbulktest.cc +++ b/pdns/dnsbulktest.cc @@ -1,3 +1,7 @@ +#include +#include +#include +#include #include "inflighter.cc" #include #include "namespaces.hh" @@ -7,6 +11,9 @@ #include "dnswriter.hh" #include "dnsrecords.hh" +using namespace boost::accumulators; +using namespace boost; + StatBag S; struct DNSResult @@ -16,6 +23,8 @@ struct DNSResult bool seenauthsoa; }; +// = + struct SendReceive { typedef int Identifier; @@ -24,8 +33,24 @@ struct SendReceive deque d_idqueue; - SendReceive(const std::string& remoteAddr, uint16_t port) + typedef accumulator_set< + double + , stats + > acc_t; + acc_t* d_acc; + + boost::array d_probs; + + SendReceive(const std::string& remoteAddr, uint16_t port) { + boost::array tmp ={{0.001,0.01, 0.025, 0.1, 0.25,0.5,0.75,0.9,0.975, 0.99,0.9999}}; + d_probs = tmp; + d_acc = new acc_t(boost::accumulators::tag::extended_p_square::probabilities=d_probs); + // + //d_acc = acc_t d_socket = socket(AF_INET, SOCK_DGRAM, 0); int val=1; setsockopt(d_socket, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)); @@ -110,9 +135,12 @@ struct SendReceive d_idqueue.push_back(id); } - void deliverAnswer(string& domain, const DNSResult& dr) + void deliverAnswer(string& domain, const DNSResult& dr, unsigned int usec) { - cout< 1000000) + // cerr<<"Slow: "< domains; Inflighter, SendReceive> inflighter(domains, sr); - inflighter.d_maxInFlight = 1000; + inflighter.d_maxInFlight = 100; inflighter.d_timeoutSeconds = 3; string line; @@ -176,7 +206,7 @@ int main(int argc, char** argv) inflighter.run(); break; } - catch(exception& e) { + catch(std::exception& e) { cerr<<"Caught exception: "< >::iterator > histogram_type; + + boost::format statfmt("Time < %6.01f msec %|30t|%6.03f%% cumulative\n"); + + for (unsigned int i = 0; i < sr.d_probs.size(); ++i) { + cerr << statfmt % extended_p_square(*sr.d_acc)[i] % (100*sr.d_probs[i]); + } + + + }