2005-05-13 Josh Conner <jconner@apple.com>
[official-gcc.git] / libstdc++-v3 / scripts / check_performance
blobf5d2351d837439857e2aaf9ab8fbe6d0e567f0df
1 #!/usr/bin/env bash
3 # Script to do performance testing.
5 # Invocation
6 # check_performance SRC_DIR BUILD_DIR
8 # 1: variables
10 SRC_DIR=$1
11 BUILD_DIR=$2
13 # Now that we've successfully translated the numerical option into
14 # a symbolic one, we can safely ignore it.
15 shift
17 # This has been true all along. Found out about it the hard way...
18 case $BASH_VERSION in
19 1*)
20 echo 'You need bash 2.x to run check_performance. Exiting.';
21 exit 1 ;;
22 *) ;;
23 esac
25 flags_script=$BUILD_DIR/scripts/testsuite_flags
26 INCLUDES=`$flags_script --build-includes`
27 PCH_FLAGS=`$flags_script --cxxpchflags`
28 FLAGS=`$flags_script --cxxflags`
29 THREAD_FLAG='-pthread'
30 COMPILER=`$flags_script --build-cxx`
31 SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc \
32 -Wl,--rpath -Wl,$BUILD_DIR/src/.libs"
33 ST_FLAG="-static"
34 LINK=$SH_FLAG
35 CXX="$COMPILER $INCLUDES $PCH_FLAGS $FLAGS $LINK"
36 TESTS_FILE="testsuite_files_performance"
38 for NAME in `cat $TESTS_FILE`
40 RUN=true
42 # TEST_S == single thread
43 # TEST_B == do both single and multi-thread
44 # TEST_T == multi-thread
45 for CYCLE in `sed -n 's,.*\(TEST_[SB][0-9]*\)$,\1,p' $SRC_DIR/testsuite/$NAME`
47 RUN=false
48 echo $NAME $CYCLE
49 FILE_NAME="`basename $NAME`"
50 FILE_NAME="`echo $FILE_NAME | sed 's/.cc//g'`"
51 EXE_NAME="`echo $FILE_NAME-$CYCLE.exe`"
52 $CXX -DNOTHREAD -D$CYCLE $SRC_DIR/testsuite/$NAME -o $EXE_NAME
53 if [ -f $EXE_NAME ]; then
54 ./$EXE_NAME
56 done
58 for CYCLE in `sed -n 's,.*\(TEST_[TB][0-9]*\)$,\1,p' $SRC_DIR/testsuite/$NAME`
60 RUN=false
61 echo $NAME $CYCLE thread
62 FILE_NAME="`basename $NAME`"
63 FILE_NAME="`echo $FILE_NAME | sed 's/.cc//g'`"
64 EXE_NAME="`echo $FILE_NAME-$CYCLE.exe`"
65 $CXX $THREAD_FLAG -D$CYCLE $SRC_DIR/testsuite/$NAME -o $EXE_NAME
66 if [ -f $EXE_NAME ]; then
67 ./$EXE_NAME
69 done
71 if $RUN; then
72 echo $NAME
73 FILE_NAME="`basename $NAME`"
74 EXE_NAME="`echo $FILE_NAME | sed 's/cc$/exe/'`"
75 $CXX $SRC_DIR/testsuite/$NAME -o $EXE_NAME
76 if [ -f $EXE_NAME ]; then
77 ./$EXE_NAME
80 done
82 exit 0