]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Do some math with the mtasker ttd and print how long a query has been running for
authorphonedph1 <phoned@gmail.com>
Mon, 17 Sep 2018 19:16:56 +0000 (19:16 +0000)
committerphonedph1 <phoned@gmail.com>
Mon, 17 Sep 2018 19:16:56 +0000 (19:16 +0000)
pdns/pdns_recursor.cc
pdns/rec_channel_rec.cc
pdns/syncres.hh

index 65a8baffe7eb62069b40928e566a7ce9e6174855..d9e4f2113f4783f79836ae2d31d6fa605ce55574 100644 (file)
@@ -186,7 +186,7 @@ static size_t s_maxUDPQueriesPerRound;
 static uint64_t g_latencyStatSize;
 static uint32_t g_disthashseed;
 static unsigned int g_maxTCPPerClient;
-static unsigned int g_networkTimeoutMsec;
+unsigned int g_networkTimeoutMsec;
 static unsigned int g_maxMThreads;
 static unsigned int g_numDistributorThreads;
 static unsigned int g_numWorkerThreads;
index c19d7ebcc1e59c6015f97f5fa5133c6810634771..9aeb93519483386e284a6723f9b9b3c2456d23e5 100644 (file)
@@ -692,19 +692,23 @@ static uint64_t calculateUptime()
 static string* pleaseGetCurrentQueries()
 {
   ostringstream ostr;
+  struct timeval now;
+  gettimeofday(&now, 0);
 
   ostr << getMT()->d_waiters.size() <<" currently outstanding questions\n";
 
-  boost::format fmt("%1% %|40t|%2% %|47t|%3% %|63t|%4% %|68t|%5%\n");
+  boost::format fmt("%1% %|40t|%2% %|47t|%3% %|63t|%4% %|68t|%5% %|78t|%6%\n");
 
-  ostr << (fmt % "qname" % "qtype" % "remote" % "tcp" % "chained");
+  ostr << (fmt % "qname" % "qtype" % "remote" % "tcp" % "chained" % "spent(ms)");
   unsigned int n=0;
   for(const auto& mthread : getMT()->d_waiters) {
     const PacketID& pident = mthread.key;
+    const double spent = g_networkTimeoutMsec - (DiffTime(now, mthread.ttd) * 1000);
     ostr << (fmt 
              % pident.domain.toLogString() /* ?? */ % DNSRecordContent::NumberToType(pident.type) 
              % pident.remote.toString() % (pident.sock ? 'Y' : 'n')
              % (pident.fd == -1 ? 'Y' : 'n')
+             % (spent > 0 ? spent : '0')
              );
     ++n;
     if (n >= 100)
index 053142f5b19de25e26373cd1eaf286434e8b9305..ea0431cd22d0cad765d8d44288d22def23b62b55 100644 (file)
@@ -981,6 +981,7 @@ string doQueueReloadLuaScript(vector<string>::const_iterator begin, vector<strin
 string doTraceRegex(vector<string>::const_iterator begin, vector<string>::const_iterator end);
 void parseACLs();
 extern RecursorStats g_stats;
+extern unsigned int g_networkTimeoutMsec;
 extern unsigned int g_numThreads;
 extern uint16_t g_outgoingEDNSBufsize;
 extern std::atomic<uint32_t> g_maxCacheEntries, g_maxPacketCacheEntries;