]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
astoundingly enough, our function based statistics counters were... 32 bits?!
authorbert hubert <bert.hubert@netherlabs.nl>
Sun, 6 Mar 2016 20:02:44 +0000 (21:02 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Sun, 6 Mar 2016 20:02:44 +0000 (21:02 +0100)
pdns/rec_channel_rec.cc

index 1c85bf4f001cfebb6e8914bcfff0d8b8b8ab8532..90e5851bda1d4f34fddf0ce1b4092788f1208fa9 100644 (file)
@@ -36,7 +36,7 @@ pthread_mutex_t g_carbon_config_lock=PTHREAD_MUTEX_INITIALIZER;
 
 map<string, const uint32_t*> d_get32bitpointers;
 map<string, const uint64_t*> d_get64bitpointers;
-map<string, function< uint32_t() > >  d_get32bitmembers;
+map<string, function< uint64_t() > >  d_get64bitmembers;
 pthread_mutex_t d_dynmetricslock = PTHREAD_MUTEX_INITIALIZER;
 map<string, std::atomic<unsigned long>* > 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<uint32_t ()> f ) 
+
+void addGetStat(const string& name, function<uint64_t ()> f ) 
 {
-  d_get32bitmembers[name]=f;
+  d_get64bitmembers[name]=f;
 }
 
+
 std::atomic<unsigned long>* getDynMetric(const std::string& str)
 {
   Lock l(&d_dynmetricslock);
@@ -72,8 +74,8 @@ optional<uint64_t> 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<string,string> 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)