rec_channel.o rec_channel_rec.o selectmplexer.o sillyrecords.o \
dns_random.o ext/polarssl-1.3.2/library/aes.o ext/polarssl-1.3.2/library/padlock.o dnslabeltext.o \
lua-pdns.o lua-recursor.o randomhelper.o recpacketcache.o dns.o \
-reczones.o base32.o nsecrecords.o json.o json_ws.o version.o
+reczones.o base32.o nsecrecords.o json.o json_ws.o version.o responsestats.o
REC_CONTROL_OBJECTS=rec_channel.o rec_control.o arguments.o misc.o \
unix_utility.o logger.o qtype.o
sstuff.hh mtasker.hh mtasker.cc lwres.hh logger.hh pdnsexception.hh \
mplexer.hh \
dns_random.hh lua-pdns.hh lua-recursor.hh namespaces.hh \
-recpacketcache.hh base32.hh cachecleaner.hh json.hh version.hh"
+recpacketcache.hh base32.hh cachecleaner.hh json.hh version.hh \
+responsestats.hh"
CFILES="syncres.cc misc.cc unix_utility.cc qtype.cc \
logger.cc arguments.cc lwres.cc pdns_recursor.cc \
selectmplexer.cc epollmplexer.cc kqueuemplexer.cc portsmplexer.cc pdns_hw.cc \
sillyrecords.cc lua-pdns.cc lua-recursor.cc randomhelper.cc \
devpollmplexer.cc recpacketcache.cc dns.cc reczones.cc base32.cc nsecrecords.cc \
-dnslabeltext.cc json.cc json_ws.cc json_ws.hh version.cc dns_random.cc"
+dnslabeltext.cc json.cc json_ws.cc json_ws.hh version.cc dns_random.cc \
+responsestats.cc"
cd docs
make pdns_recursor.1 rec_control.1
#include "communicator.hh"
#include "dnsseckeeper.hh"
#include "nameserver.hh"
+#include "responsestats.hh"
+
+extern ResponseStats g_rs;
static bool s_pleasequit;
static string d_status;
string DLQTypesHandler(const vector<string>&parts, Utility::pid_t ppid)
{
- typedef map<uint16_t, uint64_t> qtypenums_t;
- qtypenums_t qtypenums = g_rs.getQTypeResponseCounts();
- ostringstream os;
- boost::format fmt("%s\t%d\n");
- BOOST_FOREACH(const qtypenums_t::value_type& val, qtypenums) {
- os << (fmt %DNSRecordContent::NumberToType( val.first) % val.second).str();
- }
- return os.str();
+ return g_rs.getQTypeReport();
}
string DLRSizesHandler(const vector<string>&parts, Utility::pid_t ppid)
}
if(res == RecursorBehaviour::DROP) {
- g_rs.submitResponse(dc->d_mdp.d_qtype, 0, !dc->d_tcp);
delete dc;
dc=0;
return;
extern ResponseStats g_rs;
-string qtypeList()
-{
- typedef map<uint16_t, uint64_t> qtypenums_t;
- qtypenums_t qtypenums = g_rs.getQTypeResponseCounts();
- ostringstream os;
- boost::format fmt("%s\t%d\n");
- BOOST_FOREACH(const qtypenums_t::value_type& val, qtypenums) {
- os << (fmt %DNSRecordContent::NumberToType( val.first) % val.second).str();
- }
- return os.str();
-}
-
RecursorControlParser::RecursorControlParser()
{
addGetStat("questions", &g_stats.qcounter);
"get [key1] [key2] .. get specific statistics\n"
"get-all get all statistics\n"
"get-parameter [key1] [key2] .. get configuration parameters\n"
+"get-qtypelist get QType statistics\n"
+" notice: queries from cache aren't being counted yet\n"
"help get this list\n"
"ping check that all threads are alive\n"
"quit stop the recursor daemon\n"
}
if(cmd=="get-qtypelist") {
- return qtypeList();
+ return g_rs.getQTypeReport();
}
return "Unknown command '"+cmd+"', try 'help'\n";
#include "dnsrecords.hh"
#include "version.hh"
-
time_t s_starttime;
string s_programname="pdns"; // used in packethandler.cc
#include <limits>
#include "namespaces.hh"
#include "logger.hh"
+#include "boost/foreach.hpp"
+#include "dnsparser.hh"
ResponseStats::ResponseStats()
{
}
return ret;
}
+
+string ResponseStats::getQTypeReport()
+{
+ typedef map<uint16_t, uint64_t> qtypenums_t;
+ qtypenums_t qtypenums = getQTypeResponseCounts();
+ ostringstream os;
+ boost::format fmt("%s\t%d\n");
+ BOOST_FOREACH(const qtypenums_t::value_type& val, qtypenums) {
+ os << (fmt %DNSRecordContent::NumberToType( val.first) % val.second).str();
+ }
+ return os.str();
+}
\ No newline at end of file
void submitResponse(uint16_t qtype, uint16_t respsize, bool udpOrTCP);
map<uint16_t, uint64_t> getQTypeResponseCounts();
map<uint16_t, uint64_t> getSizeResponseCounts();
+ string getQTypeReport();
private:
vector<AtomicCounter> d_qtypecounters;