rhmessaging commits: r4409 - in store/trunk/cpp: lib/jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-11-01 15:28:39 -0400 (Mon, 01 Nov 2010)
New Revision: 4409
Modified:
store/trunk/cpp/Makefile.am
store/trunk/cpp/configure.ac
store/trunk/cpp/lib/jrnl/data_tok.cpp
Log:
Add perf dir (from last checkin) to configure.ac and Makefile.am. Also a bugfix in the data token class data_tok's status_str() method printing the wrong information.
Modified: store/trunk/cpp/Makefile.am
===================================================================
--- store/trunk/cpp/Makefile.am 2010-11-01 19:23:53 UTC (rev 4408)
+++ store/trunk/cpp/Makefile.am 2010-11-01 19:28:39 UTC (rev 4409)
@@ -28,7 +28,7 @@
sysconf_DATA = etc/rhmd.conf
-SUBDIRS = lib tests tools docs
+SUBDIRS = lib tests tools perf docs
# Update libtool, if needed.
libtool: $(LIBTOOL_DEPS)
Modified: store/trunk/cpp/configure.ac
===================================================================
--- store/trunk/cpp/configure.ac 2010-11-01 19:23:53 UTC (rev 4408)
+++ store/trunk/cpp/configure.ac 2010-11-01 19:28:39 UTC (rev 4409)
@@ -221,6 +221,7 @@
tests/cluster/Makefile
tests/jrnl/Makefile
tests/jrnl/jtt/Makefile
+ perf/Makefile
tools/Makefile
lib/Makefile
docs/Makefile
Modified: store/trunk/cpp/lib/jrnl/data_tok.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/data_tok.cpp 2010-11-01 19:23:53 UTC (rev 4408)
+++ store/trunk/cpp/lib/jrnl/data_tok.cpp 2010-11-01 19:28:39 UTC (rev 4409)
@@ -175,7 +175,7 @@
{
std::ostringstream oss;
oss << std::hex << std::setfill('0');
- oss << "dtok id=0x" << _cnt << "; ws=" << wstate_str() << "; rs=" << rstate_str();
+ oss << "dtok id=0x" << _icnt << "; ws=" << wstate_str() << "; rs=" << rstate_str();
oss << "; fid=0x" << _fid << "; rid=0x" << _rid << "; xid=";
for (unsigned i=0; i<_xid.size(); i++)
{
14 years, 2 months
rhmessaging commits: r4408 - in store/trunk/cpp: perf and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-11-01 15:23:53 -0400 (Mon, 01 Nov 2010)
New Revision: 4408
Added:
store/trunk/cpp/perf/
store/trunk/cpp/perf/Makefile.am
store/trunk/cpp/perf/README
store/trunk/cpp/perf/perf.cpp
store/trunk/cpp/perf/perf.hpp
store/trunk/cpp/perf/perf_test.cpp
store/trunk/cpp/perf/perf_test.hpp
store/trunk/cpp/perf/perf_timer.cpp
store/trunk/cpp/perf/perf_timer.hpp
store/trunk/cpp/perf/store_params.cpp
store/trunk/cpp/perf/store_params.hpp
store/trunk/cpp/perf/test_params.cpp
store/trunk/cpp/perf/test_params.hpp
Log:
Experimental store performance measurement and test client
Property changes on: store/trunk/cpp/perf
___________________________________________________________________
Name: svn:ignore
+ Makefile.in
Makefile
perf
.deps
Added: store/trunk/cpp/perf/Makefile.am
===================================================================
--- store/trunk/cpp/perf/Makefile.am (rev 0)
+++ store/trunk/cpp/perf/Makefile.am 2010-11-01 19:23:53 UTC (rev 4408)
@@ -0,0 +1,42 @@
+# Copyright (c) 2010 Red Hat, Inc.
+#
+# This file is part of the Qpid async store library msgstore.so.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+# USA
+#
+# The GNU Lesser General Public License is available in the file COPYING.
+
+abs_builddir=@abs_builddir@
+abs_srcdir=@abs_srcdir@
+
+AM_CXXFLAGS = $(WARNING_CFLAGS) $(APR_CXXFLAGS) $(QPID_CXXFLAGS) -DBOOST_TEST_DYN_LINK
+INCLUDES=-I$(top_srcdir)/lib -I$(abs_builddir)/../lib -I$(top_srcdir)/lib/gen
+
+bin_PROGRAMS = perf
+
+perf_SOURCES = \
+ perf.cpp \
+ perf_test.cpp \
+ perf_timer.cpp \
+ store_params.cpp \
+ test_params.cpp \
+ perf.hpp \
+ perf_test.hpp \
+ perf_timer.hpp \
+ store_params.hpp \
+ test_params.hpp
+perf_CXXFLAGS = -std=c++0x -lpthread
+perf_LDADD = -lrt $(top_builddir)/lib/msgstore.la
Added: store/trunk/cpp/perf/README
===================================================================
--- store/trunk/cpp/perf/README (rev 0)
+++ store/trunk/cpp/perf/README 2010-11-01 19:23:53 UTC (rev 4408)
@@ -0,0 +1,37 @@
+THIS IS EXPERIMENTAL CODE
+-------------------------
+
+This folder contains a general async store test and performance measurement tool. It
+uses the jcntl interface to enqueue and dequeue messages as fast as possible from
+a number of persistent store instances.
+
+The parameters fall into two groups:
+
+1. Test parameters:
+
+-m --num_msgs: Number of messages to send
+-S --msg_size: Size of each message to be sent
+-q --num_queues: Number of simultaneous queues
+-t --num_threads_per_queue: Number of threads per queue
+
+2. Store parameters, which control the attributes of the store itself:
+
+-d --jrnl_dir: Store directory
+-b --jrnl_base_filename: Base name for journal files
+-f --num_jfiles: Number of journal files
+-s --jfsize_sblks: Size of each journal file in sblks (512 byte blocks)
+-a --auto_expand: Auto-expand the journal
+-e --ae_max_jfiles: Upper limit on number of auto-expanded journal files
+-p --wcache_num_pages: Number of write buffer pages
+-c --wcache_pgsize_sblks: Size of each write buffer page in sblks (512 byte blocks)
+
+For each test:
+
+a. The correct number of store instances are created with their formatted store files;
+b. The timer begins;
+c. The specified number of threads are created and do the work of enqueueing and
+ dequeueing persistent messages on the specified number of store instances;
+d. When all threads have finished working, the timer is stopped;
+e. The results of the test are printed.
+
+
Added: store/trunk/cpp/perf/perf.cpp
===================================================================
--- store/trunk/cpp/perf/perf.cpp (rev 0)
+++ store/trunk/cpp/perf/perf.cpp 2010-11-01 19:23:53 UTC (rev 4408)
@@ -0,0 +1,248 @@
+/**
+ * \file perf.cpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains performance test code for the journal.
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#include "perf.hpp"
+
+#include <cstdint> // uint16_t, uint32_t
+#include <cstdlib> // atof, atoi, atol
+#include <deque>
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <thread>
+
+#include <getopt.h>
+#include <unistd.h>
+
+#include "jrnl/jdir.hpp"
+#include "perf_timer.hpp"
+
+namespace mrg
+{
+namespace test
+{
+
+perf::perf(const test_params& tp, const store_params& sp) :
+ _test_params(tp),
+ _store_params(sp),
+ _msg_data(new char[tp._msg_size])
+{}
+
+perf::~perf()
+{
+ while (_tests.size())
+ {
+ delete _tests.back();
+ _tests.pop_back();
+ }
+ delete[] _msg_data;
+}
+
+void
+perf::prepare_journals()
+{
+ if (mrg::journal::jdir::exists(_store_params._jrnl_dir)) mrg::journal::jdir::delete_dir(_store_params._jrnl_dir);
+ mrg::journal::jdir::create_dir(_store_params._jrnl_dir);
+
+ mrg::journal::jcntl* jp;
+ perf_test* ptp;
+ for (uint16_t j = 0; j < _test_params._num_queues; j++)
+ {
+ std::ostringstream jname;
+ jname << "jrnl_" << std::setw(4) << std::setfill('0') << j;
+ std::ostringstream jdir;
+ jdir << _store_params._jrnl_dir << "/" << jname.str();
+ jp = new mrg::journal::jcntl(jname.str(), jdir.str(), _store_params._jrnl_base_filename);
+ ptp = new perf_test(_test_params._num_msgs, _test_params._msg_size, _msg_data, jp);
+ jp->initialize(_store_params._num_jfiles, _store_params._auto_expand, _store_params._ae_max_jfiles,
+ _store_params._jfsize_sblks, _store_params._wcache_num_pages,
+ _store_params._wcache_pgsize_sblks, ptp);
+
+ _tests.push_back(ptp);
+ }
+}
+
+void
+perf::run()
+{
+ std::deque<std::thread*> threads;
+ std::thread* thread;
+ prepare_journals();
+ {
+ // --- Start of timed section ---
+ mrg::test::perf_timer t(_test_params._num_msgs, _test_params._msg_size, _test_params._num_queues,
+ _test_params._num_threads_per_queue);
+
+ for (uint16_t q=0; q<_test_params._num_queues; q++)
+ {
+ for (uint16_t t=0; t<_test_params._num_threads_per_queue; t++)
+ {
+ thread = new std::thread(std::ref(*_tests[q]));
+ threads.push_back(thread);
+ }
+ }
+
+ while (threads.size())
+ {
+ threads.front()->join();
+ delete threads.front();
+ threads.pop_front();
+ }
+ // --- End of timed section ---
+ }
+}
+
+} // namespace test
+} // namespace mrg
+
+// -----------------------------------------------------------------
+
+void
+print_args()
+{
+ mrg::test::test_params tp;
+ mrg::test::store_params sp;
+
+ 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" << std::endl;
+ std::cout << "-S --msg_size: Size of each message to be sent" << std::endl;
+ std::cout << "-q --num_queues: Number of simultaneous queues" << std::endl;
+ std::cout << "-t --num_threads_per_queue: Number of threads per queue" << std::endl;
+ std::cout << std::endl;
+ std::cout << "Store params:" << std::endl;
+ std::cout << "-d --jrnl_dir: Store directory" << std::endl;
+ std::cout << "-b --jrnl_base_filename: Base name for journal files" << std::endl;
+ std::cout << "-f --num_jfiles: Number of journal files" << std::endl;
+ std::cout << "-s --jfsize_sblks: Size of each journal file in sblks (512 byte blocks)" << std::endl;
+ std::cout << "-a --auto_expand: Auto-expand the journal" << std::endl;
+ std::cout << "-e --ae_max_jfiles: Upper limit on number of auto-expanded journal files" << std::endl;
+ std::cout << "-p --wcache_num_pages: Number of write buffer pages" << std::endl;
+ std::cout << "-c --wcache_pgsize_sblks: Size of each write buffer page in sblks (512 byte blocks)" << std::endl;
+}
+
+bool
+read_args(int argc, char** argv, mrg::test::test_params& tp, mrg::test::store_params& sp)
+{
+ static struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+
+ // Test params
+ {"num_msgs", required_argument, 0, 'm'},
+ {"msg_size", required_argument, 0, 'S'},
+ {"num_queues", required_argument, 0, 'q'},
+ {"num_threads_per_queue", required_argument, 0, 't'},
+
+ // Journal params
+ {"jrnl_dir", required_argument, 0, 'd'},
+ {"jrnl_base_filename", required_argument, 0, 'b'},
+ {"num_jfiles", required_argument, 0, 'f'},
+ {"jfsize_sblks", required_argument, 0, 's'},
+ {"auto_expand", no_argument, 0, 'a'},
+ {"ae_max_jfiles", required_argument, 0, 'e'},
+ {"wcache_num_pages", required_argument, 0, 'p'},
+ {"wcache_pgsize_sblks", required_argument, 0, 'c'},
+
+ {0, 0, 0, 0}
+ };
+ bool err = false;
+ int c = 0;
+ while (true)
+ {
+ int option_index = 0;
+ c = getopt_long(argc, argv, "ab:c:d:e:f:hm:p:q:s:S:t:", long_options, &option_index);
+ if (c == -1) break;
+ switch (c)
+ {
+ // Test params
+ case 'm':
+ tp._num_msgs = uint32_t(std::atol(optarg));
+ break;
+ case 'S':
+ tp._msg_size = uint32_t(std::atol(optarg));
+ break;
+ case 'q':
+ tp._num_queues = uint16_t(std::atoi(optarg));
+ break;
+ case 't':
+ tp._num_threads_per_queue = uint16_t(std::atoi(optarg));
+ break;
+
+ // Store params
+ case 'd':
+ sp._jrnl_dir.assign(optarg);
+ break;
+ case 'b':
+ sp._jrnl_base_filename.assign(optarg);
+ break;
+ case 'f':
+ sp._num_jfiles = uint16_t(std::atoi(optarg));
+ break;
+ case 's':
+ sp._jfsize_sblks = uint32_t(std::atol(optarg));
+ break;
+ case 'a':
+ sp._auto_expand = true;
+ break;
+ case 'e':
+ sp._ae_max_jfiles = uint16_t(std::atoi(optarg));
+ break;
+ case 'p':
+ sp._wcache_num_pages = uint16_t(std::atoi(optarg));
+ break;
+ case 'c':
+ sp._wcache_pgsize_sblks = uint32_t(std::atol(optarg));
+ break;
+
+ // Other
+ case 'h':
+ default:
+ err = true;
+ print_args();
+ }
+ }
+ return err;
+}
+
+int
+main(int argc, char** argv)
+{
+ mrg::test::test_params tp;
+ mrg::test::store_params sp;
+ if (read_args(argc, argv, tp, sp)) return 1;
+ std::cout << tp.to_string() << std::endl;
+ std::cout << sp.to_string() << std::endl;
+ mrg::test::perf p(tp, sp);
+ p.run();
+
+ return 0;
+}
Added: store/trunk/cpp/perf/perf.hpp
===================================================================
--- store/trunk/cpp/perf/perf.hpp (rev 0)
+++ store/trunk/cpp/perf/perf.hpp 2010-11-01 19:23:53 UTC (rev 4408)
@@ -0,0 +1,65 @@
+/**
+ * \file perf.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains performance test code for the journal.
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#ifndef mrg_test_perf_hpp
+#define mrg_test_perf_hpp
+
+#include <vector>
+
+#include "perf_test.hpp"
+#include "store_params.hpp"
+#include "test_params.hpp"
+
+namespace mrg
+{
+namespace test
+{
+
+ class perf
+ {
+ const test_params& _test_params;
+ const store_params& _store_params;
+ const char* _msg_data;
+ std::vector<perf_test*> _tests;
+ void prepare_journals();
+ public:
+ perf(const test_params& tp, const store_params& sp);
+ ~perf();
+ void run();
+ };
+
+} // namespace test
+} // namespace mrg
+
+void print_args();
+bool read_args(int argc, char** argv, mrg::test::test_params& tp, mrg::test::store_params& sp);
+
+#endif // mrg_test_perf_hpp
Added: store/trunk/cpp/perf/perf_test.cpp
===================================================================
--- store/trunk/cpp/perf/perf_test.cpp (rev 0)
+++ store/trunk/cpp/perf/perf_test.cpp 2010-11-01 19:23:53 UTC (rev 4408)
@@ -0,0 +1,198 @@
+/**
+ * \file perf_test.cpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains performance test code for the journal.
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#include "perf_test.hpp"
+
+#include <iostream>
+
+#include "jrnl/jexception.hpp"
+#include "jrnl/slock.hpp"
+
+namespace mrg
+{
+namespace test
+{
+
+perf_test::perf_test(const uint32_t num_msgs,
+ const uint32_t msg_size,
+ const char* msg_data,
+ mrg::journal::jcntl* const jp) :
+ _num_msgs(num_msgs),
+ _msg_size(msg_size),
+ _msg_data(msg_data),
+ _jp(jp)
+{}
+
+perf_test::~perf_test()
+{
+ delete _jp;
+}
+
+//*** MUST BE THREAD-SAFE ****
+// This method will be called by multiple threads simultaneously
+void
+perf_test::operator()()
+{
+ // enqueue msgs
+ uint32_t msgs_enq = 0;
+ while (msgs_enq < _num_msgs)
+ {
+ 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);
+ switch (res)
+ {
+ case mrg::journal::RHM_IORES_SUCCESS:
+ msgs_enq++;
+//std::cout << "ENQ: " << dtokp->status_str() << std::endl;
+ break;
+ case mrg::journal::RHM_IORES_ENQCAPTHRESH:
+ std::cout << "operator() RHM_IORES_ENQCAPTHRESH: " << dtokp->status_str() << std::endl;
+ delete dtokp;
+ ::usleep(10);
+ break;
+ default:
+ delete dtokp;
+ std::cerr << "enqueue_data_record FAILED with " << mrg::journal::iores_str(res) << std::endl;
+ }
+
+ while (_ucl.size())
+ {
+ {
+ std::unique_lock<std::mutex> l;
+ mrg::journal::data_tok* dtokp = _ucl.front();
+ _ucl.pop_front();
+ }
+ bool done = false;
+ while (!done)
+ {
+//std::cout << " #";
+ mrg::journal::iores res = _jp->dequeue_data_record(dtokp);
+ switch (res)
+ {
+ case mrg::journal::RHM_IORES_SUCCESS:
+//std::cout << " -> OK" << std::endl;
+ done = true;
+ break;
+ case mrg::journal::RHM_IORES_BUSY:
+//std::cout << " -> BUSY" << std::endl;
+ //_ucl.push_back(dtokp);
+ ::usleep(10);
+ break;
+ default:
+ std::cerr << "dequeue_data_record FAILED with " << mrg::journal::iores_str(res) << ": " << dtokp->status_str() << std::endl;
+ delete dtokp;
+ done = true;
+ }
+ }
+
+ }
+ };
+
+ // flush
+ _jp->flush(false);
+
+ // wait for all records to be written and dequeued
+ ::timespec timeout;
+ timeout.tv_sec = 2;
+ timeout.tv_nsec = 0;
+ while (_jp->get_wr_aio_evt_rem())
+ {
+ _jp->get_wr_events(&timeout);
+ if (_jp->get_wr_aio_evt_rem()) ::usleep(10);
+ }
+
+ // final flush
+ _jp->flush(true);
+}
+
+//*** MUST BE THREAD-SAFE ****
+// This method will be called by multiple threads simultaneously
+void
+perf_test::wr_aio_cb(std::vector<mrg::journal::data_tok*>& dtokl)
+{
+ mrg::journal::data_tok* dtokp;
+ int n = 0;
+//std::cout << "=======------> wr_aio_cb(): " << &dtokl << " dtokl.size()=" << dtokl.size() << std::endl;
+ for (std::vector<mrg::journal::data_tok*>::const_iterator i=dtokl.begin(); i!=dtokl.end(); i++,n++)
+ {
+ dtokp = *i;
+//std::cout << "DEQ " << n << ": " << dtokp << ": ";
+ switch (dtokp->wstate())
+ {
+ case mrg::journal::data_tok::ENQ:
+ {
+ dtokp->set_dequeue_rid(dtokp->rid());
+//std::cout << dtokp->status_str() << std::endl;
+ bool done = false;
+ while (!done)
+ {
+//std::cout << " *";
+ mrg::journal::iores res = _jp->dequeue_data_record(dtokp);
+ switch (res)
+ {
+ case mrg::journal::RHM_IORES_SUCCESS:
+//std::cout << " -> OK" << std::endl;
+ done = true;
+ break;
+ case mrg::journal::RHM_IORES_BUSY:
+//std::cout << " -> BUSY" << std::endl;
+ {
+ std::unique_lock<std::mutex> l;
+ _ucl.push_back(dtokp);
+ }
+ done = true;
+ //::usleep(10);
+ break;
+ default:
+ std::cerr << "dequeue_data_record FAILED with " << mrg::journal::iores_str(res) << ": " << dtokp->status_str() << std::endl;
+ delete dtokp;
+ done = true;
+ }
+ }
+ }
+ break;
+ case mrg::journal::data_tok::DEQ:
+//std::cout << "XXX: " << dtokp->status_str() << std::endl;
+ delete dtokp;
+ break;
+ default: ;
+ }
+ }
+}
+
+//*** MUST BE THREAD-SAFE ****
+// This method will be called by multiple threads simultaneously
+void
+perf_test::rd_aio_cb(std::vector<u_int16_t>& pil)
+{}
+
+} // namespace test
+} // namespace mrg
Added: store/trunk/cpp/perf/perf_test.hpp
===================================================================
--- store/trunk/cpp/perf/perf_test.hpp (rev 0)
+++ store/trunk/cpp/perf/perf_test.hpp 2010-11-01 19:23:53 UTC (rev 4408)
@@ -0,0 +1,68 @@
+/**
+ * \file perf_test.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains performance test code for the journal.
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#ifndef mrg_test_perf_test_hpp
+#define mrg_test_perf_test_hpp
+
+#include <cstdint>
+#include <deque>
+#include <mutex>
+
+#include "jrnl/aio_callback.hpp"
+#include "jrnl/data_tok.hpp"
+#include "jrnl/jcntl.hpp"
+#include "jrnl/smutex.hpp"
+
+namespace mrg
+{
+namespace test
+{
+
+ class perf_test: public mrg::journal::aio_callback
+ {
+ const uint32_t _num_msgs;
+ const uint32_t _msg_size;
+ const char* _msg_data;
+ mrg::journal::jcntl* const _jp;
+ std::deque<mrg::journal::data_tok*> _ucl;
+ std::mutex _ucl_mutex;
+ public:
+ perf_test(const uint32_t num_msgs, const uint32_t msg_size, const char* msg_data, mrg::journal::jcntl* const jp);
+ ~perf_test();
+ void operator()();
+ virtual void wr_aio_cb(std::vector<mrg::journal::data_tok*>& dtokl);
+ virtual void rd_aio_cb(std::vector<u_int16_t>& pil);
+ };
+
+} // namespace test
+} // namespace mrg
+
+#endif // mrg_test_perf_test_hpp
Added: store/trunk/cpp/perf/perf_timer.cpp
===================================================================
--- store/trunk/cpp/perf/perf_timer.cpp (rev 0)
+++ store/trunk/cpp/perf/perf_timer.cpp 2010-11-01 19:23:53 UTC (rev 4408)
@@ -0,0 +1,69 @@
+/**
+ * \file timer.cpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains performance test code for the journal.
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#include "perf_timer.hpp"
+#include <iostream>
+
+namespace mrg
+{
+namespace test
+{
+ perf_timer::perf_timer(const uint32_t num_msgs, const uint32_t msg_size, const uint16_t num_queues, const uint16_t num_threads_per_queue) :
+ _num_msgs(num_msgs), _msg_size(msg_size), _num_queues(num_queues), _num_threads_per_queue(num_threads_per_queue)
+ {
+ ::timespec ts;
+ ::clock_gettime(CLOCK_REALTIME, &ts);
+ _start_time = get_double_time(ts);
+ }
+
+ perf_timer::~perf_timer()
+ {
+ ::timespec ts;
+ ::clock_gettime(CLOCK_REALTIME, &ts);
+ double time_taken = get_double_time(ts) - _start_time;
+ std::cout << " Msgs per thread: " << _num_msgs << std::endl;
+ std::cout << " Msg size: " << _msg_size << std::endl;
+ std::cout << " No. queues: " << _num_queues << std::endl;
+ std::cout << "No. threads/queue: " << _num_threads_per_queue << std::endl;
+ std::cout << " Time taken: " << time_taken << " sec" << std::endl;
+ std::cout << " Msg throughput: " << (_num_msgs * _num_queues * _num_threads_per_queue / time_taken / 1e3) << " kMsgs/sec" << std::endl;
+ std::cout << " " << (_num_msgs * _num_queues * _num_threads_per_queue * _msg_size / time_taken / 1e6) << " MB/sec" << std::endl;
+ }
+
+ // static
+ double perf_timer::get_double_time(const ::timespec& ts)
+ {
+ return ts.tv_sec + (double(ts.tv_nsec) / 1e9);
+ }
+
+
+} // namespace test
+} // namespace mrg
Added: store/trunk/cpp/perf/perf_timer.hpp
===================================================================
--- store/trunk/cpp/perf/perf_timer.hpp (rev 0)
+++ store/trunk/cpp/perf/perf_timer.hpp 2010-11-01 19:23:53 UTC (rev 4408)
@@ -0,0 +1,59 @@
+/**
+ * \file timer.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains performance test code for the journal.
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#ifndef mrg_test_timer_hpp
+#define mrg_test_timer_hpp
+
+#include <cstdint>
+#include <ctime>
+
+namespace mrg
+{
+namespace test
+{
+
+ class perf_timer
+ {
+ uint32_t _num_msgs;
+ uint32_t _msg_size;
+ uint16_t _num_queues;
+ uint16_t _num_threads_per_queue;
+ double _start_time;
+ static double get_double_time(const timespec& tx);
+ public:
+ perf_timer(const uint32_t num_msgs, const uint32_t msg_size, const uint16_t num_queues, const uint16_t num_threads_per_queue);
+ ~perf_timer();
+ };
+
+} // namespace test
+} // namespace mrg
+
+#endif // mrg_test_timer_hpp
Added: store/trunk/cpp/perf/store_params.cpp
===================================================================
--- store/trunk/cpp/perf/store_params.cpp (rev 0)
+++ store/trunk/cpp/perf/store_params.cpp 2010-11-01 19:23:53 UTC (rev 4408)
@@ -0,0 +1,93 @@
+/**
+ * \file store_params.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains performance test code for the journal.
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#include "store_params.hpp"
+
+#include <sstream>
+
+namespace mrg
+{
+namespace test
+{
+
+// static
+std::string store_params::_def_jrnl_dir("/tmp/store");
+
+// static
+std::string store_params::_def_jrnl_base_filename("JournalData");
+
+store_params::store_params() :
+ _jrnl_dir(_def_jrnl_dir),
+ _jrnl_base_filename(_def_jrnl_base_filename),
+ _num_jfiles(8),
+ _jfsize_sblks(3072),
+ _auto_expand(false),
+ _ae_max_jfiles(0),
+ _wcache_num_pages(32),
+ _wcache_pgsize_sblks(128)
+{}
+
+store_params::store_params(std::string& jrnl_dir,
+ std::string& jrnl_base_filename,
+ const u_int16_t num_jfiles,
+ const bool auto_expand,
+ const u_int16_t ae_max_jfiles,
+ const u_int32_t jfsize_sblks,
+ const u_int16_t wcache_num_pages,
+ const u_int32_t wcache_pgsize_sblks) :
+ _jrnl_dir(jrnl_dir),
+ _jrnl_base_filename(jrnl_base_filename),
+ _num_jfiles(num_jfiles),
+ _auto_expand(auto_expand),
+ _ae_max_jfiles(ae_max_jfiles),
+ _jfsize_sblks(jfsize_sblks),
+ _wcache_num_pages(wcache_num_pages),
+ _wcache_pgsize_sblks(wcache_pgsize_sblks)
+{}
+
+std::string
+store_params::to_string()
+{
+ std::ostringstream oss;
+ oss << "Store Parameters:" << std::endl;
+ oss << " jrnl_dir = " << _jrnl_dir << std::endl;
+ oss << " jrnl_base_filename = " << _jrnl_base_filename << std::endl;
+ oss << " num_jfiles = " << _num_jfiles << std::endl;
+ oss << " jfsize_sblks = " << _jfsize_sblks << std::endl;
+ oss << " auto_expand = " << _auto_expand << std::endl;
+ oss << " ae_max_jfiles = " << _ae_max_jfiles << std::endl;
+ oss << " wcache_num_pages = " << _wcache_num_pages << std::endl;
+ oss << " wcache_pgsize_sblks = " << _wcache_pgsize_sblks << std::endl;
+ return oss.str();
+}
+
+} // namespace test
+} // namespace mrg
Added: store/trunk/cpp/perf/store_params.hpp
===================================================================
--- store/trunk/cpp/perf/store_params.hpp (rev 0)
+++ store/trunk/cpp/perf/store_params.hpp 2010-11-01 19:23:53 UTC (rev 4408)
@@ -0,0 +1,65 @@
+/**
+ * \file store_params.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains performance test code for the journal.
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#ifndef mrg_test_store_params_hpp
+#define mrg_test_store_params_hpp
+
+#include <cstdint>
+#include <string>
+
+namespace mrg
+{
+namespace test
+{
+
+ struct store_params
+ {
+ static std::string _def_jrnl_dir;
+ static std::string _def_jrnl_base_filename;
+ std::string& _jrnl_dir;
+ std::string& _jrnl_base_filename;
+ u_int16_t _num_jfiles;
+ u_int32_t _jfsize_sblks;
+ bool _auto_expand;
+ u_int16_t _ae_max_jfiles;
+ u_int16_t _wcache_num_pages;
+ u_int32_t _wcache_pgsize_sblks;
+ store_params();
+ store_params(std::string& jrnl_dir, std::string& jrnl_base_filename, const u_int16_t num_jfiles,
+ const bool auto_expand, const u_int16_t ae_max_jfiles, const u_int32_t jfsize_sblks,
+ const u_int16_t wcache_num_pages, const u_int32_t wcache_pgsize_sblks);
+ std::string to_string();
+ };
+
+} // namespace test
+} // namespace mrg
+
+#endif // mrg_test_store_params_hpp
Added: store/trunk/cpp/perf/test_params.cpp
===================================================================
--- store/trunk/cpp/perf/test_params.cpp (rev 0)
+++ store/trunk/cpp/perf/test_params.cpp 2010-11-01 19:23:53 UTC (rev 4408)
@@ -0,0 +1,69 @@
+/**
+ * \file test_params.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains performance test code for the journal.
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#include "test_params.hpp"
+
+#include <sstream>
+
+namespace mrg
+{
+namespace test
+{
+
+test_params::test_params():
+ _num_msgs(100),
+ _msg_size(10),
+ _num_queues(1),
+ _num_threads_per_queue(1)
+{}
+
+test_params::test_params(const uint32_t num_msgs, const uint32_t msg_size, const uint16_t num_queues,
+ const uint16_t num_threads_per_queue) :
+ _num_msgs(num_msgs),
+ _msg_size(msg_size),
+ _num_queues(num_queues),
+ _num_threads_per_queue(num_threads_per_queue)
+{}
+
+std::string
+test_params::to_string()
+{
+ std::ostringstream oss;
+ oss << "Test Parameters:" << std::endl;
+ oss << " num_msgs = " << _num_msgs << std::endl;
+ oss << " msg_size = " << _msg_size << std::endl;
+ oss << " num_queues = " << _num_queues << std::endl;
+ oss << " num_threads_per_queue = " << _num_threads_per_queue << std::endl;
+ return oss.str();
+}
+
+} // namespace test
+} // namespace mrg
Added: store/trunk/cpp/perf/test_params.hpp
===================================================================
--- store/trunk/cpp/perf/test_params.hpp (rev 0)
+++ store/trunk/cpp/perf/test_params.hpp 2010-11-01 19:23:53 UTC (rev 4408)
@@ -0,0 +1,58 @@
+/**
+ * \file test_params.hpp
+ *
+ * Qpid asynchronous store plugin library
+ *
+ * This file contains performance test code for the journal.
+ *
+ * \author Kim van der Riet
+ *
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This file is part of the Qpid async store library msgstore.so.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ *
+ * The GNU Lesser General Public License is available in the file COPYING.
+ */
+
+#ifndef mrg_test_test_params_hpp
+#define mrg_test_test_params_hpp
+
+#include <cstdint>
+#include <string>
+
+namespace mrg
+{
+namespace test
+{
+
+ struct test_params
+ {
+ uint32_t _num_msgs;
+ uint32_t _msg_size;
+ uint16_t _num_queues;
+ uint16_t _num_threads_per_queue;
+ test_params();
+ test_params(const uint32_t num_msgs, const uint32_t msg_size, const uint16_t num_queues,
+ const uint16_t num_threads_per_queue);
+ std::string to_string();
+ };
+
+} // namespace test
+} // namespace mrg
+
+#endif // mrg_test_test_params_hpp
14 years, 2 months