BIND 10 trac1958, updated. df4d0be872ff9ff4e120e156b71d0abc25df0319 [1958] Added custom transaction id hashing in perfdhcp stats manager.

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jul 12 14:49:30 UTC 2012


The branch, trac1958 has been updated
       via  df4d0be872ff9ff4e120e156b71d0abc25df0319 (commit)
      from  7017538fe54478e47fe1bdda055d3545a5d70f66 (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 df4d0be872ff9ff4e120e156b71d0abc25df0319
Author: Marcin Siodelski <marcin at isc.org>
Date:   Thu Jul 12 16:49:10 2012 +0200

    [1958] Added custom transaction id hashing in perfdhcp stats manager.

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

Summary of changes:
 tests/tools/perfdhcp/stats_mgr.h                 |   12 ++++++++----
 tests/tools/perfdhcp/tests/stats_mgr_unittest.cc |    3 +--
 2 files changed, 9 insertions(+), 6 deletions(-)

-----------------------------------------------------------------------
diff --git a/tests/tools/perfdhcp/stats_mgr.h b/tests/tools/perfdhcp/stats_mgr.h
index 507e6fd..b224fa7 100644
--- a/tests/tools/perfdhcp/stats_mgr.h
+++ b/tests/tools/perfdhcp/stats_mgr.h
@@ -24,7 +24,7 @@
 #include <boost/multi_index/hashed_index.hpp>
 #include <boost/multi_index/sequenced_index.hpp>
 #include <boost/multi_index/mem_fun.hpp>
-#include <boost/multi_index/composite_key.hpp>
+#include <boost/multi_index/global_fun.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 
 #include <exceptions/exceptions.h>
@@ -70,6 +70,10 @@ public:
     class ExchangeStats {
     public:
 
+        static uint32_t transid_hash(boost::shared_ptr<T> packet) {
+            return packet->getTransid() & 1023;
+        }
+
         /// \brief List of packets (sent or received).
         ///
         /// List of packets based on multi index container allows efficient
@@ -80,8 +84,8 @@ public:
             boost::multi_index::indexed_by<
                 boost::multi_index::sequenced<>,
                 boost::multi_index::hashed_non_unique<
-                        boost::multi_index::const_mem_fun<
-                            T, uint32_t, &T::getTransid
+                        boost::multi_index::global_fun<
+                            boost::shared_ptr<T>, uint32_t, &ExchangeStats::transid_hash
                         >
                 >
             >
@@ -158,7 +162,7 @@ public:
             } else {
                 PktListTransidIndex& idx = sent_packets_.template get<1>();
                 std::pair<PktListTransidIterator,PktListTransidIterator> p =
-                    idx.equal_range(transid);
+                    idx.equal_range(transid & 1023);
                 ++unordered_lookups_;
                 unordered_lookup_size_sum_ += std::distance(p.first, p.second);
                 for (PktListTransidIterator it = p.first; it != p.second;
diff --git a/tests/tools/perfdhcp/tests/stats_mgr_unittest.cc b/tests/tools/perfdhcp/tests/stats_mgr_unittest.cc
index 8d6ee83..2d6ab14 100644
--- a/tests/tools/perfdhcp/tests/stats_mgr_unittest.cc
+++ b/tests/tools/perfdhcp/tests/stats_mgr_unittest.cc
@@ -108,9 +108,8 @@ TEST_F(StatsMgrTest, SendReceiveUnordered) {
     boost::scoped_ptr<StatsMgr4> stats_mgr(new StatsMgr4());
     stats_mgr->addExchangeStats(StatsMgr4::XCHG_DO);
 
-    uint32_t transid[packets_num] = { 64322, 100203, 1, 232324, 6786, 23, 4523, 777883, 98082, 3 };
+    uint32_t transid[packets_num] = { 1, 1024, 2, 1025, 3, 1026, 4, 1027, 5, 1028 };
     for (int i = 0; i < packets_num; ++i) {
-        //        uint32_t transid = i & 0xFFFFFFFE | !(i & 1);
         boost::shared_ptr<Pkt4> sent_packet(createPacket4(DHCPDISCOVER,
                                                           transid[i]));
         ASSERT_NO_THROW(



More information about the bind10-changes mailing list