Commit f64f4406 by Loren J. Rittle Committed by Loren J. Rittle

check_performance: Only compile with $THREAD_FLAG when test is marked to require it.

	* scripts/check_performance: Only compile with $THREAD_FLAG
	when test is marked to require it.  Allow multiple
	compilations/executions of marked tests.
	* testsuite/testsuite_performance.h (report_performance):
	Report dynamic thread support status.
	(report_header): Likewise.
	* testsuite/performance/allocator.cc: Stabilize iteration
	count.  Support more allocators.  Mark each allocator test to
	run and report independently.
	* testsuite/performance/allocator_map_thread.cc: Likewise.
	* testsuite/performance/allocator_thread.cc: Likewise.

From-SVN: r76932
parent 5fddd9fe
2004-01-30 Loren J. Rittle <ljrittle@acm.org>
* scripts/check_performance: Only compile with $THREAD_FLAG
when test is marked to require it. Allow multiple
compilations/executions of marked tests.
* testsuite/testsuite_performance.h (report_performance):
Report dynamic thread support status.
(report_header): Likewise.
* testsuite/performance/allocator.cc: Stabilize iteration
count. Support more allocators. Mark each allocator test to
run and report independently.
* testsuite/performance/allocator_map_thread.cc: Likewise.
* testsuite/performance/allocator_thread.cc: Likewise.
2004-01-29 Stephen M. Webb <stephen.webb@bregmasoft.com> 2004-01-29 Stephen M. Webb <stephen.webb@bregmasoft.com>
* config/local/generic/c_locale.h: Change ::malloc() to new char[]. * config/local/generic/c_locale.h: Change ::malloc() to new char[].
......
...@@ -31,19 +31,43 @@ SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc \ ...@@ -31,19 +31,43 @@ SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc \
-Wl,--rpath -Wl,$BUILD_DIR/src/.libs" -Wl,--rpath -Wl,$BUILD_DIR/src/.libs"
ST_FLAG="-static" ST_FLAG="-static"
LINK=$SH_FLAG LINK=$SH_FLAG
CXX="$COMPILER $INCLUDES $FLAGS $THREAD_FLAG $LINK" CXX="$COMPILER $INCLUDES $FLAGS $LINK"
CXX_THREAD="$COMPILER $INCLUDES $FLAGS $THREAD_FLAG $LINK"
TESTS_FILE="testsuite_files_performance" TESTS_FILE="testsuite_files_performance"
for NAME in `cat $TESTS_FILE` for NAME in `cat $TESTS_FILE`
do do
echo $NAME RUN=true
FILE_NAME="`basename $NAME`" for CYCLE in `sed -n 's,.*\(TEST_[SB][0-9]*\)$,\1,p' $SRC_DIR/testsuite/$NAME`
EXE_NAME="`echo $FILE_NAME | sed 's/cc$/exe/'`" do
$CXX $SRC_DIR/testsuite/$NAME -o $EXE_NAME RUN=false
./$EXE_NAME echo $NAME $CYCLE
echo "" FILE_NAME="`basename $NAME`"
EXE_NAME="`echo $FILE_NAME-$CYCLE | sed 's/cc$/exe/'`"
$CXX -D$CYCLE $SRC_DIR/testsuite/$NAME -o $EXE_NAME
./$EXE_NAME
echo ""
done
for CYCLE in `sed -n 's,.*\(TEST_[TB][0-9]*\)$,\1,p' $SRC_DIR/testsuite/$NAME`
do
RUN=false
echo $NAME $CYCLE THREAD
FILE_NAME="`basename $NAME`"
EXE_NAME="`echo $FILE_NAME-$CYCLE | sed 's/cc$/exe/'`"
$CXX_THREAD -D$CYCLE $SRC_DIR/testsuite/$NAME -o $EXE_NAME
./$EXE_NAME
echo ""
done
if $RUN; then
echo $NAME
FILE_NAME="`basename $NAME`"
EXE_NAME="`echo $FILE_NAME | sed 's/cc$/exe/'`"
$CXX $SRC_DIR/testsuite/$NAME -o $EXE_NAME
./$EXE_NAME
echo ""
fi
done done
exit 0 exit 0
...@@ -38,18 +38,20 @@ ...@@ -38,18 +38,20 @@
#include <typeinfo> #include <typeinfo>
#include <sstream> #include <sstream>
#include <ext/mt_allocator.h> #include <ext/mt_allocator.h>
#include <ext/new_allocator.h>
#include <ext/malloc_allocator.h> #include <ext/malloc_allocator.h>
#include <cxxabi.h> #include <cxxabi.h>
#include <testsuite_performance.h> #include <testsuite_performance.h>
using namespace std; using namespace std;
using __gnu_cxx::malloc_allocator;
using __gnu_cxx::__mt_alloc; using __gnu_cxx::__mt_alloc;
using __gnu_cxx::new_allocator;
using __gnu_cxx::malloc_allocator;
typedef int test_type; typedef int test_type;
// The number of iterations to be performed. // The number of iterations to be performed.
int iterations; int iterations = 100000;
// The number of values to insert in the container, 32 will cause 5 // 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) // (re)allocations to be performed (sizes 4, 8, 16, 32 and 64)
...@@ -83,29 +85,6 @@ template<typename Container> ...@@ -83,29 +85,6 @@ template<typename Container>
template<typename Container> template<typename Container>
void void
calibrate_iterations()
{
int try_iterations = iterations = 100000;
int test_iterations;
__gnu_test::time_counter timer;
timer.start();
test_iterations = do_loop<Container>();
timer.stop();
if (try_iterations > test_iterations && test_iterations > iterations)
iterations = test_iterations - 100;
else
{
double tics = timer.real_time();
double iterpc = test_iterations / tics; //iterations per clock
double xtics = 200; // works for linux 2gig x86
iterations = static_cast<int>(xtics * iterpc);
}
}
template<typename Container>
void
test_container(Container obj) test_container(Container obj)
{ {
using namespace __gnu_test; using namespace __gnu_test;
...@@ -130,15 +109,31 @@ template<typename Container> ...@@ -130,15 +109,31 @@ template<typename Container>
// http://gcc.gnu.org/ml/libstdc++/2003-05/msg00231.html // http://gcc.gnu.org/ml/libstdc++/2003-05/msg00231.html
int main(void) int main(void)
{ {
calibrate_iterations<vector<test_type> >(); #ifdef TEST_B1
test_container(vector<test_type>()); test_container(vector<test_type>());
#endif
#ifdef TEST_B2
test_container(vector<test_type, malloc_allocator<test_type> >()); test_container(vector<test_type, malloc_allocator<test_type> >());
#endif
#ifdef TEST_B3
test_container(vector<test_type, new_allocator<test_type> >());
#endif
#ifdef TEST_B4
test_container(vector<test_type, __mt_alloc<test_type> >()); test_container(vector<test_type, __mt_alloc<test_type> >());
#endif
calibrate_iterations<list<test_type> >(); #ifdef TEST_B5
test_container(list<test_type>()); test_container(list<test_type>());
#endif
#ifdef TEST_B6
test_container(list<test_type, malloc_allocator<test_type> >()); test_container(list<test_type, malloc_allocator<test_type> >());
#endif
#ifdef TEST_B7
test_container(list<test_type, new_allocator<test_type> >());
#endif
#ifdef TEST_B8
test_container(list<test_type, __mt_alloc<test_type> >()); test_container(list<test_type, __mt_alloc<test_type> >());
#endif
return 0; return 0;
} }
...@@ -37,17 +37,19 @@ ...@@ -37,17 +37,19 @@
#include <iostream> #include <iostream>
#include <typeinfo> #include <typeinfo>
#include <sstream> #include <sstream>
#include <cxxabi.h>
#include <ext/mt_allocator.h> #include <ext/mt_allocator.h>
#include <ext/new_allocator.h>
#include <ext/malloc_allocator.h> #include <ext/malloc_allocator.h>
#include <cxxabi.h>
#include <testsuite_performance.h> #include <testsuite_performance.h>
using namespace std; using namespace std;
using __gnu_cxx::malloc_allocator;
using __gnu_cxx::__mt_alloc; using __gnu_cxx::__mt_alloc;
using __gnu_cxx::new_allocator;
using __gnu_cxx::malloc_allocator;
// The number of iterations to be performed. // The number of iterations to be performed.
int iterations; int iterations = 25000;
template<typename Container> template<typename Container>
void* void*
...@@ -71,23 +73,6 @@ template<typename Container> ...@@ -71,23 +73,6 @@ template<typename Container>
template<typename Container> template<typename Container>
void void
calibrate_iterations()
{
int try_iterations = iterations = 10000;
__gnu_test::time_counter timer;
timer.start();
do_loop<Container>();
timer.stop();
double tics = timer.real_time();
double iterpc = iterations / tics; //iterations per clock
double xtics = 100; // works for linux 2gig x86
iterations = static_cast<int>(xtics * iterpc);
}
template<typename Container>
void
test_container(Container obj) test_container(Container obj)
{ {
using namespace __gnu_test; using namespace __gnu_test;
...@@ -122,11 +107,19 @@ template<typename Container> ...@@ -122,11 +107,19 @@ template<typename Container>
int main(void) int main(void)
{ {
calibrate_iterations<map<int, int> >(); #ifdef TEST_T1
test_container(map<int, int>()); test_container(map<int, int>());
#endif
#ifdef TEST_T2
test_container(map<int, int, less<const int>, new_allocator<int> >());
#endif
#ifdef TEST_T3
test_container(map<int, int, less<const int>, malloc_allocator<int> >()); test_container(map<int, int, less<const int>, malloc_allocator<int> >());
#endif
#ifdef TEST_T4
test_container(map<int, int, less<const int>, test_container(map<int, int, less<const int>,
__mt_alloc< pair<const int, int> > >()); __mt_alloc< pair<const int, int> > >());
#endif
return 0; return 0;
} }
...@@ -39,18 +39,20 @@ ...@@ -39,18 +39,20 @@
#include <sstream> #include <sstream>
#include <pthread.h> #include <pthread.h>
#include <ext/mt_allocator.h> #include <ext/mt_allocator.h>
#include <ext/new_allocator.h>
#include <ext/malloc_allocator.h> #include <ext/malloc_allocator.h>
#include <cxxabi.h> #include <cxxabi.h>
#include <testsuite_performance.h> #include <testsuite_performance.h>
using namespace std; using namespace std;
using __gnu_cxx::malloc_allocator;
using __gnu_cxx::__mt_alloc; using __gnu_cxx::__mt_alloc;
using __gnu_cxx::new_allocator;
using __gnu_cxx::malloc_allocator;
typedef int test_type; typedef int test_type;
// The number of iterations to be performed. // The number of iterations to be performed.
int iterations; int iterations = 25000;
// The number of values to insert in the container, 32 will cause 5 // 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) // (re)allocations to be performed (sizes 4, 8, 16, 32 and 64)
...@@ -91,23 +93,6 @@ template<typename Container> ...@@ -91,23 +93,6 @@ template<typename Container>
template<typename Container> template<typename Container>
void void
calibrate_iterations()
{
int try_iterations = iterations = 100000;
__gnu_test::time_counter timer;
timer.start();
do_loop<Container>();
timer.stop();
double tics = timer.real_time();
double iterpc = iterations / tics; //iterations per clock
double xtics = 100; // works for linux 2gig x86
iterations = static_cast<int>(xtics * iterpc);
}
template<typename Container>
void
test_container(Container obj) test_container(Container obj)
{ {
using namespace __gnu_test; using namespace __gnu_test;
...@@ -144,15 +129,31 @@ template<typename Container> ...@@ -144,15 +129,31 @@ template<typename Container>
// http://gcc.gnu.org/ml/libstdc++/2003-05/msg00231.html // http://gcc.gnu.org/ml/libstdc++/2003-05/msg00231.html
int main(void) int main(void)
{ {
calibrate_iterations<vector<test_type> >(); #ifdef TEST_T1
test_container(vector<test_type>()); test_container(vector<test_type>());
#endif
#ifdef TEST_T2
test_container(vector<test_type, malloc_allocator<test_type> >()); test_container(vector<test_type, malloc_allocator<test_type> >());
#endif
#ifdef TEST_T3
test_container(vector<test_type, new_allocator<test_type> >());
#endif
#ifdef TEST_T4
test_container(vector<test_type, __mt_alloc<test_type> >()); test_container(vector<test_type, __mt_alloc<test_type> >());
#endif
calibrate_iterations<list<test_type> >(); #ifdef TEST_T5
test_container(list<test_type>()); test_container(list<test_type>());
#endif
#ifdef TEST_T6
test_container(list<test_type, malloc_allocator<test_type> >()); test_container(list<test_type, malloc_allocator<test_type> >());
#endif
#ifdef TEST_T7
test_container(list<test_type, new_allocator<test_type> >());
#endif
#ifdef TEST_T8
test_container(list<test_type, __mt_alloc<test_type> >()); test_container(list<test_type, __mt_alloc<test_type> >());
#endif
return 0; return 0;
} }
...@@ -183,6 +183,11 @@ namespace __gnu_test ...@@ -183,6 +183,11 @@ namespace __gnu_test
std::ofstream out(name, std::ios_base::app); std::ofstream out(name, std::ios_base::app);
#ifdef __GTHREADS
if (__gthread_active_p ())
testname.append ("-thread");
#endif
out.setf(std::ios_base::left); out.setf(std::ios_base::left);
out << std::setw(25) << testname << tab; out << std::setw(25) << testname << tab;
out << std::setw(25) << comment << tab; out << std::setw(25) << comment << tab;
...@@ -209,6 +214,11 @@ namespace __gnu_test ...@@ -209,6 +214,11 @@ namespace __gnu_test
std::ofstream out(name, std::ios_base::app); std::ofstream out(name, std::ios_base::app);
#ifdef __GTHREADS
if (__gthread_active_p ())
testname.append ("-thread");
#endif
out.setf(std::ios_base::left); out.setf(std::ios_base::left);
out << std::setw(25) << testname << tab; out << std::setw(25) << testname << tab;
out << std::setw(40) << header << tab; out << std::setw(40) << header << tab;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment