int64_t clientdiff = g_clientQuestions - g_clientResponses;
int64_t serverdiff = g_serverQuestions - g_serverResponses;
- if(clientdiff > 5 && clientdiff > 0.02*g_clientQuestions) {
+ if(clientdiff > 1 && clientdiff > 0.02*g_clientQuestions) {
char tmp[80];
struct tm tm=*pdns_localtime_r(&tv.tv_sec, &tm);
strftime(tmp, sizeof(tmp) - 1, "%F %H:%M:%S", &tm);
cout<<"Last question: "<<tmp<<"."<<g_lastquestionTime.tv_usec/1000000.0<<endl;
}
- if(serverdiff > 5 && serverdiff > 0.02*g_serverQuestions) {
+ if(serverdiff > 1 && serverdiff > 0.02*g_serverQuestions) {
char tmp[80];
struct tm tm=*pdns_localtime_r(&tv.tv_sec, &tm);
strftime(tmp, sizeof(tmp) - 1, "%F %H:%M:%S", &tm);
map<pair<string, uint16_t>, int> counts;
+ map<double, int> rdqcounts, rdacounts;
+
while(pr.getUDPPacket()) {
if((ntohs(pr.d_udp->uh_dport)==5300 || ntohs(pr.d_udp->uh_sport)==5300 ||
ntohs(pr.d_udp->uh_dport)==53 || ntohs(pr.d_udp->uh_sport)==53) &&
}
if(mdp.d_header.rd && !mdp.d_header.qr) {
+ rdqcounts[pr.d_pheader.ts.tv_sec + 0.01*(pr.d_pheader.ts.tv_usec/10000)]++;
g_lastquestionTime=pr.d_pheader.ts;
g_clientQuestions++;
totalQueries++;
questions.insert(make_pair(mdp.d_qname, mdp.d_qtype));
}
else if(mdp.d_header.rd && mdp.d_header.qr) {
+ rdacounts[pr.d_pheader.ts.tv_sec + 0.01*(pr.d_pheader.ts.tv_usec/10000)]++;
g_lastanswerTime=pr.d_pheader.ts;
g_clientResponses++;
answers.insert(make_pair(mdp.d_qname, mdp.d_qtype));
g_serverResponses++;
}
- if(pr.d_pheader.ts.tv_sec - lastreport.tv_sec >= 5) {
+ if(pr.d_pheader.ts.tv_sec - lastreport.tv_sec >= 1) {
makeReport(pr.d_pheader.ts);
lastreport = pr.d_pheader.ts;
}
continue;
}
}
+ }
+
+ map<double, pair<int, int>> splot;
+
+ for(auto& a : rdqcounts) {
+ splot[a.first].first = a.second;
+ }
+ for(auto& a : rdacounts) {
+ splot[a.first].second = a.second;
+ }
+ cerr<<"Writing out sub-second rd query/response stats to ./rdqaplot"<<endl;
+ ofstream plot("rdqaplot");
+ plot<<std::fixed;
+ for(auto& a : splot) {
+ plot << a.first<<"\t"<<a.second.first<<"\t"<<a.second.second<<endl;
}
cerr<<"Parse errors: "<<parseErrors<<", total queries: "<<totalQueries<<endl;
typedef vector<queries_t::value_type> diff_t;