/* we can't move this if we want to be able to access the values in
all queries sent over this connection */
dc->d_proxyProtocolValues = conn->proxyProtocolValues;
+
+ struct timeval start;
+ Utility::gettimeofday(&start, nullptr);
+
DNSName qname;
uint16_t qtype=0;
uint16_t qclass=0;
bool cacheHit = checkForCacheHit(qnameParsed, dc->d_tag, conn->data, qname, qtype, qclass, g_now, response, dc->d_qhash, pbData, true, dc->d_source);
if (cacheHit) {
+ struct timeval now;
+ Utility::gettimeofday(&now, nullptr);
if (t_protobufServers && dc->d_logResponse && !(luaconfsLocal->protobufExportConfig.taggedOnly && pbData && !pbData->d_tagged)) {
- struct timeval tv{0, 0};
- protobufLogResponse(dh, luaconfsLocal, pbData, tv, true, dc->d_source, dc->d_destination, dc->d_ednssubnet, dc->d_uuid, dc->d_requestorId, dc->d_deviceId, dc->d_deviceName);
+ protobufLogResponse(dh, luaconfsLocal, pbData, now, true, dc->d_source, dc->d_destination, dc->d_ednssubnet, dc->d_uuid, dc->d_requestorId, dc->d_deviceId, dc->d_deviceName);
}
if (!g_quiet) {
bool hadError = sendResponseOverTCP(dc, response);
finishTCPReply(dc, hadError, false);
+ Utility::gettimeofday(&now, nullptr);
+ uint64_t spentUsec = uSec(now - start);
+ g_stats.cumulativeAnswers(spentUsec);
} else {
// No cache hit, setup for startDoResolve() in an mthread
++conn->d_requestsInFlight;
}
struct timeval ttd;
- Utility::gettimeofday(&ttd, 0);
+ Utility::gettimeofday(&ttd, nullptr);
ttd.tv_sec += g_tcpTimeout;
t_fdm->addReadFD(tc->getFD(), handleRunningTCPQuestion, tc, &ttd);
static string* doProcessUDPQuestion(const std::string& question, const ComboAddress& fromaddr, const ComboAddress& destaddr, ComboAddress source, ComboAddress destination, struct timeval tv, int fd, std::vector<ProxyProtocolValue>& proxyProtocolValues)
{
- gettimeofday(&g_now, 0);
+ gettimeofday(&g_now, nullptr);
if (tv.tv_sec) {
struct timeval diff = g_now - tv;
double delta=(diff.tv_sec*1000 + diff.tv_usec/1000.0);
<< (source != fromaddr ? " (via " + fromaddr.toStringWithPort() + ")" : "") << " failed with: "
<< strerror(sendErr) << endl;
}
+ struct timeval now;
+ Utility::gettimeofday(&now, nullptr);
+ uint64_t spentUsec = uSec(now - tv);
+ g_stats.cumulativeAnswers(spentUsec);
return 0;
}
}
last_stat = g_now.tv_sec;
}
- Utility::gettimeofday(&g_now, 0);
+ Utility::gettimeofday(&g_now, nullptr);
if((g_now.tv_sec - last_carbon) >= carbonInterval) {
MT->makeThread(doCarbonDump, 0);
auth4Answers("auth4answers", { 1000, 10000, 100000, 1000000 }),
auth6Answers("auth6answers", { 1000, 10000, 100000, 1000000 }),
ourtime("ourtime", { 1000, 2000, 4000, 8000, 16000, 32000 }),
- cumulativeAnswers("cumulAnswers-us", { 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800, 6553600 }),
- cumulativeAuth4Answers("cumulAuth4Answers-us", { 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800, 6553600 }),
- cumulativeAuth6Answers("cumulAuth6Answers-us", { 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400, 204800, 409600, 819200, 1638400, 3276800, 6553600 })
+ cumulativeAnswers("cumulAnswers-us", 10, 19),
+ cumulativeAuth4Answers("cumulAuth4Answers-us", 1000, 13),
+ cumulativeAuth6Answers("cumulAuth6Answers-us", 1000, 13)
{
}
};