[svn] commit: r2892 - in /experiments/stephen-receptionist: common/ intermediary/ receptionist/ server/

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Sep 9 12:58:55 UTC 2010


Author: stephen
Date: Thu Sep  9 12:58:54 2010
New Revision: 2892

Log:
Add code to measure throughput

Added:
    experiments/stephen-receptionist/common/throughput_measure.cc
    experiments/stephen-receptionist/common/throughput_measure.h
Modified:
    experiments/stephen-receptionist/common/Makefile.am
    experiments/stephen-receptionist/common/defaults.h
    experiments/stephen-receptionist/common/packet_counter.cc
    experiments/stephen-receptionist/common/packet_counter.h
    experiments/stephen-receptionist/common/target_command.cc
    experiments/stephen-receptionist/common/target_command.h
    experiments/stephen-receptionist/intermediary/intermediary.cc
    experiments/stephen-receptionist/receptionist/Makefile.am
    experiments/stephen-receptionist/receptionist/receptionist.cc
    experiments/stephen-receptionist/server/server.cc

Modified: experiments/stephen-receptionist/common/Makefile.am
==============================================================================
--- experiments/stephen-receptionist/common/Makefile.am (original)
+++ experiments/stephen-receptionist/common/Makefile.am Thu Sep  9 12:58:54 2010
@@ -12,6 +12,7 @@
 libcommon_a_SOURCES += udp_buffer.cc udp_buffer.h
 libcommon_a_SOURCES += udp_communicator.cc udp_communiator.h
 libcommon_a_SOURCES += utilities.cc utilities.h
+libcommon_a_SOURCES += throughput_measure.cc throughput_measure.h
 
 AM_CPPFLAGS = $(BOOSTLOCINC)
 AM_LDFLAGS  = $(BOOSTLOCLIB) -lboost_system-mt

Modified: experiments/stephen-receptionist/common/defaults.h
==============================================================================
--- experiments/stephen-receptionist/common/defaults.h (original)
+++ experiments/stephen-receptionist/common/defaults.h Thu Sep  9 12:58:54 2010
@@ -39,6 +39,7 @@
 static const uint16_t CL_DEF_PKTSIZE = 8192;
 static const uint16_t CL_DEF_PORT = 5400;
 static const uint16_t CL_DEF_QUEUE = 1;
+static const uint32_t CL_DEF_THROUGHPUT = 0;
 
 /// \brief UDP/IP defaults.
 

Modified: experiments/stephen-receptionist/common/packet_counter.cc
==============================================================================
--- experiments/stephen-receptionist/common/packet_counter.cc (original)
+++ experiments/stephen-receptionist/common/packet_counter.cc Thu Sep  9 12:58:54 2010
@@ -18,8 +18,8 @@
 
 // Holds the static variables for the PacketCounter class.
 
-int PacketCounter::send_count_ = 0;
-int PacketCounter::receive_count_ = 0;
-int PacketCounter::send2_count_ = 0;
-int PacketCounter::receive2_count_ = 0;
+volatile int PacketCounter::send_count_ = 0;
+volatile int PacketCounter::receive_count_ = 0;
+volatile int PacketCounter::send2_count_ = 0;
+volatile int PacketCounter::receive2_count_ = 0;
 bool PacketCounter::handler_registered_ = false;

Modified: experiments/stephen-receptionist/common/packet_counter.h
==============================================================================
--- experiments/stephen-receptionist/common/packet_counter.h (original)
+++ experiments/stephen-receptionist/common/packet_counter.h Thu Sep  9 12:58:54 2010
@@ -91,6 +91,12 @@
         printCounters();
     }
 
+    /// \brief Returns the receive count
+    /// (Only needed for the throughput measure class)
+    static int getReceiveCount() {
+        return receive_count_;
+    }
+
     /// \brief Prints the send and receive counters
     static void printCounters() {
         std::cout << "send() calls:        " << send_count_ << "\n"
@@ -107,10 +113,10 @@
     }
 
 private:
-    static int  send_count_;        //< Count of packets sent
-    static int  receive_count_;     //< Count of packets received
-    static int  send2_count_;       //< Second count of packets sent
-    static int  receive2_count_;    //< Second count of packets received
+    static volatile int  send_count_;    //< Count of packets sent
+    static volatile int  receive_count_; //< Count of packets received
+    static volatile int  send2_count_;   //< Second count of packets sent
+    static volatile int  receive2_count_;//< Second count of packets received
     static bool handler_registered_;//< Set true when handlers are registered
 };
 

Modified: experiments/stephen-receptionist/common/target_command.cc
==============================================================================
--- experiments/stephen-receptionist/common/target_command.cc (original)
+++ experiments/stephen-receptionist/common/target_command.cc Thu Sep  9 12:58:54 2010
@@ -81,6 +81,9 @@
         ("queue,q",
             po::value<uint32_t>(&queue_)->default_value(CL_DEF_QUEUE),
             "Message queue on which to listen")
+        ("throughput,t",
+            po::value<uint32_t>(&throughput_)->default_value(CL_DEF_THROUGHPUT),
+            "Interval (seconds) for output of throughput information")
         ("worker,w",
             po::value<std::string>(&worker_), "Worker image name");
 

Modified: experiments/stephen-receptionist/common/target_command.h
==============================================================================
--- experiments/stephen-receptionist/common/target_command.h (original)
+++ experiments/stephen-receptionist/common/target_command.h Thu Sep  9 12:58:54 2010
@@ -79,6 +79,11 @@
         return queue_;
     }
 
+    /// \return Throughput interval
+    uint32_t getThroughput() const {
+        return throughput_;
+    }
+
     /// \return File spec of the worker to run. A number of worker
     /// processes equal to the queue count are started
     std::string getWorker() const {
@@ -102,6 +107,7 @@
     uint32_t        queue_;     //< Queue number on which to receive data
     uint32_t        burst_;     //< Burst size (for processing)
     uint32_t        memsize_;   //< Memory size (in kB)
+    uint32_t        throughput_;//< Throughput measure output interval
     std::string     worker_;    //< Worker process
     boost::program_options::options_description desc_; //< Options description structure
     boost::program_options::variables_map vm_;         //< Maps variables to values

Modified: experiments/stephen-receptionist/intermediary/intermediary.cc
==============================================================================
--- experiments/stephen-receptionist/intermediary/intermediary.cc (original)
+++ experiments/stephen-receptionist/intermediary/intermediary.cc Thu Sep  9 12:58:54 2010
@@ -39,6 +39,7 @@
 #include "defaults.h"
 #include "target_command.h"
 #include "msgq_communicator_client.h"
+#include "throughput_measure.h"
 #include "udp_communicator.h"
 #include "intermediary_controller.h"
 #include "exception.h"
@@ -71,6 +72,9 @@
         IntermediaryController controller(command.getBurst(),
             command.getQueue());
 
+        // Instantiate the thread to output throughput information
+        ThroughputMeasure measure(command.getThroughput());
+
         // ... and enter the run loop.
         controller.run(client_communicator, contractor_communicator);
 

Modified: experiments/stephen-receptionist/receptionist/Makefile.am
==============================================================================
--- experiments/stephen-receptionist/receptionist/Makefile.am (original)
+++ experiments/stephen-receptionist/receptionist/Makefile.am Thu Sep  9 12:58:54 2010
@@ -2,7 +2,8 @@
 
 AM_CPPFLAGS = -I$(top_srcdir)/common $(BOOSTLOCINC)
 
-AM_LDFLAGS  = $(BOOSTLOCLIB) -lboost_program_options-mt -lboost_system-mt
+AM_LDFLAGS  = $(BOOSTLOCLIB)
+AM_LDFLAGS += -lboost_program_options-mt -lboost_thread-mt -lboost_system-mt
 
 receptionist_LDADD = $(top_srcdir)/common/libcommon.a
 

Modified: experiments/stephen-receptionist/receptionist/receptionist.cc
==============================================================================
--- experiments/stephen-receptionist/receptionist/receptionist.cc (original)
+++ experiments/stephen-receptionist/receptionist/receptionist.cc Thu Sep  9 12:58:54 2010
@@ -47,6 +47,7 @@
 #include "string.h"
 #include "target_command.h"
 #include "msgq_communicator_client.h"
+#include "throughput_measure.h"
 #include "udp_communicator.h"
 #include "receptionist_controller.h"
 #include "exception.h"
@@ -82,6 +83,9 @@
         // Create the task controller.
         ReceptionistController controller(command.getBurst(), command.getQueue());
 
+        // Instantiate the background thread to measure throughput.
+        ThroughputMeasure measure(command.getThroughput());
+
         // ... and enter the run loop.
 
         controller.run(client_communicator, worker_communicator);

Modified: experiments/stephen-receptionist/server/server.cc
==============================================================================
--- experiments/stephen-receptionist/server/server.cc (original)
+++ experiments/stephen-receptionist/server/server.cc Thu Sep  9 12:58:54 2010
@@ -37,6 +37,7 @@
 
 #include "target_command.h"
 #include "burst_server_controller.h"
+#include "throughput_measure.h"
 #include "udp_communicator.h"
 #include "exception.h"
 
@@ -60,6 +61,9 @@
         BurstServerController controller(command.getBurst(),
             command.getMemorySize());
 
+        // Instantiate the throughput measure.
+        ThroughputMeasure measure(command.getThroughput());
+
         // ... and enter the run loop.
 
         controller.run(communicator, communicator);




More information about the bind10-changes mailing list