From: bert hubert Date: Wed, 2 Apr 2014 19:49:00 +0000 (+0200) Subject: we reinitialized all our statistics function for each rec_control or even API call... X-Git-Tag: rec-3.6.0-rc1~105 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d088f1ff1e1603044c1c434d70a6b7c652d2d7e;p=thirdparty%2Fpdns.git we reinitialized all our statistics function for each rec_control or even API call, which was wasteful. --- diff --git a/pdns/rec_channel.hh b/pdns/rec_channel.hh index aa4ba344bb..7bd60240e8 100644 --- a/pdns/rec_channel.hh +++ b/pdns/rec_channel.hh @@ -34,6 +34,8 @@ public: static void nop(void){} typedef void func_t(void); std::string getAnswer(const std::string& question, func_t** func); +private: + static bool s_init; }; std::map getAllStatsMap(); diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index e4bc361cca..4c8c680eb5 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -427,8 +427,13 @@ uint64_t doGetMallocated() extern ResponseStats g_rs; +bool RecursorControlParser::s_init; RecursorControlParser::RecursorControlParser() { + if(s_init) + return; + s_init=true; + addGetStat("questions", &g_stats.qcounter); addGetStat("ipv6-questions", &g_stats.ipv6qcounter); addGetStat("tcp-questions", &g_stats.tcpqcounter);