aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlibstdc++-v3/scripts/check_performance2
-rw-r--r--libstdc++-v3/testsuite/performance/20_util/allocator/insert.cc120
-rw-r--r--libstdc++-v3/testsuite/performance/20_util/allocator/insert_insert.cc65
-rw-r--r--libstdc++-v3/testsuite/performance/20_util/allocator/map_thread.cc2
-rw-r--r--libstdc++-v3/testsuite/performance/20_util/allocator/producer_consumer.cc2
5 files changed, 118 insertions, 73 deletions
diff --git a/libstdc++-v3/scripts/check_performance b/libstdc++-v3/scripts/check_performance
index 998f45d..090dae8 100755
--- a/libstdc++-v3/scripts/check_performance
+++ b/libstdc++-v3/scripts/check_performance
@@ -31,7 +31,7 @@ SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc \
-Wl,--rpath -Wl,$BUILD_DIR/src/.libs"
ST_FLAG="-static"
LINK=$SH_FLAG
-CXX="$COMPILER $INCLUDES $FLAGS $LINK"
+CXX="$COMPILER $INCLUDES $FLAGS -DNOTHREAD $LINK"
CXX_THREAD="$COMPILER $INCLUDES $FLAGS $THREAD_FLAG $LINK"
diff --git a/libstdc++-v3/testsuite/performance/20_util/allocator/insert.cc b/libstdc++-v3/testsuite/performance/20_util/allocator/insert.cc
index 15677d7..9c7975c 100644
--- a/libstdc++-v3/testsuite/performance/20_util/allocator/insert.cc
+++ b/libstdc++-v3/testsuite/performance/20_util/allocator/insert.cc
@@ -51,7 +51,7 @@ using namespace std;
typedef int test_type;
// The number of iterations to be performed.
-int iterations = 100000;
+int iterations = 10000;
// The number of values to insert in the container, 32 will cause 5
// (re)allocations to be performed (sizes 4, 8, 16, 32 and 64)
@@ -71,30 +71,30 @@ template<typename TestType>
};
template<typename Container>
- int
- do_loop(Container& obj)
+ void
+ do_loop()
{
+ Container obj;
int test_iterations = 0;
- try
- {
- value_type<test_type> test_value;
- while (test_iterations < iterations)
- {
- for (int j = 0; j < insert_values; ++j)
- obj.insert(obj.end(), ++test_value);
- ++test_iterations;
- }
- }
- catch(...)
+ value_type<test_type> test_value;
+ while (test_iterations < iterations)
{
- // No point allocating all available memory, repeatedly.
+ for (int j = 0; j < insert_values; ++j)
+ obj.insert(obj.end(), ++test_value);
+ ++test_iterations;
}
- return test_iterations;
+ }
+
+template<typename Container>
+ void*
+ do_test(void* p = NULL)
+ {
+ do_loop<Container>();
}
template<typename Container>
void
- test_container(Container obj)
+ test_container(Container obj, bool run_threaded = false)
{
using namespace __gnu_test;
int status;
@@ -103,11 +103,36 @@ template<typename Container>
resource_counter resource;
clear_counters(time, resource);
start_counters(time, resource);
- int test_iterations = do_loop(obj);
+
+ if (! run_threaded)
+ {
+ do_loop<Container>();
+ }
+ else
+ {
+#if defined (_GLIBCXX_GCC_GTHR_POSIX_H) && !defined (NOTHREAD)
+ pthread_t t1, t2, t3, t4;
+ pthread_create(&t1, 0, &do_test<Container>, 0);
+ pthread_create(&t2, 0, &do_test<Container>, 0);
+ pthread_create(&t3, 0, &do_test<Container>, 0);
+ pthread_create(&t4, 0, &do_test<Container>, 0);
+
+ pthread_join(t1, NULL);
+ pthread_join(t2, NULL);
+ pthread_join(t3, NULL);
+ pthread_join(t4, NULL);
+#else
+ return;
+#endif
+ }
+
stop_counters(time, resource);
std::ostringstream comment;
- comment << "iterations: " << test_iterations << '\t';
+ if (run_threaded)
+ comment << "4-way threaded iterations: " << iterations*4 << '\t';
+ else
+ comment << "iterations: " << iterations << '\t';
comment << "type: " << abi::__cxa_demangle(typeid(obj).name(),
0, 0, &status);
report_header(__FILE__, comment.str());
@@ -154,30 +179,75 @@ int main(void)
typedef less<test_type> compare_type;
#ifdef TEST_B9
- iterations = 50000;
test_container(map<test_type, test_type, compare_type, m_alloc_type>());
#endif
#ifdef TEST_B10
- iterations = 50000;
test_container(map<test_type, test_type, compare_type, n_alloc_type>());
#endif
#ifdef TEST_B11
- iterations = 50000;
test_container(map<test_type, test_type, compare_type, so_alloc_type>());
#endif
#ifdef TEST_B12
- iterations = 50000;
test_container(set<test_type, compare_type, m_alloc_type>());
#endif
#ifdef TEST_B13
- iterations = 50000;
test_container(set<test_type, compare_type, n_alloc_type>());
#endif
#ifdef TEST_B14
- iterations = 50000;
test_container(set<test_type, compare_type, so_alloc_type>());
#endif
+#ifdef TEST_T0
+ test_container(vector<test_type, m_alloc_type>(), true);
+#endif
+#ifdef TEST_T1
+ test_container(vector<test_type, n_alloc_type>(), true);
+#endif
+#ifdef TEST_T2
+ test_container(vector<test_type, so_alloc_type>(), true);
+#endif
+
+#ifdef TEST_T3
+ test_container(list<test_type, m_alloc_type>(), true);
+#endif
+#ifdef TEST_T4
+ test_container(list<test_type, n_alloc_type>(), true);
+#endif
+#ifdef TEST_T5
+ test_container(list<test_type, so_alloc_type>(), true);
+#endif
+
+#ifdef TEST_T6
+ test_container(deque<test_type, m_alloc_type>(), true);
+#endif
+#ifdef TEST_T7
+ test_container(deque<test_type, n_alloc_type>(), true);
+#endif
+#ifdef TEST_T8
+ test_container(deque<test_type, so_alloc_type>(), true);
+#endif
+
+ typedef less<test_type> compare_type;
+#ifdef TEST_T9
+ test_container(map<test_type, test_type, compare_type, m_alloc_type>(), true);
+#endif
+#ifdef TEST_T10
+ test_container(map<test_type, test_type, compare_type, n_alloc_type>(), true);
+#endif
+#ifdef TEST_T11
+ test_container(map<test_type, test_type, compare_type, so_alloc_type>(), true);
+#endif
+
+#ifdef TEST_T12
+ test_container(set<test_type, compare_type, m_alloc_type>(), true);
+#endif
+#ifdef TEST_T13
+ test_container(set<test_type, compare_type, n_alloc_type>(), true);
+#endif
+#ifdef TEST_T14
+ test_container(set<test_type, compare_type, so_alloc_type>(), true);
+#endif
+
return 0;
}
diff --git a/libstdc++-v3/testsuite/performance/20_util/allocator/insert_insert.cc b/libstdc++-v3/testsuite/performance/20_util/allocator/insert_insert.cc
index c5df36a..e0773f0 100644
--- a/libstdc++-v3/testsuite/performance/20_util/allocator/insert_insert.cc
+++ b/libstdc++-v3/testsuite/performance/20_util/allocator/insert_insert.cc
@@ -40,7 +40,6 @@
#include <set>
#include <typeinfo>
#include <sstream>
-#include <pthread.h>
#include <ext/mt_allocator.h>
#include <ext/new_allocator.h>
#include <ext/malloc_allocator.h>
@@ -52,7 +51,7 @@ using namespace std;
typedef int test_type;
// The number of iterations to be performed.
-int iterations = 25000;
+int iterations = 10000;
// The number of values to insert in the container, 32 will cause 5
// (re)allocations to be performed (sizes 4, 8, 16, 32 and 64)
@@ -87,21 +86,6 @@ template<typename Container>
}
template<typename Container>
- void*
- do_test(void* p = NULL)
- {
- try
- {
- do_loop<Container>();
- do_loop<Container>();
- }
- catch(...)
- {
- // No point allocating all available memory, repeatedly.
- }
- }
-
-template<typename Container>
void
test_container(Container obj)
{
@@ -110,25 +94,16 @@ template<typename Container>
time_counter time;
resource_counter resource;
-
clear_counters(time, resource);
start_counters(time, resource);
-
- pthread_t t1, t2, t3, t4;
- pthread_create(&t1, 0, &do_test<Container>, 0);
- pthread_create(&t2, 0, &do_test<Container>, 0);
- pthread_create(&t3, 0, &do_test<Container>, 0);
- pthread_create(&t4, 0, &do_test<Container>, 0);
-
- pthread_join(t1, NULL);
- pthread_join(t2, NULL);
- pthread_join(t3, NULL);
- pthread_join(t4, NULL);
+
+ do_loop<Container>();
+ do_loop<Container>();
stop_counters(time, resource);
std::ostringstream comment;
- comment << "iterations: " << iterations << '\t';
+ comment << "repeated iterations: " << iterations*2 << '\t';
comment << "type: " << abi::__cxa_demangle(typeid(obj).name(),
0, 0, &status);
report_header(__FILE__, comment.str());
@@ -143,54 +118,54 @@ int main(void)
typedef __gnu_cxx::new_allocator<test_type> n_alloc_type;
typedef __gnu_cxx::__mt_alloc<test_type> so_alloc_type;
-#ifdef TEST_T0
+#ifdef TEST_S0
test_container(vector<test_type, m_alloc_type>());
#endif
-#ifdef TEST_T1
+#ifdef TEST_S1
test_container(vector<test_type, n_alloc_type>());
#endif
-#ifdef TEST_T2
+#ifdef TEST_S2
test_container(vector<test_type, so_alloc_type>());
#endif
-#ifdef TEST_T3
+#ifdef TEST_S3
test_container(list<test_type, m_alloc_type>());
#endif
-#ifdef TEST_T4
+#ifdef TEST_S4
test_container(list<test_type, n_alloc_type>());
#endif
-#ifdef TEST_T5
+#ifdef TEST_S5
test_container(list<test_type, so_alloc_type>());
#endif
-#ifdef TEST_T6
+#ifdef TEST_S6
test_container(deque<test_type, m_alloc_type>());
#endif
-#ifdef TEST_T7
+#ifdef TEST_S7
test_container(deque<test_type, n_alloc_type>());
#endif
-#ifdef TEST_T8
+#ifdef TEST_S8
test_container(deque<test_type, so_alloc_type>());
#endif
typedef less<test_type> compare_type;
-#ifdef TEST_T9
+#ifdef TEST_S9
test_container(map<test_type, test_type, compare_type, m_alloc_type>());
#endif
-#ifdef TEST_T10
+#ifdef TEST_S10
test_container(map<test_type, test_type, compare_type, n_alloc_type>());
#endif
-#ifdef TEST_T11
+#ifdef TEST_S11
test_container(map<test_type, test_type, compare_type, so_alloc_type>());
#endif
-#ifdef TEST_T12
+#ifdef TEST_S12
test_container(set<test_type, compare_type, m_alloc_type>());
#endif
-#ifdef TEST_T13
+#ifdef TEST_S13
test_container(set<test_type, compare_type, n_alloc_type>());
#endif
-#ifdef TEST_T14
+#ifdef TEST_S14
test_container(set<test_type, compare_type, so_alloc_type>());
#endif
diff --git a/libstdc++-v3/testsuite/performance/20_util/allocator/map_thread.cc b/libstdc++-v3/testsuite/performance/20_util/allocator/map_thread.cc
index f6b4d45..abceafa 100644
--- a/libstdc++-v3/testsuite/performance/20_util/allocator/map_thread.cc
+++ b/libstdc++-v3/testsuite/performance/20_util/allocator/map_thread.cc
@@ -49,7 +49,7 @@ using __gnu_cxx::new_allocator;
using __gnu_cxx::malloc_allocator;
// The number of iterations to be performed.
-int iterations = 25000;
+int iterations = 10000;
template<typename Container>
void*
diff --git a/libstdc++-v3/testsuite/performance/20_util/allocator/producer_consumer.cc b/libstdc++-v3/testsuite/performance/20_util/allocator/producer_consumer.cc
index c8d2f1d..951242e 100644
--- a/libstdc++-v3/testsuite/performance/20_util/allocator/producer_consumer.cc
+++ b/libstdc++-v3/testsuite/performance/20_util/allocator/producer_consumer.cc
@@ -58,7 +58,7 @@ typedef new_allocator<test_type> new_alloc_type;
typedef __mt_alloc<test_type> so_alloc_type;
// The number of iterations to be performed.
-int iterations = 25000;
+int iterations = 10000;
// TODO - restore Stefan's comment? i don't understand it. -- fwy
int insert_values = 128;