BIND 10 trac1959, updated. 23c33b29ab5841a3fe5469d2056708e707938998 [1959] Print intermediate statistics (support for -t parameter).

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Aug 24 13:01:23 UTC 2012


The branch, trac1959 has been updated
       via  23c33b29ab5841a3fe5469d2056708e707938998 (commit)
      from  61f144876b5c42de12b51fc79ea2f6b0544001ce (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 23c33b29ab5841a3fe5469d2056708e707938998
Author: Marcin Siodelski <marcin at isc.org>
Date:   Fri Aug 24 15:01:04 2012 +0200

    [1959] Print intermediate statistics (support for -t parameter).

-----------------------------------------------------------------------

Summary of changes:
 tests/tools/perfdhcp/stats_mgr.h     |   27 +++++++++++++++++++++++++++
 tests/tools/perfdhcp/test_control.cc |   20 ++++++++++++++++++++
 tests/tools/perfdhcp/test_control.h  |    9 +++++++++
 3 files changed, 56 insertions(+)

-----------------------------------------------------------------------
diff --git a/tests/tools/perfdhcp/stats_mgr.h b/tests/tools/perfdhcp/stats_mgr.h
index 1e57dda..7ea5223 100644
--- a/tests/tools/perfdhcp/stats_mgr.h
+++ b/tests/tools/perfdhcp/stats_mgr.h
@@ -1096,6 +1096,33 @@ public:
         }
     }
 
+    /// \brief Print intermediate statistics.
+    ///
+    /// Method prints intermediate statistics for all exchanges.
+    /// Statistics includes sent, received and dropped packets
+    /// counters.
+    void printIntermediateStats() const {
+        std::ostringstream stream_sent("");
+        std::ostringstream stream_rcvd("");
+        std::ostringstream stream_drops("");
+        std::string sep("");
+        for (ExchangesMapIterator it = exchanges_.begin();
+             it != exchanges_.end();
+             ++it) {
+
+            if (it != exchanges_.begin()) {
+                sep = "/";
+            }
+            stream_sent << sep << it->second->getSentPacketsNum();
+            stream_rcvd << sep << it->second->getRcvdPacketsNum();
+            stream_drops << sep << it->second->getDroppedPacketsNum();
+        }
+        std::cout << "sent: " << stream_sent.str() 
+                  << "; received: " << stream_rcvd.str()
+                  << "; drops: " << stream_drops.str()
+                  << std::endl;
+    }
+
     /// \brief Print timestamps of all packets.
     ///
     /// Method prints timestamps of all sent and received
diff --git a/tests/tools/perfdhcp/test_control.cc b/tests/tools/perfdhcp/test_control.cc
index 42058a9..af59105 100644
--- a/tests/tools/perfdhcp/test_control.cc
+++ b/tests/tools/perfdhcp/test_control.cc
@@ -528,6 +528,22 @@ TestControl::printRate() const {
 }
 
 void
+TestControl::printIntermediateStats() {
+    CommandOptions& options = CommandOptions::instance();
+    int delay = options.getReportDelay();
+    ptime now = microsec_clock::universal_time();
+    time_period time_since_report(last_report_, now);
+    if (time_since_report.length().total_seconds() >= delay) {
+        if (options.getIpVersion() == 4) {
+            stats_mgr4_->printIntermediateStats();
+        } else if (options.getIpVersion() == 6) {
+            stats_mgr6_->printIntermediateStats();
+        }
+        last_report_ = now;
+    }
+}
+
+void
 TestControl::printStats() const {
     printRate();
     CommandOptions& options = CommandOptions::instance();
@@ -672,6 +688,7 @@ void
 TestControl::reset() {
     send_due_ = microsec_clock::universal_time();
     last_sent_ = send_due_;
+    last_report_ = send_due_;
     transid_gen_.reset();
     transid_gen_ = TransidGeneratorPtr(new TransidGenerator());
     first_packet_serverid_.clear();
@@ -735,6 +752,9 @@ TestControl::run() {
             }
             ++packets_sent;
         }
+        if (options.getReportDelay() > 0) {
+            printIntermediateStats();
+        }
     }
     printStats();
 }
diff --git a/tests/tools/perfdhcp/test_control.h b/tests/tools/perfdhcp/test_control.h
index 6c38e92..c94d7b6 100644
--- a/tests/tools/perfdhcp/test_control.h
+++ b/tests/tools/perfdhcp/test_control.h
@@ -365,6 +365,12 @@ protected:
     /// \return socket descriptor.
     int openSocket() const;
 
+    /// \brief Print intermediate statistics.
+    ///
+    /// Print brief statistics regarding number of sent packets,
+    /// received packets and dropped packets so far.
+    void printIntermediateStats();
+
     /// \brief Print rate statistics.
     ///
     /// Method print packet exchange rate statistics.
@@ -582,6 +588,9 @@ private:
                                            ///< of exchanges.
     boost::posix_time::ptime last_sent_;   ///< Indicates when the last exchange
                                            /// was initiated.
+
+    boost::posix_time::ptime last_report_; ///< Last intermediate report time.
+
     StatsMgr4Ptr stats_mgr4_;  ///< Statistics Manager 4.
     StatsMgr6Ptr stats_mgr6_;  ///< Statistics Manager 6.
 



More information about the bind10-changes mailing list