]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
add qps statistics
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 25 Jun 2013 17:46:40 +0000 (19:46 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Tue, 25 Jun 2013 17:46:40 +0000 (19:46 +0200)
pdns/dnsbulktest.cc
pdns/dnsdist.cc

index e66fc9fa2b7ad230c2346e695b4adddf3cdc4372..6a22e617d6fff2bae1b0e4cbc30b01172c994506 100644 (file)
@@ -238,8 +238,9 @@ int main(int argc, char** argv)
   vector<TypedQuery> domains;
     
   Inflighter<vector<TypedQuery>, SendReceive> inflighter(domains, sr);
-  inflighter.d_maxInFlight = 100;
+  inflighter.d_maxInFlight = 1000;
   inflighter.d_timeoutSeconds = 3;
+  inflighter.d_burst = 100;
   string line;
   
   pair<string, string> split;
index 35d497e12a78e4acdfbe2d2083e53ed1ae14176e..4e0dee9479b09a70337fe062ccfcbb09a285bbaf 100644 (file)
@@ -41,7 +41,7 @@ namespace po = boost::program_options;
 po::variables_map g_vm;
 
 bool g_verbose;
-AtomicCounter g_pos;
+AtomicCounter g_pos, g_numQueries;
 uint16_t g_maxOutstanding;
 
 void RuntimeError(const boost::format& fmt)
@@ -165,7 +165,7 @@ void* clientThread(void* p)
     len = recvfrom(cs->fd, packet, sizeof(packet), 0, (struct sockaddr*) &remote, &socklen);
     if(len < 0) 
       continue;
-    
+    g_numQueries++;
     /* right now, this is our simple round robin downstream selector */
     DownstreamState& ss = g_dstates[(g_pos++) % g_numremotes]; 
     unsigned int idOffset = (ss.idOffset++) % g_maxOutstanding;
@@ -191,9 +191,10 @@ void* statThread(void*)
   int interval =g_vm["stats-interval"].as<int>();
   if(!interval)
     return 0;
-
+  uint32_t lastQueries=0;
   for(;;) {
     sleep(interval);
+    
     unsigned int outstanding=0;
     for(unsigned int n=0; n < g_numremotes; ++n) {
       const DownstreamState& dss = g_dstates[n];
@@ -203,7 +204,8 @@ void* statThread(void*)
          outstanding++;
       }
     }
-    cout<<outstanding<<" outstanding queries"<<endl;
+    cout<<outstanding<<" outstanding queries, " << (g_numQueries - lastQueries)/interval <<" qps"<<endl;
+    lastQueries=g_numQueries;
   }
   return 0;
 }