[rhmessaging-commits] rhmessaging commits: r4428 - in store/trunk/cpp: perf and 1 other directory.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Dec 7 12:01:25 EST 2010


Author: kpvdr
Date: 2010-12-07 12:01:24 -0500 (Tue, 07 Dec 2010)
New Revision: 4428

Modified:
   store/trunk/cpp/lib/jrnl2/JournalParameters.cpp
   store/trunk/cpp/lib/jrnl2/JournalParameters.hpp
   store/trunk/cpp/perf/JournalInstance.cpp
   store/trunk/cpp/perf/JournalInstance.hpp
   store/trunk/cpp/perf/JournalParameters.cpp
   store/trunk/cpp/perf/JournalParameters.hpp
   store/trunk/cpp/perf/ScopedPerformanceTimer.cpp
   store/trunk/cpp/perf/ScopedPerformanceTimer.hpp
   store/trunk/cpp/perf/StorePerformanceTest.cpp
   store/trunk/cpp/perf/StorePerformanceTest.hpp
   store/trunk/cpp/perf/TestParameters.cpp
   store/trunk/cpp/perf/TestParameters.hpp
Log:
Code tidy-up for the perf tool

Modified: store/trunk/cpp/lib/jrnl2/JournalParameters.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/JournalParameters.cpp	2010-12-06 20:34:52 UTC (rev 4427)
+++ store/trunk/cpp/lib/jrnl2/JournalParameters.cpp	2010-12-07 17:01:24 UTC (rev 4428)
@@ -90,7 +90,7 @@
 {}
 
 std::string
-JournalParameters::to_string()
+JournalParameters::toString()
 {
     std::ostringstream oss;
     oss << "Store Parameters:" << std::endl;

Modified: store/trunk/cpp/lib/jrnl2/JournalParameters.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl2/JournalParameters.hpp	2010-12-06 20:34:52 UTC (rev 4427)
+++ store/trunk/cpp/lib/jrnl2/JournalParameters.hpp	2010-12-07 17:01:24 UTC (rev 4428)
@@ -70,7 +70,7 @@
                           const u_int16_t writeBuffNumPgs,
                           const u_int32_t writeBuffPgSize_sblks);
         JournalParameters(const JournalParameters& sp);
-        std::string to_string();
+        std::string toString();
     };
 
 } // namespace journal2

Modified: store/trunk/cpp/perf/JournalInstance.cpp
===================================================================
--- store/trunk/cpp/perf/JournalInstance.cpp	2010-12-06 20:34:52 UTC (rev 4427)
+++ store/trunk/cpp/perf/JournalInstance.cpp	2010-12-07 17:01:24 UTC (rev 4428)
@@ -35,27 +35,27 @@
 
 namespace mrg
 {
-namespace test
+namespace jtest
 {
 
-JournalInstance::JournalInstance(const uint32_t num_msgs,
-                                 const uint32_t msg_size,
-                                 const char* msg_data,
+JournalInstance::JournalInstance(const uint32_t numMsgs,
+                                 const uint32_t msgSize,
+                                 const char* msgData,
 #ifdef JOURNAL2
-                                 mrg::journal2::jrnl* const jp) :
+                                 mrg::journal2::jrnl* const jrnlPtr) :
 #else
-                                 mrg::journal::jcntl* const jp) :
+                                 mrg::journal::jcntl* const jrnlPtr) :
 #endif
-                                 _num_msgs(num_msgs),
-                                 _msg_size(msg_size),
-                                 _msg_data(msg_data),
-                                 _jp(jp),
-                                 _thread_switch(false)
+                                 _numMsgs(numMsgs),
+                                 _msgSize(msgSize),
+                                 _msgData(msgData),
+                                 _jrnlPtr(jrnlPtr),
+                                 _threadSwitch(false)
 {}
 
 JournalInstance::~JournalInstance()
 {
-    delete _jp;
+    delete _jrnlPtr;
 }
 
 
@@ -63,19 +63,19 @@
 // This method will be called by multiple threads simultaneously
 // Enqueue thread entry point
 void
-JournalInstance::_enq()
+JournalInstance::_doEnqueues()
 {
     bool misfireFlag = false;
     uint32_t i = 0;
-    while (i < _num_msgs) {
+    while (i < _numMsgs) {
 #ifdef JOURNAL2
-        mrg::journal2::dtok* dtokp = new mrg::journal2::dtok();
-        mrg::journal2::iores res = _jp->enqueue(_msg_data, _msg_size, dtokp);
+        mrg::journal2::dtok* dtokPtr = new mrg::journal2::dtok();
+        mrg::journal2::iores jrnlIoRes = _jrnlPtr->enqueue(_msgData, _msgSize, dtokPtr);
 #else
-        mrg::journal::data_tok* dtokp = new mrg::journal::data_tok();
-        mrg::journal::iores res = _jp->enqueue_data_record(_msg_data, _msg_size, _msg_size, dtokp);
+        mrg::journal::data_tok* dtokPtr = new mrg::journal::data_tok();
+        mrg::journal::iores jrnlIoRes = _jrnlPtr->enqueue_data_record(_msgData, _msgSize, _msgSize, dtokPtr);
 #endif
-        switch (res) {
+        switch (jrnlIoRes) {
 #ifdef JOURNAL2
             case 0:
 #else
@@ -90,7 +90,7 @@
             case mrg::journal::RHM_IORES_BUSY:
 #endif
                 if (!misfireFlag) std::cout << "-" << std::flush;
-                delete dtokp;
+                delete dtokPtr;
                 misfireFlag = true;
                 break;
 #ifdef JOURNAL2
@@ -98,23 +98,23 @@
 #else
             case mrg::journal::RHM_IORES_ENQCAPTHRESH:
 #endif
-                //std::cout << "_enq() RHM_IORES_ENQCAPTHRESH: " << dtokp->status_str() << std::endl;
+                //std::cout << "_doEnqueues() RHM_IORES_ENQCAPTHRESH: " << dtokPtr->status_str() << std::endl;
                 if (!misfireFlag) std::cout << "*" << std::flush;
                 //std::cout << ".";
-                delete dtokp;
+                delete dtokPtr;
                 misfireFlag = true;
                 ::usleep(10);
                 break;
             default:
-                delete dtokp;
+                delete dtokPtr;
 #ifdef JOURNAL2
-                std::cerr << "enqueue_data_record FAILED with " << mrg::journal2::iores_str(res) << std::endl;
+                std::cerr << "enqueue_data_record FAILED with " << mrg::journal2::iores_str(jrnlIoRes) << std::endl;
 #else
-                std::cerr << "enqueue_data_record FAILED with " << mrg::journal::iores_str(res) << std::endl;
+                std::cerr << "enqueue_data_record FAILED with " << mrg::journal::iores_str(jrnlIoRes) << std::endl;
 #endif
         }
     }
-    _jp->flush(false);
+    _jrnlPtr->flush(false);
 }
 
 
@@ -122,38 +122,38 @@
 // This method will be called by multiple threads simultaneously
 // Dequeue thread entry point
 void
-JournalInstance::_deq()
+JournalInstance::_doDequeues()
 {
     uint32_t i = 0;
-    while (i < _num_msgs) {
+    while (i < _numMsgs) {
 #ifdef JOURNAL2
-        mrg::journal2::dtok* dtokp = 0;
+        mrg::journal2::dtok* dtokPtr = 0;
 #else
-        mrg::journal::data_tok* dtokp = 0;
+        mrg::journal::data_tok* dtokPtr = 0;
 #endif
-        while (!dtokp) {
-            bool get_events_flag;
+        while (!dtokPtr) {
+            bool getEventsFlag;
             {
-                std::unique_lock<std::mutex> l(_ucl_mutex);
-                get_events_flag = _ucl.size() == 0;
-                if (!get_events_flag) {
-                    dtokp = _ucl.front();
-                    _ucl.pop();
+                std::unique_lock<std::mutex> l(_unprocCallbackListMutex);
+                getEventsFlag = _unprocCallbackList.size() == 0;
+                if (!getEventsFlag) {
+                    dtokPtr = _unprocCallbackList.front();
+                    _unprocCallbackList.pop();
                 }
             }
-            if (get_events_flag) {
-                _jp->get_wr_events(0);
+            if (getEventsFlag) {
+                _jrnlPtr->get_wr_events(0);
                 ::usleep(1);
             }
         }
         bool done = false;
         while (!done) {
 #ifdef JOURNAL2
-            mrg::journal2::iores res = _jp->dequeue(dtokp);
+            mrg::journal2::iores jrnlIoRes = _jrnlPtr->dequeue(dtokPtr);
 #else
-            mrg::journal::iores res = _jp->dequeue_data_record(dtokp);
+            mrg::journal::iores jrnlIoRes = _jrnlPtr->dequeue_data_record(dtokPtr);
 #endif
-            switch (res) {
+            switch (jrnlIoRes) {
 #ifdef JOURNAL2
                 case 0:
 #else
@@ -171,36 +171,38 @@
                     break;
                 default:
 #ifdef JOURNAL2
-                    std::cerr << "dequeue_data_record FAILED with " << mrg::journal2::iores_str(res) << ": " << dtokp->status_str() << std::endl;
+                    std::cerr << "dequeue_data_record FAILED with " << mrg::journal2::iores_str(jrnlIoRes) << ": "
+                              << dtokPtr->status_str() << std::endl;
 #else
-                    std::cerr << "dequeue_data_record FAILED with " << mrg::journal::iores_str(res) << ": " << dtokp->status_str() << std::endl;
+                    std::cerr << "dequeue_data_record FAILED with " << mrg::journal::iores_str(jrnlIoRes) << ": "
+                              << dtokPtr->status_str() << std::endl;
 #endif
-                    delete dtokp;
+                    delete dtokPtr;
                     done = true;
             }
         }
-        _jp->get_wr_events(0);
+        _jrnlPtr->get_wr_events(0);
     }
-    _jp->flush(true);
+    _jrnlPtr->flush(true);
 }
 
 // *** MUST BE THREAD-SAFE ****
 // This method will be called by multiple threads simultaneously
 // Main thread entry point.
-// _thread_switch flips on each entry; this makes alternate threads run _enq() and _deq()
+// _threadSwitch flips on each call; this makes alternate threads run _doEnqueues() and _doDequeues()
 void
 JournalInstance::operator()()
 {
-    bool ts;
+    bool localThreadSwitch;
     {
         std::lock_guard<std::mutex> l(_ts_lock);
-        ts = _thread_switch;
-        _thread_switch = !_thread_switch;
+        localThreadSwitch = _threadSwitch;
+        _threadSwitch = !_threadSwitch;
     }
-    if (ts) {
-        _deq();
+    if (localThreadSwitch) {
+        _doDequeues();
     } else {
-        _enq();
+        _doEnqueues();
     }
 }
 
@@ -208,35 +210,35 @@
 // This method will be called by multiple threads simultaneously
 void
 #ifdef JOURNAL2
-JournalInstance::wr_aio_cb(std::vector<mrg::journal2::dtok*>& dtokl)
+JournalInstance::wr_aio_cb(std::vector<mrg::journal2::dtok*>& dataTokenList)
 {
-    mrg::journal2::dtok* dtokp;
+    mrg::journal2::dtok* dtokPtr;
 #else
-JournalInstance::wr_aio_cb(std::vector<mrg::journal::data_tok*>& dtokl)
+JournalInstance::wr_aio_cb(std::vector<mrg::journal::data_tok*>& dataTokenList)
 {
-    mrg::journal::data_tok* dtokp;
+    mrg::journal::data_tok* dtokPtr;
 #endif
-    while (dtokl.size())
+    while (dataTokenList.size())
     {
-        dtokp = dtokl.back();
-        dtokl.pop_back();
+        dtokPtr = dataTokenList.back();
+        dataTokenList.pop_back();
 #ifdef JOURNAL2
-        switch (dtokp->get_dtok_state().get_op_state())
+        switch (dtokPtr->get_dtok_state().get_op_state())
         {
         case mrg::journal2::OP_ENQUEUE:
 
 #else
-        switch (dtokp->wstate())
+        switch (dtokPtr->wstate())
         {
         case mrg::journal::data_tok::ENQ:
 #endif
             {
-                std::unique_lock<std::mutex> l(_ucl_mutex);
-                _ucl.push(dtokp);
+                std::unique_lock<std::mutex> l(_unprocCallbackListMutex);
+                _unprocCallbackList.push(dtokPtr);
             }
             break;
         default:
-            delete dtokp;
+            delete dtokPtr;
         }
     }
 }
@@ -244,8 +246,8 @@
 // *** MUST BE THREAD-SAFE ****
 // This method will be called by multiple threads simultaneously
 void
-JournalInstance::rd_aio_cb(std::vector<uint16_t>& /*pil*/)
+JournalInstance::rd_aio_cb(std::vector<uint16_t>& /*buffPageCtrlBlkIndexList*/)
 {}
 
-} // namespace test
+} // namespace jtest
 } // namespace mrg

Modified: store/trunk/cpp/perf/JournalInstance.hpp
===================================================================
--- store/trunk/cpp/perf/JournalInstance.hpp	2010-12-06 20:34:52 UTC (rev 4427)
+++ store/trunk/cpp/perf/JournalInstance.hpp	2010-12-07 17:01:24 UTC (rev 4428)
@@ -29,12 +29,12 @@
  * The GNU Lesser General Public License is available in the file COPYING.
  */
 
-#ifndef mrg_test_JournalInstance_hpp
-#define mrg_test_JournalInstance_hpp
+#ifndef mrg_jtest_JournalInstance_hpp
+#define mrg_jtest_JournalInstance_hpp
 
 #include <cstdint>
+#include <mutex>
 #include <queue>
-#include <mutex>
 
 #ifdef JOURNAL2
 #include "jrnl2/aio_callback.hpp"
@@ -48,48 +48,130 @@
 
 namespace mrg
 {
-namespace test
+namespace jtest
 {
 
+    /**
+     * \brief Test journal instance. Each queue to be tested results in one instance of this class.
+     *
+     * Journal test harness which contains the journal to be tested. Each queue to be tested in the test parameters
+     * results in one instance of this class being instantiated, and consequently one set of journals on disk. The
+     * journal instance is provided as a pointer to the constructor.
+     */
 #ifdef JOURNAL2
     class JournalInstance: public mrg::journal2::aio_callback
 #else
     class JournalInstance: public mrg::journal::aio_callback
 #endif
     {
-        const uint32_t _num_msgs;
-        const uint32_t _msg_size;
-        const char* _msg_data;
+        const uint32_t _numMsgs;                ///< Number of messages to be processed by this journal instance
+        const uint32_t _msgSize;                ///< Size of each message (in bytes)
+        const char* _msgData;                   ///< Pointer to message content to be used for each message.
 #ifdef JOURNAL2
-        mrg::journal2::jrnl* const _jp;
-        std::queue<mrg::journal2::dtok*> _ucl;
+        mrg::journal2::jrnl* const _jrnlPtr;    ///< Journal instance pointer
+        std::queue<mrg::journal2::dtok*> _unprocCallbackList; ///< Queue of unprocessed callbacks to be dequeued
 #else
-        mrg::journal::jcntl* const _jp;
-        std::queue<mrg::journal::data_tok*> _ucl;
+        mrg::journal::jcntl* const _jrnlPtr;    ///< Journal instance pointer
+        std::queue<mrg::journal::data_tok*> _unprocCallbackList; ///< Queue of unprocessed callbacks to be dequeued
 #endif
-        std::mutex _ucl_mutex;
-        bool _thread_switch;
+        std::mutex _unprocCallbackListMutex;    ///< Mutex which protects the unprocessed callback queue
+        bool _threadSwitch;                     ///< A switch which alternates worker threads between enq and deq
+        std::mutex _ts_lock;                    ///< Mutex which protects the thread switch
 
-        std::mutex _ts_lock;
-        void _enq();
-        void _deq();
+        /**
+         * \brief Worker thread enqueue task
+         *
+         * This function is the worker thread enqueue task entry point. It enqueues _numMsgs onto the journal instance.
+         * A data tokens is created for each record, this is the start of the data token life cycle. All possible
+         * returns from the journal are handled appropriately. Since the enqueue threads also perform
+         * callbacks on completed AIO operations, the data tokens from completed enqueues are placed onto the
+         * unprocessed callback list (_unprocCallbackList) for dequeueing by the dequeue worker thread(s).
+         *
+         * This function must be thread safe.
+         */
+        void _doEnqueues();
+
+        /**
+         * \brief Worker thread dequeue task
+         *
+         * This function is the worker thread dequeue task entry point. It dequeues messages which are on the
+         * unprocessed callback list (_unprocCallbackList).
+         *
+         * This function must be thread safe.
+         */
+        void _doDequeues();
+
     public:
+        /**
+         * \brief Constructor
+         *
+         * Constructor.
+         *
+         * \param numMsgs Number of messages per thread to be enqueued then dequeued (ie both ways through broker)
+         * \param msgSize Size of each message being enqueued
+         * \param msgData Pointer to message content (all messages have identical content)
+         * \param jrnlPtr Pinter to journal instance which is to be tested
+         */
 #ifdef JOURNAL2
-        JournalInstance(const uint32_t num_msgs, const uint32_t msg_size, const char* msg_data, mrg::journal2::jrnl* const jp);
+        JournalInstance(const uint32_t numMsgs,
+                        const uint32_t msgSize,
+                        const char* msgData,
+                        mrg::journal2::jrnl* const jrnlPtr);
 #else
-        JournalInstance(const uint32_t num_msgs, const uint32_t msg_size, const char* msg_data, mrg::journal::jcntl* const jp);
+        JournalInstance(const uint32_t numMsgs,
+                        const uint32_t msgSize,
+                        const char* msgData,
+                        mrg::journal::jcntl* const jrnlPtr);
 #endif
+
+        /**
+         * \brief Destructor
+         *
+         * Destructor.
+         */
         virtual ~JournalInstance();
+
+        /**
+         * \brief Worker thread entry point used by std::thread for classes. Threads must be provided in pairs.
+         *
+         * This is the entry point for worker threads. To successfully use this class, threads must be provided in
+         * pairs, with alternate threads being used for enqueueing and deqeueing tasks (_doEnqueues and _doDequeues
+         * respectively). See these functions for more detail on these tasks. The bool member _threadSwitch is
+         * responsible for alternating threads calling this function between these two tasks.
+         */
         void operator()();
+
+        /**
+         * \brief Write callback function. When AIO operations return, this function is called.
+         *
+         * When AIO operations return, this function will sort the enqueue ops from the rest and place the data tokens
+         * of these records onto the unprocessed callback list (_unprocCallbackList) for dequeueing by another thread.
+         *
+         * Returning dequeue ops have their data tokens destroyed, as this is the end of the life cycle of the data
+         * tokens.
+         *
+         * Required by all subclasses of mrg::journal::aio_callback.
+         *
+         * \param dataTokenList A vector of data tokens for those messages which have completed their AIO write
+         *  operations
+         */
 #ifdef JOURNAL2
-        void wr_aio_cb(std::vector<mrg::journal2::dtok*>& dtokl);
+        void wr_aio_cb(std::vector<mrg::journal2::dtok*>& dataTokenList);
 #else
-        void wr_aio_cb(std::vector<mrg::journal::data_tok*>& dtokl);
+        void wr_aio_cb(std::vector<mrg::journal::data_tok*>& dataTokenList);
 #endif
-        void rd_aio_cb(std::vector<uint16_t>& pil);
+
+        /**
+         * \brief Read callback function. When read AIO operations return, this function is called.
+         *
+         * Not used in this test, but required by all subclasses of mrg::journal::aio_callback.
+         *
+         * \param buffPageCtrlBlkIndexList A vector of indices to the buffer page control blocks for completed reads
+         */
+        void rd_aio_cb(std::vector<uint16_t>& buffPageCtrlBlkIndexList);
     };
 
-} // namespace test
+} // namespace jtest
 } // namespace mrg
 
-#endif // mrg_test_JournalInstance_hpp
+#endif // mrg_jtest_JournalInstance_hpp

Modified: store/trunk/cpp/perf/JournalParameters.cpp
===================================================================
--- store/trunk/cpp/perf/JournalParameters.cpp	2010-12-06 20:34:52 UTC (rev 4427)
+++ store/trunk/cpp/perf/JournalParameters.cpp	2010-12-07 17:01:24 UTC (rev 4428)
@@ -35,7 +35,7 @@
 
 namespace mrg
 {
-namespace test
+namespace jtest
 {
 
 // static declarations
@@ -62,9 +62,9 @@
 JournalParameters::JournalParameters(const std::string& jrnlDir,
                                      const std::string& jrnlBaseFileName,
                                      const uint16_t numJrnlFiles,
+                                     const uint32_t jrnlFileSize_sblks,
                                      const bool autoExpand,
                                      const uint16_t autoExpandMaxJrnlFiles,
-                                     const uint32_t jrnlFileSize_sblks,
                                      const uint16_t writeBuffNumPgs,
                                      const uint32_t writeBuffPgSize_sblks) :
                                      _jrnlDir(jrnlDir),
@@ -77,33 +77,39 @@
                                      _writeBuffPgSize_sblks(writeBuffPgSize_sblks)
 {}
 
-JournalParameters::JournalParameters(const JournalParameters& sp) :
-                                     _jrnlDir(sp._jrnlDir),
-                                     _jrnlBaseFileName(sp._jrnlBaseFileName),
-                                     _numJrnlFiles(sp._numJrnlFiles),
-                                     _jrnlFileSize_sblks(sp._jrnlFileSize_sblks),
-                                     _autoExpand(sp._autoExpand),
-                                     _autoExpandMaxJrnlFiles(sp._autoExpandMaxJrnlFiles),
-                                     _writeBuffNumPgs(sp._writeBuffNumPgs),
-                                     _writeBuffPgSize_sblks(sp._writeBuffPgSize_sblks)
+JournalParameters::JournalParameters(const JournalParameters& jp) :
+                                     _jrnlDir(jp._jrnlDir),
+                                     _jrnlBaseFileName(jp._jrnlBaseFileName),
+                                     _numJrnlFiles(jp._numJrnlFiles),
+                                     _jrnlFileSize_sblks(jp._jrnlFileSize_sblks),
+                                     _autoExpand(jp._autoExpand),
+                                     _autoExpandMaxJrnlFiles(jp._autoExpandMaxJrnlFiles),
+                                     _writeBuffNumPgs(jp._writeBuffNumPgs),
+                                     _writeBuffPgSize_sblks(jp._writeBuffPgSize_sblks)
 
 {}
 
+void
+JournalParameters::toStream(std::ostream& os)
+{
+    os << "Store Parameters:" << std::endl;
+    os << "  jrnlDir = \"" << _jrnlDir << "\"" << std::endl;
+    os << "  jrnlBaseFileName = \"" << _jrnlBaseFileName << "\"" << std::endl;
+    os << "  numJrnlFiles = " << _numJrnlFiles << std::endl;
+    os << "  jrnlFileSize_sblks = " << _jrnlFileSize_sblks << std::endl;
+    os << "  autoExpand = " << _autoExpand << std::endl;
+    os << "  autoExpandMaxJrnlFiles = " << _autoExpandMaxJrnlFiles << std::endl;
+    os << "  writeBuffNumPgs = " << _writeBuffNumPgs << std::endl;
+    os << "  writeBuffPgSize_sblks = " << _writeBuffPgSize_sblks << std::endl;
+}
+
 std::string
-JournalParameters::to_string()
+JournalParameters::toString()
 {
     std::ostringstream oss;
-    oss << "Store Parameters:" << std::endl;
-    oss << "  jrnlDir = \"" << _jrnlDir << "\"" << std::endl;
-    oss << "  jrnlBaseFileName = \"" << _jrnlBaseFileName << "\"" << std::endl;
-    oss << "  numJrnlFiles = " << _numJrnlFiles << std::endl;
-    oss << "  jrnlFileSize_sblks = " << _jrnlFileSize_sblks << std::endl;
-    oss << "  autoExpand = " << _autoExpand << std::endl;
-    oss << "  autoExpandMaxJrnlFiles = " << _autoExpandMaxJrnlFiles << std::endl;
-    oss << "  writeBuffNumPgs = " << _writeBuffNumPgs << std::endl;
-    oss << "  writeBuffPgSize_sblks = " << _writeBuffPgSize_sblks << std::endl;
+    toStream(oss);
     return oss.str();
 }
 
-} // namespace test
+} // namespace jtest
 } // namespace mrg

Modified: store/trunk/cpp/perf/JournalParameters.hpp
===================================================================
--- store/trunk/cpp/perf/JournalParameters.hpp	2010-12-06 20:34:52 UTC (rev 4427)
+++ store/trunk/cpp/perf/JournalParameters.hpp	2010-12-07 17:01:24 UTC (rev 4428)
@@ -29,15 +29,16 @@
  * The GNU Lesser General Public License is available in the file COPYING.
  */
 
-#ifndef mrg_test_JournalParameters_hpp
-#define mrg_test_JournalParameters_hpp
+#ifndef mrg_jtest_JournalParameters_hpp
+#define mrg_jtest_JournalParameters_hpp
 
 #include <cstdint>
+#include <iostream>
 #include <string>
 
 namespace mrg
 {
-namespace test
+namespace jtest
 {
 
     /**
@@ -78,13 +79,22 @@
          * \brief Constructor
          *
          * Convenience constructor.
+         *
+         * \param jrnlDir Journal directory
+         * \param jrnlBaseFileName Journal base file name
+         * \param numJrnlFiles Number of journal data files
+         * \param jrnlFileSize_sblks Journal data file size in softblocks
+         * \param autoExpand Auto-expand flag (allows auto-expansion of journal data files)
+         * \param autoExpandMaxJrnlFiles Default auto-expand file number limit (0 = no limit)
+         * \param writeBuffNumPgs Number of write buffer pages
+         * \param writeBuffPgSize_sblks Size of each write buffer page in softblocks
          */
         JournalParameters(const std::string& jrnlDir,
                           const std::string& jrnlBaseFileName,
                           const uint16_t numJrnlFiles,
+                          const uint32_t jrnlFileSize_sblks,
                           const bool autoExpand,
                           const uint16_t autoExpandMaxJrnlFiles,
-                          const uint32_t jrnlFileSize_sblks,
                           const uint16_t writeBuffNumPgs,
                           const uint32_t writeBuffPgSize_sblks);
 
@@ -92,21 +102,33 @@
          * \brief Copy constructor
          *
          * Copy constructor.
+         *
+         * \param jp Reference to JournalParameters instance to be copied
          */
-        JournalParameters(const JournalParameters& sp);
+        JournalParameters(const JournalParameters& jp);
 
+        /***
+         * \brief Stream the journal parameters to an output stream
+         *
+         * Convenience feature which streams a multi-line representation of all the journal parameters, one per line to
+         * an output stream.
+         *
+         * \param os Output stream to which the class data is to be streamed
+         */
+        void toStream(std::ostream& os = std::cout);
+
         /**
          * \brief Creates a string representation of the journal parameters
          *
-         * Convenience feature which creates a multi-line string representation of all the parameters, one parameter per
+         * Convenience feature which creates a multi-line string representation of all the journal parameters, one per
          * line.
          *
          * \return multi-line string representation of all the parameters, one parameter per line.
          */
-        std::string to_string();
+        std::string toString();
     };
 
-} // namespace test
+} // namespace jtest
 } // namespace mrg
 
-#endif // mrg_test_JournalParameters_hpp
+#endif // mrg_jtest_JournalParameters_hpp

Modified: store/trunk/cpp/perf/ScopedPerformanceTimer.cpp
===================================================================
--- store/trunk/cpp/perf/ScopedPerformanceTimer.cpp	2010-12-06 20:34:52 UTC (rev 4427)
+++ store/trunk/cpp/perf/ScopedPerformanceTimer.cpp	2010-12-07 17:01:24 UTC (rev 4428)
@@ -33,7 +33,7 @@
 
 namespace mrg
 {
-namespace test
+namespace jtest
 {
     ScopedPerformanceTimer::ScopedPerformanceTimer(const TestParameters& tp,
                                                    std::ostream& os) :
@@ -68,5 +68,5 @@
     }
 
 
-} // namespace test
+} // namespace jtest
 } // namespace mrg

Modified: store/trunk/cpp/perf/ScopedPerformanceTimer.hpp
===================================================================
--- store/trunk/cpp/perf/ScopedPerformanceTimer.hpp	2010-12-06 20:34:52 UTC (rev 4427)
+++ store/trunk/cpp/perf/ScopedPerformanceTimer.hpp	2010-12-07 17:01:24 UTC (rev 4428)
@@ -29,8 +29,8 @@
  * The GNU Lesser General Public License is available in the file COPYING.
  */
 
-#ifndef mrg_test_ScopedPerformanceTimer_hpp
-#define mrg_test_ScopedPerformanceTimer_hpp
+#ifndef mrg_jtest_ScopedPerformanceTimer_hpp
+#define mrg_jtest_ScopedPerformanceTimer_hpp
 
 #include <cstdint>
 #include <ctime>
@@ -40,7 +40,7 @@
 
 namespace mrg
 {
-namespace test
+namespace jtest
 {
 
     /**
@@ -100,7 +100,7 @@
         ~ScopedPerformanceTimer();
     };
 
-} // namespace test
+} // namespace jtest
 } // namespace mrg
 
-#endif // mrg_test_ScopedPerformanceTimer_hpp
+#endif // mrg_jtest_ScopedPerformanceTimer_hpp

Modified: store/trunk/cpp/perf/StorePerformanceTest.cpp
===================================================================
--- store/trunk/cpp/perf/StorePerformanceTest.cpp	2010-12-06 20:34:52 UTC (rev 4427)
+++ store/trunk/cpp/perf/StorePerformanceTest.cpp	2010-12-07 17:01:24 UTC (rev 4428)
@@ -53,7 +53,7 @@
 
 namespace mrg
 {
-namespace test
+namespace jtest
 {
 
 #ifdef JOURNAL2
@@ -61,59 +61,59 @@
 #else
 StorePerformanceTest::StorePerformanceTest(const TestParameters& tp, const JournalParameters& jp) :
 #endif
-           _test_params(tp),
-           _store_params(jp),
-           _msg_data(new char[tp._msgSize])
+           _testParams(tp),
+           _jrnlParams(jp),
+           msgData(new char[tp._msgSize])
 {}
 
 StorePerformanceTest::~StorePerformanceTest()
 {
-    while (_tests.size())
+    while (_jrnlList.size())
     {
-        delete _tests.back();
-        _tests.pop_back();
+        delete _jrnlList.back();
+        _jrnlList.pop_back();
     }
-    delete[] _msg_data;
+    delete[] msgData;
 }
 
 void
-StorePerformanceTest::_prepare_journals()
+StorePerformanceTest::_prepareJournals()
 {
 #ifdef JOURNAL2
-    if (mrg::journal2::jdir::exists(_store_params._jrnlDir)) {
-        mrg::journal2::jdir::delete_dir(_store_params._jrnlDir);
+    if (mrg::journal2::jdir::exists(_jrnlParams._jrnlDir)) {
+        mrg::journal2::jdir::delete_dir(_jrnlParams._jrnlDir);
     }
-    mrg::journal2::jdir::create_dir(_store_params._jrnlDir);
+    mrg::journal2::jdir::create_dir(_jrnlParams._jrnlDir);
     mrg::journal2::jrnl* jp;
 #else
-    if (mrg::journal::jdir::exists(_store_params._jrnlDir)) {
-        mrg::journal::jdir::delete_dir(_store_params._jrnlDir);
+    if (mrg::journal::jdir::exists(_jrnlParams._jrnlDir)) {
+        mrg::journal::jdir::delete_dir(_jrnlParams._jrnlDir);
     }
-    mrg::journal::jdir::create_dir(_store_params._jrnlDir);
+    mrg::journal::jdir::create_dir(_jrnlParams._jrnlDir);
     mrg::journal::jcntl* jp;
 #endif
     JournalInstance* ptp;
-    for (uint16_t j = 0; j < _test_params._numQueues; j++)
+    for (uint16_t j = 0; j < _testParams._numQueues; j++)
     {
         std::ostringstream jname;
         jname << "jrnl_" << std::setw(4) << std::setfill('0') << j;
         std::ostringstream jdir;
-        jdir << _store_params._jrnlDir << "/" << jname.str();
+        jdir << _jrnlParams._jrnlDir << "/" << jname.str();
 #ifdef JOURNAL2
-        jp = new mrg::journal2::jrnl(jname.str(), jdir.str(), _store_params._jrnlBaseFileName);
+        jp = new mrg::journal2::jrnl(jname.str(), jdir.str(), _jrnlParams._jrnlBaseFileName);
 #else
-        jp = new mrg::journal::jcntl(jname.str(), jdir.str(), _store_params._jrnlBaseFileName);
+        jp = new mrg::journal::jcntl(jname.str(), jdir.str(), _jrnlParams._jrnlBaseFileName);
 #endif
-        ptp = new JournalInstance(_test_params._numMsgs, _test_params._msgSize, _msg_data, jp);
+        ptp = new JournalInstance(_testParams._numMsgs, _testParams._msgSize, msgData, jp);
 #ifdef JOURNAL2
-        jp->initialize(&_store_params, ptp);
+        jp->initialize(&_jrnlParams, ptp);
 #else
-        jp->initialize(_store_params._numJrnlFiles, _store_params._autoExpand, _store_params._autoExpandMaxJrnlFiles,
-                        _store_params._jrnlFileSize_sblks, _store_params._writeBuffNumPgs,
-                        _store_params._writeBuffPgSize_sblks, ptp);
+        jp->initialize(_jrnlParams._numJrnlFiles, _jrnlParams._autoExpand, _jrnlParams._autoExpandMaxJrnlFiles,
+                        _jrnlParams._jrnlFileSize_sblks, _jrnlParams._writeBuffNumPgs,
+                        _jrnlParams._writeBuffPgSize_sblks, ptp);
 #endif
 
-        _tests.push_back(ptp);
+        _jrnlList.push_back(ptp);
     }
 }
 
@@ -122,17 +122,17 @@
 {
     std::deque<std::thread*> threads;
     std::thread* tp;
-    _prepare_journals();
+    _prepareJournals();
     {
         // --- Start of timed section ---
-        ScopedPerformanceTimer pt(_test_params);
+        ScopedPerformanceTimer pt(_testParams);
 
-        for (uint16_t q=0; q<_test_params._numQueues; q++)
+        for (uint16_t q=0; q<_testParams._numQueues; q++)
         {
             // Launch threads in pairs
-            for (uint16_t t=0; t<_test_params._numThreadPairsPerQueue * 2; t++)
+            for (uint16_t t=0; t<_testParams._numThreadPairsPerQueue * 2; t++)
             {
-                tp = new std::thread(std::ref(*_tests[q]));
+                tp = new std::thread(std::ref(*_jrnlList[q]));
                 threads.push_back(tp);
             }
         }
@@ -149,67 +149,67 @@
 }
 
 void
-print_args()
+printArgs(std::ostream& os)
 {
-    std::cout << " -h --help:                       This help message" << std::endl;
-    std::cout << std::endl;
-    std::cout << "Test params:" << std::endl;
-    std::cout << " -M --num_msgs:                   Number of messages to send ["
+    os << " -h --help:                       This help message" << std::endl;
+    os << std::endl;
+    os << "Test params:" << std::endl;
+    os << " -M --num_msgs:                   Number of messages to send ["
               << TestParameters::_s_defaultNumMsgs << "]" << std::endl;
-    std::cout << " -S --msg_size:                   Size of each message to be sent ["
+    os << " -S --msg_size:                   Size of each message to be sent ["
               << TestParameters::_s_defaultMsgSize << "]" << std::endl;
-    std::cout << " -Q --num_queues:                 Number of simultaneous queues ["
+    os << " -Q --num_queues:                 Number of simultaneous queues ["
               << TestParameters::_s_defaultNumQueues << "]" << std::endl;
-    std::cout << " -T --num_thread_pairs_per_queue: Number of thread pairs per queue ["
+    os << " -T --num_thread_pairs_per_queue: Number of thread pairs per queue ["
               << TestParameters::_s_defaultNumThreadPairsPerQueue << "]" << std::endl;
-    std::cout << " -E --enq_txn_blk_size:           Enqueue transaction block size (0=non-txn) ["
+    os << " -E --enq_txn_blk_size:           Enqueue transaction block size (0=non-txn) ["
               << TestParameters::_s_defaultEnqTxnBlkSize << "]" << std::endl;
-    std::cout << " -D --deq_txn_blk_size:           Dequeue transaction block size (0=non-txn) ["
+    os << " -D --deq_txn_blk_size:           Dequeue transaction block size (0=non-txn) ["
               << TestParameters::_s_defaultDeqTxnBlkSize << "]" << std::endl;
-    std::cout << std::endl;
-    std::cout << "Store params:" << std::endl;
+    os << std::endl;
+    os << "Store params:" << std::endl;
 #ifdef JOURNAL2
-    std::cout << " -d --jrnl_dir:                   Store directory [\""
+    os << " -d --jrnl_dir:                   Store directory [\""
               << mrg::journal2::JournalParameters::_s_defaultJrnlDir << "\"]" << std::endl;
-    std::cout << " -b --jrnl_base_filename:         Base name for journal files [\""
+    os << " -b --jrnl_base_filename:         Base name for journal files [\""
               << mrg::journal2::JournalParameters::_s_defaultJrnlBaseFileName << "\"]" << std::endl;
-    std::cout << " -f --num_jfiles:                 Number of journal files ["
+    os << " -f --num_jfiles:                 Number of journal files ["
               << mrg::journal2::JournalParameters::_s_defaultNumJrnlFiles << "]" << std::endl;
-    std::cout << " -s --jfsize_sblks:               Size of each journal file in sblks (512 byte blocks) ["
+    os << " -s --jfsize_sblks:               Size of each journal file in sblks (512 byte blocks) ["
               << mrg::journal2::JournalParameters::_s_defaultJrnlFileSize_sblks << "]" << std::endl;
-    std::cout << " -a --auto_expand:                Auto-expand the journal ["
+    os << " -a --auto_expand:                Auto-expand the journal ["
               << (mrg::journal2::JournalParameters::_s_defaultAutoExpand?"T":"F") << "]" << std::endl;
-    std::cout << " -e --ae_max_jfiles:              Upper limit on number of auto-expanded journal files ["
+    os << " -e --ae_max_jfiles:              Upper limit on number of auto-expanded journal files ["
               << mrg::journal2::JournalParameters::_s_defaultAutoExpandMaxJrnlFiles << "]" << std::endl;
-    std::cout << " -p --wcache_num_pages:           Number of write buffer pages ["
+    os << " -p --wcache_num_pages:           Number of write buffer pages ["
               << mrg::journal2::JournalParameters::_s_defaultWriteBuffNumPgs << "]" << std::endl;
-    std::cout << " -c --wcache_pgsize_sblks:        Size of each write buffer page in sblks (512 byte blocks) ["
+    os << " -c --wcache_pgsize_sblks:        Size of each write buffer page in sblks (512 byte blocks) ["
               << mrg::journal2::JournalParameters::_s_defaultWriteBuffPgSize_sblks << "]" << std::endl;
 #else
-    std::cout << " -d --jrnl_dir:                   Store directory [\""
+    os << " -d --jrnl_dir:                   Store directory [\""
               << JournalParameters::_s_defaultJrnlDir << "\"]" << std::endl;
-    std::cout << " -b --jrnl_base_filename:         Base name for journal files [\""
+    os << " -b --jrnl_base_filename:         Base name for journal files [\""
               << JournalParameters::_s_defaultJrnlBaseFileName << "\"]" << std::endl;
-    std::cout << " -f --num_jfiles:                 Number of journal files ["
+    os << " -f --num_jfiles:                 Number of journal files ["
               << JournalParameters::_s_defaultNumJrnlFiles << "]" << std::endl;
-    std::cout << " -s --jfsize_sblks:               Size of each journal file in sblks (512 byte blocks) ["
+    os << " -s --jfsize_sblks:               Size of each journal file in sblks (512 byte blocks) ["
               << JournalParameters::_s_defaultJrnlFileSize_sblks << "]" << std::endl;
-    std::cout << " -a --auto_expand:                Auto-expand the journal ["
+    os << " -a --auto_expand:                Auto-expand the journal ["
               << (JournalParameters::_s_defaultAutoExpand?"T":"F") << "]" << std::endl;
-    std::cout << " -e --ae_max_jfiles:              Upper limit on number of auto-expanded journal files ["
+    os << " -e --ae_max_jfiles:              Upper limit on number of auto-expanded journal files ["
               << JournalParameters::_s_defaultAutoExpandMaxJrnlFiles << "]" << std::endl;
-    std::cout << " -p --wcache_num_pages:           Number of write buffer pages ["
+    os << " -p --wcache_num_pages:           Number of write buffer pages ["
               << JournalParameters::_s_defaultWriteBuffNumPgs << "]" << std::endl;
-    std::cout << " -c --wcache_pgsize_sblks:        Size of each write buffer page in sblks (512 byte blocks) ["
+    os << " -c --wcache_pgsize_sblks:        Size of each write buffer page in sblks (512 byte blocks) ["
               << JournalParameters::_s_defaultWriteBuffPgSize_sblks << "]" << std::endl;
 #endif
 }
 
 bool
 #ifdef JOURNAL2
-read_args(int argc, char** argv, mrg::test::TestParameters& tp, mrg::journal2::JournalParameters& sp)
+readArgs(int argc, char** argv, TestParameters& tp, mrg::journal2::JournalParameters& sp)
 #else
-read_args(int argc, char** argv, mrg::test::TestParameters& tp, mrg::test::JournalParameters& sp)
+readArgs(int argc, char** argv, TestParameters& tp, JournalParameters& sp)
 #endif
 {
     static struct option long_options[] = {
@@ -286,13 +286,13 @@
         case 'h':
         default:
             err = true;
-            print_args();
+            printArgs();
         }
     }
     return err;
 }
 
-} // namespace test
+} // namespace jtest
 } // namespace mrg
 
 // -----------------------------------------------------------------
@@ -300,16 +300,16 @@
 int
 main(int argc, char** argv)
 {
-    mrg::test::TestParameters tp;
+    mrg::jtest::TestParameters tp;
 #ifdef JOURNAL2
     mrg::journal2::JournalParameters jp;
 #else
-    mrg::test::JournalParameters jp;
+    mrg::jtest::JournalParameters jp;
 #endif
-    if (mrg::test::read_args(argc, argv, tp, jp)) return 1;
-    std::cout << tp.to_string() << std::endl;
-    std::cout << jp.to_string() << std::endl;
-    mrg::test::StorePerformanceTest p(tp, jp);
+    if (mrg::jtest::readArgs(argc, argv, tp, jp)) return 1;
+    std::cout << tp.toString() << std::endl;
+    std::cout << jp.toString() << std::endl;
+    mrg::jtest::StorePerformanceTest p(tp, jp);
     p.run();
 
     return 0;

Modified: store/trunk/cpp/perf/StorePerformanceTest.hpp
===================================================================
--- store/trunk/cpp/perf/StorePerformanceTest.hpp	2010-12-06 20:34:52 UTC (rev 4427)
+++ store/trunk/cpp/perf/StorePerformanceTest.hpp	2010-12-07 17:01:24 UTC (rev 4428)
@@ -29,9 +29,10 @@
  * The GNU Lesser General Public License is available in the file COPYING.
  */
 
-#ifndef mrg_test_StorePerformanceTest_hpp
-#define mrg_test_StorePerformanceTest_hpp
+#ifndef mrg_jtest_StorePerformanceTest_hpp
+#define mrg_jtest_StorePerformanceTest_hpp
 
+#include <iostream>
 #include <vector>
 
 #include "JournalInstance.hpp"
@@ -47,38 +48,93 @@
 
 namespace mrg
 {
-namespace test
+namespace jtest
 {
 
+    /**
+     * \brief Main test class; Create an instance and execute run()
+     *
+     * Main test class which aggregates the components of a test.
+     */
     class StorePerformanceTest
     {
-        const TestParameters& _test_params;
+        const TestParameters& _testParams;          ///< Ref to a struct containing test params
 #ifdef JOURNAL2
-        const mrg::journal2::JournalParameters& _store_params;
+        const mrg::journal2::JournalParameters& _jrnlParams; ///< Ref to a struct containing the journal parameters
 #else
-        const JournalParameters& _store_params;
+        const JournalParameters& _jrnlParams;       ///< Ref to a struct containing the journal parameters
 #endif
-        const char* _msg_data;
-        std::vector<JournalInstance*> _tests;
-        void _prepare_journals();
+        const char* msgData;                        ///< Pointer to msg data, which is the same for all messages
+        std::vector<JournalInstance*> _jrnlList;    ///< List of journals (JournalInstance instances) being tested
+
+        /**
+         * \brief Creates journals and JournalInstance classes for all journals (queues) to be tested
+         *
+         * Creates a new journal instance and JournalInstance instance for each queue. The journals are initialized
+         * which creates a new set of journal files on the local storage media (which is determined by path in
+         * JournalParameters._jrnlDir). This activity is not timed, and is not a part of the performance test per se.
+         */
+        void _prepareJournals();
+
     public:
+        /**
+         * \brief Constructor
+         *
+         * Constructor.
+         *
+         * \param tp Test parameters for the test
+         * \param jp Journal parameters for all queues (journals) in the test
+         */
 #ifdef JOURNAL2
-        StorePerformanceTest(const TestParameters& tp, const mrg::journal2::JournalParameters& sp);
+        StorePerformanceTest(const TestParameters& tp, const mrg::journal2::JournalParameters& jp);
 #else
-        StorePerformanceTest(const TestParameters& tp, const JournalParameters& sp);
+        StorePerformanceTest(const TestParameters& tp, const JournalParameters& jp);
 #endif
+
+        /**
+         * \brief Destructor
+         *
+         * Destructor.
+         */
         ~StorePerformanceTest();
+
+        /**
+         * \brief Runs the test and prints out the results.
+         *
+         * Runs the test  as set by the test parameters and journal parameters.
+         */
         void run();
     };
 
-    void print_args();
+    /**
+     * \brief Print out the program arguments
+     *
+     * Print out the arguments to the performance program if requested by help or a parameter error.
+     *
+     * \param os Stream to which the arguments should be streamed.
+     */
+    void printArgs(std::ostream& os = std::cout);
+
+    /**
+     * \brief Process the command-line arguments
+     *
+     * Process the command-line arguments and populate the TestParameters and JournalParameters structs. Only the
+     * arguments supplied are on the command-line are changed in these structs, the others remain unchanged. It is
+     * important therefore to make sure that defaults are pre-loaded (the default behavior of the default constructors
+     * for these structs).
+     *
+     * \param argc Number of command-line arguments.  Process directly from main().
+     * \param argv Pointer to array of command-line argument pointers. Process directly from main().
+     * \param tp Reference to test parameter object. Only params on the command-line are changed.
+     * \param jp Reference to journal parameter object. Only params on the command-line are changed.
+     */
 #ifdef JOURNAL2
-    bool read_args(int argc, char** argv, mrg::test::TestParameters& tp, mrg::journal2::JournalParameters& sp);
+    bool readArgs(int argc, char** argv, TestParameters& tp, mrg::journal2::JournalParameters& jp);
 #else
-    bool read_args(int argc, char** argv, mrg::test::TestParameters& tp, mrg::test::JournalParameters& sp);
+    bool readArgs(int argc, char** argv, TestParameters& tp, JournalParameters& jp);
 #endif
 
-} // namespace test
+} // namespace jtest
 } // namespace mrg
 
-#endif // mrg_test_StorePerformanceTest_hpp
+#endif // mrg_jtest_StorePerformanceTest_hpp

Modified: store/trunk/cpp/perf/TestParameters.cpp
===================================================================
--- store/trunk/cpp/perf/TestParameters.cpp	2010-12-06 20:34:52 UTC (rev 4427)
+++ store/trunk/cpp/perf/TestParameters.cpp	2010-12-07 17:01:24 UTC (rev 4428)
@@ -35,7 +35,7 @@
 
 namespace mrg
 {
-namespace test
+namespace jtest
 {
 
 // static declarations
@@ -78,19 +78,25 @@
                                _deqTxnBlockSize(tp._deqTxnBlockSize)
 {}
 
+void
+TestParameters::toStream(std::ostream& os)
+{
+    os << "Test Parameters:" << std::endl;
+    os << "  num_msgs = " << _numMsgs << std::endl;
+    os << "  msg_size = " << _msgSize << std::endl;
+    os << "  num_queues = " << _numQueues << std::endl;
+    os << "  num_thread_pairs_per_queue = " << _numThreadPairsPerQueue << std::endl;
+    os << "  enq_txn_blk_size = " << _enqTxnBlockSize << std::endl;
+    os << "  deq_txn_blk_size = " << _deqTxnBlockSize << std::endl;
+}
+
 std::string
-TestParameters::to_string()
+TestParameters::toString()
 {
     std::ostringstream oss;
-    oss << "Test Parameters:" << std::endl;
-    oss << "  num_msgs = " << _numMsgs << std::endl;
-    oss << "  msg_size = " << _msgSize << std::endl;
-    oss << "  num_queues = " << _numQueues << std::endl;
-    oss << "  num_thread_pairs_per_queue = " << _numThreadPairsPerQueue << std::endl;
-    oss << "  enq_txn_blk_size = " << _enqTxnBlockSize << std::endl;
-    oss << "  deq_txn_blk_size = " << _deqTxnBlockSize << std::endl;
+    toStream(oss);
     return oss.str();
 }
 
-} // namespace test
+} // namespace jtest
 } // namespace mrg

Modified: store/trunk/cpp/perf/TestParameters.hpp
===================================================================
--- store/trunk/cpp/perf/TestParameters.hpp	2010-12-06 20:34:52 UTC (rev 4427)
+++ store/trunk/cpp/perf/TestParameters.hpp	2010-12-07 17:01:24 UTC (rev 4428)
@@ -29,15 +29,16 @@
  * The GNU Lesser General Public License is available in the file COPYING.
  */
 
-#ifndef mrg_test_TestParameters_hpp
-#define mrg_test_TestParameters_hpp
+#ifndef mrg_jtest_TestParameters_hpp
+#define mrg_jtest_TestParameters_hpp
 
 #include <cstdint>
+#include <iostream>
 #include <string>
 
 namespace mrg
 {
-namespace test
+namespace jtest
 {
 
     /**
@@ -49,15 +50,15 @@
     struct TestParameters
     {
         static uint32_t _s_defaultNumMsgs;                  ///< Default number of messages to be sent
-        static uint32_t _s_defaultMsgSize;                  ///< Default message size
-        static uint16_t _s_defaultNumQueues;                ///< Default number of queues
+        static uint32_t _s_defaultMsgSize;                  ///< Default message size in bytes
+        static uint16_t _s_defaultNumQueues;                ///< Default number of queues to test simultaneously
         static uint16_t _s_defaultNumThreadPairsPerQueue;   ///< Default number of thread pairs (enq and deq) per queue
         static uint16_t _s_defaultEnqTxnBlkSize;            ///< Default transaction block size for enqueues
         static uint16_t _s_defaultDeqTxnBlkSize;            ///< Default transaction block size for dequeues
 
         uint32_t _numMsgs;                                  ///< Number of messages to be sent
-        uint32_t _msgSize;                                  ///< Message size
-        uint16_t _numQueues;                                ///< Number of queues
+        uint32_t _msgSize;                                  ///< Message size in bytes
+        uint16_t _numQueues;                                ///< Number of queues to test simultaneously
         uint16_t _numThreadPairsPerQueue;                   ///< Number of thread pairs (enq and deq) per queue
         uint16_t _enqTxnBlockSize;                          ///< Transaction block size for enqueues
         uint16_t _deqTxnBlockSize;                          ///< Transaction block size for dequeues
@@ -73,6 +74,13 @@
          * \brief Constructor
          *
          * Convenience constructor.
+         *
+         * \param numMsgs Number of messages to be sent
+         * \param msgSize Message size in bytes
+         * \param numQueues Number of queues to test simultaneously
+         * \param numThreadPairsPerQueue Number of thread pairs (enq and deq) per queue
+         * \param enqTxnBlockSize Transaction block size for enqueues
+         * \parma deqTxnBlockSize Transaction block size for dequeues
          */
         TestParameters(const uint32_t numMsgs,
                        const uint32_t msgSize,
@@ -85,21 +93,33 @@
          * \brief Copy constructor
          *
          * Copy constructor.
+         *
+         * \param tp Reference to TestParameters instance to be copied
          */
         TestParameters(const TestParameters& tp);
 
+        /***
+         * \brief Stream the test parameters to an output stream
+         *
+         * Convenience feature which streams a multi-line representation of all the test parameters, one per line to an
+         * output stream.
+         *
+         * \param os Output stream to which the class data is to be streamed
+         */
+        void toStream(std::ostream& os = std::cout);
+
         /**
          * \brief Creates a string representation of the test parameters
          *
-         * Convenience feature which creates a multiline string representation of all the parameters, one parameter per
-         * line.
+         * Convenience feature which creates a multi-line string representation of all the test parameters, one
+         * per line.
          *
-         * \return multiline string representation of all the parameters, one parameter per line.
+         * \return multi-line string representation of all the parameters, one parameter per line.
          */
-        std::string to_string();
+        std::string toString();
     };
 
-} // namespace test
+} // namespace jtest
 } // namespace mrg
 
-#endif // mrg_test_TestParameters_hpp
+#endif // mrg_jtest_TestParameters_hpp



More information about the rhmessaging-commits mailing list