$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r54200 - sandbox/monotonic/libs/monotonic/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-22 06:51:54
Author: cschladetsch
Date: 2009-06-22 06:51:52 EDT (Mon, 22 Jun 2009)
New Revision: 54200
URL: http://svn.boost.org/trac/boost/changeset/54200
Log:
reformatting
Properties modified: 
   sandbox/monotonic/libs/monotonic/test/   (props changed)
Text files modified: 
   sandbox/monotonic/libs/monotonic/test/AllocatorTypes.h        |     7 +-                                      
   sandbox/monotonic/libs/monotonic/test/PoolResult.h            |     7 +-                                      
   sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp |    97 ++++++--------------------------------- 
   sandbox/monotonic/libs/monotonic/test/monotonic.vcproj        |     4 +                                       
   4 files changed, 28 insertions(+), 87 deletions(-)
Modified: sandbox/monotonic/libs/monotonic/test/AllocatorTypes.h
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/AllocatorTypes.h	(original)
+++ sandbox/monotonic/libs/monotonic/test/AllocatorTypes.h	2009-06-22 06:51:52 EDT (Mon, 22 Jun 2009)
@@ -3,9 +3,8 @@
 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-// the documentation is at https://svn.boost.org/svn/boost/sandbox/monotonic/libs/monotonic/doc/index.html
-
-// the sandbox is at https://svn.boost.org/svn/boost/sandbox/monotonic/
+// documentation at https://svn.boost.org/svn/boost/sandbox/monotonic/libs/monotonic/doc/index.html
+// sandbox at https://svn.boost.org/svn/boost/sandbox/monotonic/
 
 #pragma once
 
@@ -15,6 +14,8 @@
 #undef max
 #undef min
 #include <boost/monotonic/allocator.hpp>
+#include <boost/monotonic/local.hpp>
+
 #include <tbb/tbb_allocator.h>
 
 struct Type
Modified: sandbox/monotonic/libs/monotonic/test/PoolResult.h
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/PoolResult.h	(original)
+++ sandbox/monotonic/libs/monotonic/test/PoolResult.h	2009-06-22 06:51:52 EDT (Mon, 22 Jun 2009)
@@ -3,12 +3,13 @@
 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-// the documentation is at https://svn.boost.org/svn/boost/sandbox/monotonic/libs/monotonic/doc/index.html
-
-// the sandbox is at https://svn.boost.org/svn/boost/sandbox/monotonic/
+// documentation at https://svn.boost.org/svn/boost/sandbox/monotonic/libs/monotonic/doc/index.html
+// sandbox at https://svn.boost.org/svn/boost/sandbox/monotonic/
 
 #pragma once
 
+#include <boost/timer.hpp>
+
 struct PoolResult 
 {
         //boost::array<double, Type:: elapsed[;
Modified: sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp	(original)
+++ sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp	2009-06-22 06:51:52 EDT (Mon, 22 Jun 2009)
@@ -3,9 +3,8 @@
 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
-// the documentation is at https://svn.boost.org/svn/boost/sandbox/monotonic/libs/monotonic/doc/index.html
-
-// the sandbox is at https://svn.boost.org/svn/boost/sandbox/monotonic/
+// documentation at https://svn.boost.org/svn/boost/sandbox/monotonic/libs/monotonic/doc/index.html
+// sandbox at https://svn.boost.org/svn/boost/sandbox/monotonic/
 
 #include <iostream> 
 #include <iomanip> 
@@ -20,11 +19,6 @@
 #include <bitset>
 #include <string>
 
-#include <boost/timer.hpp>
-#include <boost/monotonic/local.hpp>
-
-//#include <boost/monotonic/local_allocator.hpp>
-
 #include "./AllocatorTypes.h"
 #include "./PoolResult.h"
 
@@ -131,26 +125,6 @@
         }
 };
 
-struct test_map_list
-{
-	template <class Alloc>
-	int test(Alloc alloc, size_t length) const
-	{
-		std::map<int
-			, std::list<Unaligned, typename Rebind<Alloc, Unaligned>::type>
-			, std::less<int>
-			, typename Rebind<Alloc, int>::type
-		> map;
-		size_t mod = length/10;
-		for (size_t n = 0; n < length; ++n)
-		{
-			int random = rand() % mod;
-			map[random].push_back(n);
-		}
-		return 0;
-	}
-};
-
 struct test_set_vector
 {
         template <class Alloc>
@@ -200,54 +174,21 @@
         }
 };
 
-
-template <class Al>
-void *allocate_bytes(boost::pool<Al> &pool, size_t len)
+struct test_map_list_unaligned
 {
-	return pool.malloc(len);
-}
-
-template <size_t N, size_t M, class Al>
-void *allocate_bytes(boost::monotonic::storage<N,M,Al> &storage, size_t len)
-{
-	return storage.allocate(len, 1);
-}
-
-
-template <class Ty, class Al>
-Ty *allocate_object(boost::pool<Al> &pool)
-{
-	return pool.malloc(1);
-}
-
-template <class Ty>
-Ty *allocate_object(boost::monotonic::allocator<Ty> &alloc)
-{
-	return alloc.allocate(1);
-}
-
-struct test_pool_bytes_alloc
-{
-	template <class Storage>
-	int test(Storage &storage, size_t length)
-	{
-		for (size_t n = 0; n < length; ++n)
-		{
-			::allocate_bytes(storage, length*rand()/RAND_MAX);
-		}
-		return 0;
-	}
-};
-
-template <class Ty>
-struct test_pool_object_alloc
-{
-	template <class Storage>
-	int test(Storage &storage, size_t length)
+	template <class Alloc>
+	int test(Alloc alloc, size_t length) const
         {
+		std::map<int
+			, std::list<Unaligned, typename Rebind<Alloc, Unaligned>::type>
+			, std::less<int>
+			, typename Rebind<Alloc, int>::type
+		> map;
+		size_t mod = length/10;
                 for (size_t n = 0; n < length; ++n)
                 {
-			::allocate_object(storage);
+			int random = rand() % mod;
+			map[random].push_back(n);
                 }
                 return 0;
         }
@@ -256,7 +197,6 @@
 template <class Fun>
 PoolResult run_test(size_t count, size_t length, Fun fun, Type types)
 {
-	// boost::pool<void> fails trying to form reference to void
         typedef Allocator<Type::FastPool, int> fast_pool_alloc;
         typedef Allocator<Type::Pool, int> pool_alloc;
         typedef Allocator<Type::Monotonic, int> mono_alloc;
@@ -366,7 +306,7 @@
         {
                 results[length] = run_test(count, length, fun, types);
         }
-	cout << endl << "completed in " << timer.elapsed() << "s" << endl;
+	cout << endl << "took " << timer.elapsed() << "s" << endl;
         return results;
 }
 
@@ -417,15 +357,11 @@
 {
         pair<PoolResult, PoolResult> dev_mean = standard_deviation_mean(results);
         size_t w = 10;
-
         cout << setw(w) << "scheme" << setw(w) << "mean" << setw(w) << "std-dev" << setw(w) << "min" << setw(w) << "max" << endl;
-	//cout << setw(0) << "------------------------------------------------------" << endl;
-
         cout << setw(w) << "fast" << setprecision(3) << setw(w) << dev_mean.second.fast_pool_elapsed << setw(w) << dev_mean.first.fast_pool_elapsed << setw(w) << result_min.fast_pool_elapsed << setw(w) << result_max.fast_pool_elapsed << endl;
         cout << setw(w) << "pool" << setprecision(3) << setw(w) << dev_mean.second.pool_elapsed << setw(w) << dev_mean.first.pool_elapsed << setw(w) << result_min.pool_elapsed << setw(w) << result_max.pool_elapsed << endl;
         cout << setw(w) << "std" << setprecision(3) << setw(w) << dev_mean.second.std_elapsed << setw(w) << dev_mean.first.std_elapsed << setw(w) << result_min.std_elapsed << setw(w) << result_max.std_elapsed << endl;
         cout << setw(w) << "tbb" << setprecision(3) << setw(w) << dev_mean.second.tbb_elapsed << setw(w) << dev_mean.first.tbb_elapsed << setw(w) << result_min.tbb_elapsed << setw(w) << result_max.tbb_elapsed << endl;
-
         cout << endl;
 }
 
@@ -541,7 +477,7 @@
                         // destroy objects. this only calls the destructors; it does not release memory
                         storage.destroy(s1);
 
-			cout << "storage.fixed, heap, total used: " << storage.fixed_used() << ", " << storage.heap_used() << ", " << storage.used() << endl;
+			//cout << "storage.fixed, heap, total used: " << storage.fixed_used() << ", " << storage.heap_used() << ", " << storage.used() << endl;
                 }
                 // storage is released. if this was only ever on the stack, no work is done
         }
@@ -651,7 +587,7 @@
         heading("FINAL SUMMARY", '*');
         print_cumulative(cumulative);
 
-	cout << endl << "tests completed in " << setprecision(5) << timer.elapsed() << "s" << endl;
+	cout << endl << "took " << setprecision(3) << timer.elapsed()/60. << " minutes" << endl;
 
         return 0;
 }
@@ -665,5 +601,4 @@
         }
 }
 
-
 //EOF
Modified: sandbox/monotonic/libs/monotonic/test/monotonic.vcproj
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/monotonic.vcproj	(original)
+++ sandbox/monotonic/libs/monotonic/test/monotonic.vcproj	2009-06-22 06:51:52 EDT (Mon, 22 Jun 2009)
@@ -447,6 +447,10 @@
                         RelativePath=".\PoolResult.h"
 			>
                 </File>
+		<File
+			RelativePath=".\TestPoolAlloc.h"
+			>
+		</File>
         </Files>
         <Globals>
         </Globals>