Author: stefan2
Date: Mon Apr 16 16:56:49 2012
New Revision: 1326683
URL: http://svn.apache.org/viewvc?rev=1326683&view=rev
Log:
Make test execution time more predictable / consistent.
On machines with more than 4 HW threads, use about #HwThreads/2
threads / processes. On smaller machines, reduce the number of
iterations.
If no efficient synchronization is available, run the concurrency
tests for a very small and fixed number of iterations and on 2
cores only.
* subversion/tests/libsvn_subr/named_atomic-test.c
(calibrate_concurrency): see above.
(calibrate_iterations): skip runs with small numbers of iterations
Modified:
subversion/trunk/subversion/tests/libsvn_subr/named_atomic-test.c
Modified: subversion/trunk/subversion/tests/libsvn_subr/named_atomic-test.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/named_atomic-test.c?rev=1326683&r1=1326682&r2=1326683&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/named_atomic-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/named_atomic-test.c Mon Apr
16 16:56:49 2012
@@ -276,7 +276,7 @@ calibrate_iterations(apr_pool_t *pool, i
/* increase iterations until we pass the 10ms mark */
- for (calib_iterations = 10; taken < 100000.0; calib_iterations *= 2)
+ for (calib_iterations = 1000; taken < 100000.0; calib_iterations *= 2)
{
SVN_ERR(init_concurrency_test_shm(pool, count));
@@ -305,15 +305,32 @@ calibrate_concurrency(apr_pool_t *pool)
{
if (hw_thread_count == 0)
{
- SVN_ERR(calibrate_iterations(pool, 2));
- for (hw_thread_count = 2; hw_thread_count < 32; hw_thread_count *= 2)
+ /* these parameters should be ok even on very slow machines */
+ hw_thread_count = 2;
+ suggested_iterations = 200;
+
+ /* if we've got a proper machine and OS setup, let's prepare for
+ * some real testing */
+ if (svn_named_atomic__is_efficient())
{
- int saved_suggestion = suggested_iterations;
- SVN_ERR(calibrate_iterations(pool, hw_thread_count * 2));
- if (suggested_iterations < 100000)
+ SVN_ERR(calibrate_iterations(pool, 2));
+ for (; hw_thread_count < 32; hw_thread_count *= 2)
{
- suggested_iterations = saved_suggestion;
- break;
+ int saved_suggestion = suggested_iterations;
+
+ /* run with an additional core to spare
+ * (even low CPU usage might cause heavy context switching) */
+ SVN_ERR(calibrate_iterations(pool, hw_thread_count * 2 + 1));
+ if (suggested_iterations < 100000)
+ {
+ /* Machines with only a small number of cores are prone
+ * to inconsistent performance due context switching.
+ * Reduce the number of iterations on those machines. */
+ suggested_iterations = hw_thread_count > 2
+ ? saved_suggestion
+ : saved_suggestion / 2;
+ break;
+ }
}
}