Changeset 1496

Show
Ignore:
Timestamp:
01/10/10 09:30:52 (5 years ago)
Author:
ahu
Message:

implement 'rec_control get-all' to get all stats, plus remove dead 'shunt' statistics

Location:
trunk/pdns/pdns
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/rec_channel_rec.cc

    r1493 r1496  
    1212#include <boost/format.hpp> 
    1313#include <boost/algorithm/string.hpp> 
     14#include <boost/foreach.hpp> 
    1415#include <sys/types.h> 
    1516#include <sys/stat.h> 
     
    5657} 
    5758 
     59string getAllStats() 
     60{ 
     61  string ret; 
     62  pair<string, const uint32_t*> the32bits; 
     63  pair<string, const uint64_t*> the64bits; 
     64  pair<string, function< uint32_t() > >  the32bitmembers; 
     65  BOOST_FOREACH(the32bits, d_get32bitpointers) { 
     66    ret += the32bits.first + "\t" + lexical_cast<string>(*the32bits.second) + "\n"; 
     67  } 
     68  BOOST_FOREACH(the64bits, d_get64bitpointers) { 
     69    ret += the64bits.first + "\t" + lexical_cast<string>(*the64bits.second) + "\n"; 
     70  } 
     71  BOOST_FOREACH(the32bitmembers, d_get32bitmembers) { 
     72    ret += the32bitmembers.first + "\t" + lexical_cast<string>(the32bitmembers.second()) + "\n"; 
     73  } 
     74  return ret; 
     75} 
    5876 
    5977template<typename T> 
     
    156174} 
    157175 
    158  
    159 #if 0  // broken! 
    160 uint32_t getQueryRate() 
    161 { 
    162   struct timeval now; 
    163   gettimeofday(&now, 0); 
    164   optional<float> delay=g_stats.queryrate.get(now, 10); 
    165   if(delay) 
    166     return (uint32_t)(1000000/(*delay)); 
    167   else 
    168     return 0; 
    169 } 
    170 #endif  
    171  
    172176#ifndef WIN32 
    173177static uint64_t getSysTimeMsec() 
     
    365369  addGetStat("dlg-only-drops", &SyncRes::s_nodelegated); 
    366370   
    367   addGetStat("shunted-queries", &g_stats.shunted); 
    368   addGetStat("noshunt-size", &g_stats.noShuntSize); 
    369   addGetStat("noshunt-expired", &g_stats.noShuntExpired); 
    370   addGetStat("noshunt-nomatch", &g_stats.noShuntNoMatch); 
    371   addGetStat("noshunt-cname", &g_stats.noShuntCNAME); 
    372   addGetStat("noshunt-wrong-question", &g_stats.noShuntWrongQuestion); 
    373   addGetStat("noshunt-wrong-type", &g_stats.noShuntWrongType); 
    374  
    375371  addGetStat("negcache-entries", boost::bind(getNegCacheSize)); 
    376372  addGetStat("throttle-entries", boost::bind(getThrottleSize));  
     
    475471  vector<string>::const_iterator begin=words.begin()+1, end=words.end(); 
    476472 
     473  if(cmd=="get-all") 
     474    return getAllStats(); 
     475 
    477476  if(cmd=="get")  
    478477    return doGet(begin, end); 
    479  
     478   
    480479  if(cmd=="get-parameter")  
    481480    return doGetParameter(begin, end); 
  • trunk/pdns/pdns/syncres.hh

    r1493 r1496  
    475475  uint64_t chainResends; 
    476476  uint64_t nsSetInvalidations; 
    477   uint64_t shunted; 
    478   uint64_t noShuntCNAME, noShuntExpired, noShuntSize, noShuntNoMatch, noShuntWrongType, noShuntWrongQuestion; 
    479477  uint64_t ednsPingMatches; 
    480478  uint64_t ednsPingMismatches;