Author: kpvdr
Date: 2007-09-28 12:04:41 -0400 (Fri, 28 Sep 2007)
New Revision: 951
Modified:
store/trunk/cpp/tests/jrnl/Makefile.rtest
store/trunk/cpp/tests/jrnl/jtest.cpp
Log:
Modifications to support performance tests in jtest.cpp
Modified: store/trunk/cpp/tests/jrnl/Makefile.rtest
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.rtest 2007-09-28 16:02:33 UTC (rev 950)
+++ store/trunk/cpp/tests/jrnl/Makefile.rtest 2007-09-28 16:04:41 UTC (rev 951)
@@ -36,11 +36,12 @@
# read. Use together with RHM_JOWRITE if test reads from previously
written
# journal. Ensure journal contains valid entries in all files. NOTE: ONLY
USE
# FOR PERFORMANCE TESTS!
+# RHM_TIMERS: Enable and show times for initialize and run of a test.
# Prefix each define with -D. (eg RHM_DEFINES = -DRHM_JOWRITE -DRHM_WRONLY)
SHELL = /bin/bash
-QPID_HOME_DIR = $(HOME)/qpid
+QPID_HOME_DIR = $(HOME)/rhm/qpid
RHM_JRNL_SRC_DIR = ../../lib/jrnl
RHM_JRNL_DOC_DIR = ../../docs
@@ -93,6 +94,7 @@
@echo " jrtest: Make the journal test suite for read tests"
@echo " jwtest: Make the journal test suite for write tests"
@echo " jrwtest: Make the journal test suite for simultaneous write/read
tests"
+ @echo " jwperf:" Make the jorunal test suite for performance write
tests"
@echo " --- Testing options ---"
@echo " check: Run complete regression test suite; compiles with special
flags"
@echo " --- Documentation options ---"
@@ -116,6 +118,9 @@
jrwtest: RHM_DEFINES = -DRHM_CLEAN -DRHM_TESTVALS
jrwtest: $(JTEST_FILES)
+jwperf: RHM_DEFINES = -DRHM_WRONLY -DRHM_TIMERS
+jwperf: $(JTEST_FILES)
+
check:
@./rtest
Modified: store/trunk/cpp/tests/jrnl/jtest.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtest.cpp 2007-09-28 16:02:33 UTC (rev 950)
+++ store/trunk/cpp/tests/jrnl/jtest.cpp 2007-09-28 16:04:41 UTC (rev 951)
@@ -53,6 +53,9 @@
cout << "jtest: starting test " << tnum << endl;
jtest t;
t.initialize(tnum, test_csv_file);
+#ifdef RHM_TIMERS
+ usleep(1000000); // Sleep for 1 sec so disks can rest after initialize
+#endif
t.run();
t.report();
t.finalize();
@@ -118,7 +121,9 @@
void
jtest::initialize(const targs& ta) throw (rhm::journal::jexception)
{
-// gettimeofday(_start_time, _tz_ptr);
+#ifdef RHM_TIMERS
+ gettimeofday(_start_time, _tz_ptr);
+#endif
p_args = new msg_producer::_p_args(_jc, ta._num_msgs, ta._min_msg_size,
ta._max_msg_size,
ta._auto_deq);
@@ -142,15 +147,19 @@
_dtok_master_list.push_back(dtp);
}
-// gettimeofday(_end_time, _tz_ptr);
-// string str;
-// cout << "initialize(): " << report_time(str) << endl;
+#ifdef RHM_TIMERS
+ gettimeofday(_end_time, _tz_ptr);
+ string str;
+ cout << "initialize(): " << report_time(str) << endl;
+#endif
}
void
jtest::run() throw (rhm::journal::jexception)
{
+#ifdef RHM_TIMERS
gettimeofday(_start_time, _tz_ptr);
+#endif
// === Do something spectacular here... ===
@@ -191,9 +200,11 @@
// === End: Do something spectacular here... ===
+#ifdef RHM_TIMERS
gettimeofday(_end_time, _tz_ptr);
string str;
-// cout << "run(): " << report_time(str) << endl;
+ cout << "run(): " << report_time(str) << endl;
+#endif
}
void
@@ -405,7 +416,10 @@
#ifdef RHM_RDONLY
cout << "*** WARNING: Compiled with RHM_RDONLY defined." <<
endl;
#endif
-#if defined(RHM_CLEAN) || defined(RHM_TESTVALS) || defined(RHM_JOWRITE) ||
defined(RHM_WRONLY) || defined(RHM_RDONLY)
+#ifdef RHM_TIMERS
+ cout << "*** WARNING: Compiled with RHM_TIMERS defined." <<
endl;
+#endif
+#if defined(RHM_CLEAN) || defined(RHM_TESTVALS) || defined(RHM_JOWRITE) ||
defined(RHM_WRONLY) || defined(RHM_RDONLY) || defined(RHM_TIMERS)
cout << endl;
#endif
Show replies by date