From 383aa59c88ea4c08ca66205f976a2b28c56c5255 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Wed, 18 Jan 2012 00:31:08 -0500 Subject: [PATCH] added a check for code that was being tested, just to get it included. --- core/library/tests_basis/test_mutex.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/library/tests_basis/test_mutex.cpp b/core/library/tests_basis/test_mutex.cpp index 47da9475..743e0004 100644 --- a/core/library/tests_basis/test_mutex.cpp +++ b/core/library/tests_basis/test_mutex.cpp @@ -225,13 +225,13 @@ int test_mutex::execute() ted.unlock(); } time_stamp mutt_out; -#ifdef DEBUG_MUTEX - log(a_sprintf("%d mutex lock & unlock pairs took %f seconds,", - MAX_MUTEX_TIMING_TEST, - (mutt_out.value() - mutt_in.value()) / SECOND_ms)); - log(a_sprintf("or %f ms per (lock+unlock).", - (mutt_out.value() - mutt_in.value()) / MAX_MUTEX_TIMING_TEST)); -#endif + double run_count = MAX_MUTEX_TIMING_TEST; + double full_run_time = (mutt_out.value() - mutt_in.value()) / SECOND_ms; + double time_per_lock = (mutt_out.value() - mutt_in.value()) / run_count; + log(a_sprintf("%.0f mutex lock & unlock pairs took %.3f seconds,", + run_count, full_run_time)); + log(a_sprintf("or %f ms per (lock+unlock).", time_per_lock)); + ASSERT_TRUE(time_per_lock < 1.0, "mutex lock timing should be super fast"); } // make sure the guard is initialized before the threads run. -- 2.34.1