diff options
author | Benjamin Kosnik <bkoz@redhat.com> | 2005-09-23 23:53:07 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2005-09-23 23:53:07 +0000 |
commit | 8d4addde199b05bb87a408832f70fe4b9b534896 (patch) | |
tree | ba54e6540172390f66813164e039aaafc3e2a9f3 | |
parent | 04f98580d457cb78ce7856b7626f1b0ec078281d (diff) | |
download | gcc-8d4addde199b05bb87a408832f70fe4b9b534896.zip gcc-8d4addde199b05bb87a408832f70fe4b9b534896.tar.gz gcc-8d4addde199b05bb87a408832f70fe4b9b534896.tar.bz2 |
tune-1.cc: Clarify for single-thread.
2005-09-23 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/ext/mt_allocator/tune-1.cc: Clarify for single-thread.
* testsuite/ext/mt_allocator/tune-2.cc: Same.
* testsuite/ext/mt_allocator/tune-3.cc: Same.
* testsuite/ext/mt_allocator/tune-4.cc: Same.
From-SVN: r104591
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc | 34 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc | 26 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc | 31 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc | 36 |
5 files changed, 66 insertions, 68 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 75ac351..60af325 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2005-09-23 Benjamin Kosnik <bkoz@redhat.com> + + * testsuite/ext/mt_allocator/tune-1.cc: Clarify for single-thread. + * testsuite/ext/mt_allocator/tune-2.cc: Same. + * testsuite/ext/mt_allocator/tune-3.cc: Same. + * testsuite/ext/mt_allocator/tune-4.cc: Same. + 2005-09-21 Guillaume Melquiond <guillaume.melquiond@ens-lyon.fr> PR libstdc++/23956 diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc b/libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc index 85b0770..25d6fdf 100644 --- a/libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc +++ b/libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc @@ -23,42 +23,42 @@ #include <testsuite_hooks.h> #include <testsuite_character.h> +#ifdef __GTHREADS +#define __cxxthread true +#else +#define __cxxthread false +#endif + // Tune characteristics. // __common_pool_policy void test01() { bool test __attribute__((unused)) = true; - typedef __gnu_test::pod_int value_type; - using __gnu_cxx::__pool; using __gnu_cxx::__common_pool_policy; -#ifdef __GTHREADS - typedef __common_pool_policy<__pool, true> policy_type; -#else - typedef __common_pool_policy<__pool, false> policy_type; -#endif + typedef __gnu_test::pod_int value_type; + typedef __common_pool_policy<__pool, __cxxthread> policy_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__pool_base::_Tune tune_type; - tune_type t_default; - tune_type t_opt(16, 5120, 32, 5120, 20, 10, false); - tune_type t_single(16, 5120, 32, 5120, 1, 10, false); - allocator_type a; - tune_type t1 = a._M_get_options(); - VERIFY( t1._M_align == t_default._M_align ); + tune_type t_default = a._M_get_options(); + tune_type t_opt(32, 5120, 32, 5120, 20, 10, false); + tune_type t_small(16, 1024, 32, 2048, 1, 10, false); + + tune_type t1 = t_default; a._M_set_options(t_opt); tune_type t2 = a._M_get_options(); VERIFY( t1._M_align != t2._M_align ); allocator_type::pointer p1 = a.allocate(128); allocator_type::pointer p2 = a.allocate(5128); - a._M_set_options(t_single); - t1 = a._M_get_options(); - VERIFY( t1._M_max_threads != t_single._M_max_threads ); - VERIFY( t1._M_max_threads == t_opt._M_max_threads ); + a._M_set_options(t_small); + tune_type t3 = a._M_get_options(); + VERIFY( t3._M_chunk_size != t_small._M_chunk_size ); + VERIFY( t3._M_chunk_size == t_opt._M_chunk_size ); a.deallocate(p1, 128); a.deallocate(p2, 5128); diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc b/libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc index d9be879..e4b324e 100644 --- a/libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc +++ b/libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc @@ -23,6 +23,12 @@ #include <testsuite_hooks.h> #include <testsuite_character.h> +#ifdef __GTHREADS +#define __cxxthread true +#else +#define __cxxthread false +#endif + // Tune characteristics. // __per_type_pool_policy void test02() @@ -34,19 +40,15 @@ void test02() using __gnu_cxx::__pool; using __gnu_cxx::__per_type_pool_policy; -#ifdef __GTHREADS - typedef __per_type_pool_policy<value_type, __pool, true> policy_type; -#else - typedef __per_type_pool_policy<value_type, __pool, false> policy_type; -#endif + typedef __per_type_pool_policy<value_type, __pool, __cxxthread> policy_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__pool_base::_Tune tune_type; - tune_type t_opt(16, 5120, 32, 5120, 20, 10, false); - tune_type t_single(16, 5120, 32, 5120, 1, 10, false); - allocator_type a; tune_type t_default = a._M_get_options(); + tune_type t_opt(32, 5120, 32, 5120, 20, 10, false); + tune_type t_small(16, 1024, 32, 2048, 1, 10, false); + tune_type t1 = t_default; a._M_set_options(t_opt); tune_type t2 = a._M_get_options(); @@ -54,10 +56,10 @@ void test02() allocator_type::pointer p1 = a.allocate(128); allocator_type::pointer p2 = a.allocate(5128); - a._M_set_options(t_single); - t1 = a._M_get_options(); - VERIFY( t1._M_max_threads != t_single._M_max_threads ); - VERIFY( t1._M_max_threads == t_opt._M_max_threads ); + a._M_set_options(t_small); + tune_type t3 = a._M_get_options(); + VERIFY( t3._M_chunk_size != t_small._M_chunk_size ); + VERIFY( t3._M_chunk_size == t_opt._M_chunk_size ); a.deallocate(p1, 128); a.deallocate(p2, 5128); diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc b/libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc index 1f83ee1..1c74912 100644 --- a/libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc +++ b/libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc @@ -1,6 +1,6 @@ // 2004-08-25 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -49,38 +49,33 @@ void test03() typedef _Cp policy_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; - tune_type t_opt(16, 5120, 32, 5120, 20, 10, false); - tune_type t_single(16, 5120, 32, 5120, 1, 10, false); - - // First instances assured. allocator_type a; tune_type t_default = a._M_get_options(); + tune_type t_opt(32, 5120, 32, 5120, 20, 10, false); + tune_type t_small(16, 1024, 32, 2048, 1, 10, false); + + // First instances assured. tune_type t1 = t_default; - tune_type t2; if (test_policy<policy_type>::per_type()) { - VERIFY( t1._M_align == t_default._M_align ); a._M_set_options(t_opt); - t2 = a._M_get_options(); - VERIFY( t1._M_align != t2._M_align ); + t1 = a._M_get_options(); + VERIFY( t1._M_align != t_default._M_align ); } - else - t2 = t1; // Lock tune settings. typename allocator_type::pointer p1 = a.allocate(128); allocator_type a2; - tune_type t3 = a2._M_get_options(); - tune_type t4; - VERIFY( t3._M_max_threads == t2._M_max_threads ); + tune_type t2 = a2._M_get_options(); + VERIFY( t2._M_chunk_size == t1._M_chunk_size ); typename allocator_type::pointer p2 = a2.allocate(5128); - a2._M_set_options(t_single); - t4 = a2._M_get_options(); - VERIFY( t4._M_max_threads != t_single._M_max_threads ); - VERIFY( t4._M_max_threads == t3._M_max_threads ); + a2._M_set_options(t_small); + tune_type t3 = a2._M_get_options(); + VERIFY( t3._M_chunk_size != t_small._M_chunk_size ); + VERIFY( t3._M_chunk_size == t2._M_chunk_size ); a.deallocate(p1, 128); a2.deallocate(p2, 5128); diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc b/libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc index 744429d..cbde199 100644 --- a/libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc +++ b/libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc @@ -1,6 +1,6 @@ // 2004-08-25 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -54,52 +54,46 @@ void test04() typedef __gnu_cxx::__pool_base::_Tune tune_type; typedef _Tp value_type; typedef _Cp policy_type; - typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; - tune_type t_opt(16, 5120, 32, 5120, 20, 10, false); - tune_type t_single(16, 5120, 32, 5120, 1, 10, false); allocator_type a; tune_type t_default = a._M_get_options(); + tune_type t_opt(32, 5120, 32, 5120, 20, 10, false); + tune_type t_small(16, 1024, 32, 2048, 1, 10, false); + + // First instance of local type assured. tune_type t1 = t_default; - tune_type t2; if (test_policy<policy_type>::per_type()) { a._M_set_options(t_opt); - t2 = a._M_get_options(); - VERIFY( t1._M_align != t2._M_align ); + t1 = a._M_get_options(); + VERIFY( t1._M_align != t_default._M_align ); } - else - t2 = t1; // Lock tune settings. typename allocator_type::pointer p1 = a.allocate(128); - // First instance of local type assured. typedef pod2 value2_type; typedef typename allocator_type::template rebind<value2_type>::other rebind_type; rebind_type a2; - tune_type t3 = a2._M_get_options(); - tune_type t4; + tune_type t2 = a2._M_get_options(); // Both policy_type and rebind_type::policy_type have same characteristics. if (test_policy<policy_type>::per_type()) { a2._M_set_options(t_opt); - t4 = a2._M_get_options(); - VERIFY( t3._M_align != t4._M_align ); - t3 = t4; + tune_type t = a2._M_get_options(); + VERIFY( t2._M_align != t._M_align ); + t2 = t; } - else - VERIFY( t3._M_max_threads == t2._M_max_threads ); typename rebind_type::pointer p2 = a2.allocate(5128); - a2._M_set_options(t_single); - t4 = a2._M_get_options(); - VERIFY( t4._M_max_threads != t_single._M_max_threads ); - VERIFY( t4._M_max_threads == t3._M_max_threads ); + a2._M_set_options(t_small); + tune_type t4 = a2._M_get_options(); + VERIFY( t4._M_chunk_size != t_small._M_chunk_size ); + VERIFY( t4._M_chunk_size == t2._M_chunk_size ); a.deallocate(p1, 128); a2.deallocate(p2, 5128); |