From e075bae3472aec1b88437c8c09e2e86ca669d1e0 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Fri, 5 Oct 2018 12:40:38 +0200 Subject: [PATCH] fix up reallylate count problem as spotted by @ph1 --- pdns/dnsscope.cc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pdns/dnsscope.cc b/pdns/dnsscope.cc index cd84b63a3a..3526bff595 100644 --- a/pdns/dnsscope.cc +++ b/pdns/dnsscope.cc @@ -193,7 +193,7 @@ try int dnserrors=0, parsefail=0; typedef map cumul_t; cumul_t cumul; - unsigned int untracked=0, errorresult=0, reallylate=0, nonRDQueries=0, queries=0; + unsigned int untracked=0, errorresult=0, nonRDQueries=0, queries=0; unsigned int ipv4DNSPackets=0, ipv6DNSPackets=0, fragmented=0, rdNonRAAnswers=0; unsigned int answers=0, nonDNSIP=0, rdFilterMismatch=0; unsigned int dnssecOK=0, edns=0; @@ -414,11 +414,11 @@ try uint32_t sum=0; // ofstream stats("stats"); - uint32_t totpackets=reallylate; + uint32_t totpairs=0; double tottime=0; for(cumul_t::const_iterator i=cumul.begin(); i!=cumul.end(); ++i) { // stats<first<<"\t"<<(sum+=i->second)<<"\n"; - totpackets+=i->second; + totpairs+=i->second; tottime+=i->first*i->second; } @@ -451,26 +451,29 @@ try sum=0; double lastperc=0, perc=0; + uint64_t lastsum=0; for(cumul_t::const_iterator i=cumul.begin(); i!=cumul.end(); ++i) { sum+=i->second; - for(done_t::iterator j=done.begin(); j!=done.end(); ++j) + for(done_t::iterator j=done.begin(); j!=done.end(); ++j) { if(!j->second && i->first > j->first) { j->second=true; - perc=sum*100.0/totpackets; + perc=sum*100.0/totpairs; if(j->first < 1024) cout<< perc <<"% of questions answered within " << j->first << " usec ("; else cout<< perc <<"% of questions answered within " << j->first/1000.0 << " msec ("; cout<first/1000000.0) <<" seconds"<().empty()) { ofstream load(g_vm["load-stats"].as().c_str()); -- 2.47.2