From: bert hubert Date: Sun, 6 Mar 2016 20:02:44 +0000 (+0100) Subject: astoundingly enough, our function based statistics counters were... 32 bits?! X-Git-Tag: rec-4.0.0-alpha2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51e632517960b794fc57e71bed992ac576a7ba0c;p=thirdparty%2Fpdns.git astoundingly enough, our function based statistics counters were... 32 bits?! --- diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index 1c85bf4f00..90e5851bda 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -36,7 +36,7 @@ pthread_mutex_t g_carbon_config_lock=PTHREAD_MUTEX_INITIALIZER; map d_get32bitpointers; map d_get64bitpointers; -map > d_get32bitmembers; +map > d_get64bitmembers; pthread_mutex_t d_dynmetricslock = PTHREAD_MUTEX_INITIALIZER; map* > d_dynmetrics; void addGetStat(const string& name, const uint32_t* place) @@ -47,11 +47,13 @@ void addGetStat(const string& name, const uint64_t* place) { d_get64bitpointers[name]=place; } -void addGetStat(const string& name, function f ) + +void addGetStat(const string& name, function f ) { - d_get32bitmembers[name]=f; + d_get64bitmembers[name]=f; } + std::atomic* getDynMetric(const std::string& str) { Lock l(&d_dynmetricslock); @@ -72,8 +74,8 @@ optional get(const string& name) return *d_get32bitpointers.find(name)->second; if(d_get64bitpointers.count(name)) return *d_get64bitpointers.find(name)->second; - if(d_get32bitmembers.count(name)) - return d_get32bitmembers.find(name)->second(); + if(d_get64bitmembers.count(name)) + return d_get64bitmembers.find(name)->second(); Lock l(&d_dynmetricslock); auto f =rplookup(d_dynmetrics, name); @@ -93,10 +95,10 @@ map getAllStatsMap() for(const auto& the64bits : d_get64bitpointers) { ret.insert(make_pair(the64bits.first, std::to_string(*the64bits.second))); } - for(const auto& the32bitmembers : d_get32bitmembers) { - if(the32bitmembers.first == "cache-bytes" || the32bitmembers.first=="packetcache-bytes") + for(const auto& the64bitmembers : d_get64bitmembers) { + if(the64bitmembers.first == "cache-bytes" || the64bitmembers.first=="packetcache-bytes") continue; // too slow for 'get-all' - ret.insert(make_pair(the32bitmembers.first, std::to_string(the32bitmembers.second()))); + ret.insert(make_pair(the64bitmembers.first, std::to_string(the64bitmembers.second()))); } Lock l(&d_dynmetricslock); for(const auto& a : d_dynmetrics)