inline int DTime::udiff()
{
struct timeval now;
- // Utility::
- gettimeofday(&now,0);
- return 1000000*(now.tv_sec-d_set.tv_sec)+(now.tv_usec-d_set.tv_usec);
+ gettimeofday(&now,0);
+ int ret=1000000*(now.tv_sec-d_set.tv_sec)+(now.tv_usec-d_set.tv_usec);
+ d_set=now;
+ return ret;
}
inline bool dns_isspace(char c)
}
sr.d_outqueries ? RC.cacheMisses++ : RC.cacheHits++;
+ float spent=makeFloat(sr.d_now-dc->d_now);
+ if(spent < 0.001)
+ g_stats.answers0_1++;
+ else if(spent < 0.010)
+ g_stats.answers1_10++;
+ else if(spent < 0.1)
+ g_stats.answers10_100++;
+ else if(spent < 1.0)
+ g_stats.answers100_1000++;
+ else
+ g_stats.answersSlow++;
+
delete dc;
}
catch(AhuException &ae) {
addGetStat("servfail-answers", &g_stats.servFails);
addGetStat("nxdomain-answers", &g_stats.nxDomains);
addGetStat("noerror-answers", &g_stats.noErrors);
+
+ addGetStat("answers0-1", &g_stats.answers0_1);
+ addGetStat("answers1-10", &g_stats.answers1_10);
+ addGetStat("answers10-100", &g_stats.answers10_100);
+ addGetStat("answers100-1000", &g_stats.answers100_1000);
+ addGetStat("answers-slow", &g_stats.answersSlow);
+
addGetStat("all-questions", &qcounter);
addGetStat("negcache-entries", bind(&SyncRes::negcache_t::size, ref(SyncRes::s_negcache)));
addGetStat("throttle-entries", bind(&SyncRes::throttle_t::size, ref(SyncRes::s_throttle)));
class SyncRes
{
public:
- explicit SyncRes(const struct timeval& now) : d_outqueries(0), d_tcpoutqueries(0), d_throttledqueries(0), d_timeouts(0),
- d_cacheonly(false), d_nocache(false), d_now(now) { }
+ explicit SyncRes(const struct timeval& now) : d_outqueries(0), d_tcpoutqueries(0), d_throttledqueries(0), d_timeouts(0), d_now(now),
+ d_cacheonly(false), d_nocache(false) { }
int beginResolve(const string &qname, const QType &qtype, vector<DNSResourceRecord>&ret);
void setId(int id)
{
typedef Throttle<string> throttle_t;
static throttle_t s_throttle;
+ struct timeval d_now;
private:
struct GetBestNSAnswer;
int doResolveAt(set<string> nameservers, string auth, const string &qname, const QType &qtype, vector<DNSResourceRecord>&ret,
SyncRes(const SyncRes&);
SyncRes& operator=(const SyncRes&);
+
+
private:
string d_prefix;
static bool s_log;
bool d_cacheonly;
bool d_nocache;
LWRes d_lwr;
- struct timeval d_now;
struct GetBestNSAnswer
{
uint64_t nxDomains;
uint64_t noErrors;
PulseRate queryrate;
+ uint64_t answers0_1, answers1_10, answers10_100, answers100_1000, answersSlow;
};
extern RecursorStats g_stats;