From 7b53c0040c0b73cc6cd4dd4b14f9d2c1fd77c222 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 18 Feb 2002 12:39:32 +0000 Subject: [PATCH] More output. [SVN r12852] --- shared_ptr_mt_test.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/shared_ptr_mt_test.cpp b/shared_ptr_mt_test.cpp index 2511716..831be86 100644 --- a/shared_ptr_mt_test.cpp +++ b/shared_ptr_mt_test.cpp @@ -27,6 +27,7 @@ #include #include +#include // 'portable' thread framework @@ -40,7 +41,7 @@ public: #if !defined(BOOST_HAS_PTHREADS) && defined(BOOST_HAS_WINTHREADS) -char const * title = "Using Windows threads."; +char const * title = "Using Windows threads"; #include #include @@ -79,7 +80,7 @@ int pthread_join(pthread_t thread, void ** /*value_ptr*/) #else -char const * title = "Using POSIX threads."; +char const * title = "Using POSIX threads"; #include @@ -146,10 +147,12 @@ int const m = 16; // threads int test_main( int, char ** ) { - std::puts(title); + std::printf("%s: %d threads, %d iterations, ", title, m, n); boost::shared_ptr pi(new int(42)); + std::clock_t t = std::clock(); + pthread_t a[m]; for(int i = 0; i < m; ++i) @@ -162,5 +165,9 @@ int test_main( int, char ** ) pthread_join(a[i], 0); } + t = std::clock() - t; + + std::printf("%.4f seconds.\n", static_cast(t) / CLOCKS_PER_SEC); + return 0; }