Created
September 17, 2018 19:03
-
-
Save phonedph1/489f318243f3ec832b12f72ad77c032d to your computer and use it in GitHub Desktop.
hrm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc | |
index 65a8baffe..d9e4f2113 100644 | |
--- a/pdns/pdns_recursor.cc | |
+++ b/pdns/pdns_recursor.cc | |
@@ -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; | |
diff --git a/pdns/rec_channel.hh b/pdns/rec_channel.hh | |
index 1b8e4d8f3..40713c675 100644 | |
--- a/pdns/rec_channel.hh | |
+++ b/pdns/rec_channel.hh | |
@@ -65,6 +65,7 @@ public: | |
std::map<std::string, std::string> getAllStatsMap(); | |
extern pthread_mutex_t g_carbon_config_lock; | |
+extern unsigned int g_networkTimeoutMsec; | |
void sortPublicSuffixList(); | |
std::vector<std::pair<DNSName, uint16_t> >* pleaseGetQueryRing(); | |
std::vector<std::pair<DNSName, uint16_t> >* pleaseGetServfailQueryRing(); | |
diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc | |
index c19d7ebcc..9aeb93519 100644 | |
--- a/pdns/rec_channel_rec.cc | |
+++ b/pdns/rec_channel_rec.cc | |
@@ -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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment