From: bert hubert Date: Sat, 15 Mar 2014 21:29:15 +0000 (+0100) Subject: hook up -l in dnsscope to emit per second statistics X-Git-Tag: rec-3.6.0-rc1~133 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9a07e3428b02f99d032b2438466eb04a3d88538b;p=thirdparty%2Fpdns.git hook up -l in dnsscope to emit per second statistics --- diff --git a/pdns/dnsscope.cc b/pdns/dnsscope.cc index ab30fcfa68..ce31be2218 100644 --- a/pdns/dnsscope.cc +++ b/pdns/dnsscope.cc @@ -77,6 +77,7 @@ try ("rd", po::value(), "If set to true, only process RD packets, to false only non-RD, unset: both") ("ipv4", po::value()->default_value(true), "Process IPv4 packets") ("ipv6", po::value()->default_value(true), "Process IPv6 packets") + ("load-stats,l", po::value()->default_value(""), "if set, emit per-second load statistics (questions, answers, outstanding)") ("write-failures,w", po::value()->default_value(""), "if set, write weird packets to this PCAP file") ("verbose,v", "be verbose"); @@ -326,15 +327,18 @@ try lastperc=sum*100.0/totpackets; } } - - // ofstream load("load"); - // BOOST_FOREACH(pcounts_t::value_type& val, pcounts) { - // load<().empty()) { + ofstream load(g_vm["load-stats"].as().c_str()); + if(!load) + throw runtime_error("Error writing load statistics to "+g_vm["load-stats"].as()); + BOOST_FOREACH(pcounts_t::value_type& val, pcounts) { + load<