freebsd-src/contrib/libstdc++/scripts/check_performance

94 lines
2.3 KiB
Plaintext
Raw Normal View History

2004-07-28 04:12:05 +01:00
#!/usr/bin/env bash
# Script to do performance testing.
# Invocation
# check_performance SRC_DIR BUILD_DIR
# 1: variables
#
SRC_DIR=$1
BUILD_DIR=$2
# Now that we've successfully translated the numerical option into
# a symbolic one, we can safely ignore it.
shift
# This has been true all along. Found out about it the hard way...
case $BASH_VERSION in
1*)
echo 'You need bash 2.x to run check_performance. Exiting.';
exit 1 ;;
*) ;;
esac
flags_script=$BUILD_DIR/scripts/testsuite_flags
INCLUDES=`$flags_script --build-includes`
PCH_FLAGS=`$flags_script --cxxpchflags`
2004-07-28 04:12:05 +01:00
FLAGS=`$flags_script --cxxflags`
THREAD_FLAG='-pthread'
COMPILER=`$flags_script --build-cxx`
SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc \
-Wl,--rpath -Wl,$BUILD_DIR/src/.libs"
ST_FLAG="-static"
LINK=$SH_FLAG
CXX="$COMPILER $INCLUDES $PCH_FLAGS $FLAGS $LINK"
LIBS="./libtestc++.a"
2004-07-28 04:12:05 +01:00
TESTS_FILE="testsuite_files_performance"
for NAME in `cat $TESTS_FILE`
do
RUN=true
TESTNAME=$SRC_DIR/testsuite/$NAME
FILE_NAME="`basename $NAME`"
FILE_NAME="`echo $FILE_NAME | sed 's/.cc//g'`"
# TEST_S == single thread
# TEST_B == do both single and multi-thread
# TEST_T == multi-thread
for CYCLE in `sed -n 's,.*\(TEST_[SB][0-9]*\)$,\1,p' $TESTNAME`
2004-07-28 04:12:05 +01:00
do
RUN=false
echo $NAME $CYCLE
EXE_NAME="`echo $FILE_NAME-$CYCLE.exe`"
$CXX -DNOTHREAD -D$CYCLE $TESTNAME $LIBS -o $EXE_NAME
if [ -f $EXE_NAME ]; then
./$EXE_NAME
else
echo "compile error:"
echo "$CXX -DNOTHREAD -D$CYCLE $TESTNAME $LIBS -o $EXE_NAME"
fi
2004-07-28 04:12:05 +01:00
done
for CYCLE in `sed -n 's,.*\(TEST_[TB][0-9]*\)$,\1,p' $TESTNAME`
2004-07-28 04:12:05 +01:00
do
RUN=false
echo $NAME $CYCLE thread
EXE_NAME="`echo $FILE_NAME-$CYCLE.exe`"
$CXX $THREAD_FLAG -D$CYCLE $TESTNAME $LIBS -o $EXE_NAME
if [ -f $EXE_NAME ]; then
./$EXE_NAME
else
echo "compile error:"
echo "$CXX $THREAD_FLAG -D$CYCLE $TESTNAME $LIBS -o $EXE_NAME"
fi
2004-07-28 04:12:05 +01:00
done
2004-07-28 04:12:05 +01:00
if $RUN; then
echo $NAME
EXE_NAME="`echo $FILE_NAME.exe`"
$CXX $TESTNAME $LIBS -o $EXE_NAME
if [ -f $EXE_NAME ]; then
./$EXE_NAME >& tmp.$FILE_NAME
else
echo "compile error:"
echo "$CXX $TESTNAME $LIBS -o $EXE_NAME"
fi
if [ -s tmp.$FILE_NAME ]; then
mv tmp.$FILE_NAME $FILE_NAME.xml
fi
2004-07-28 04:12:05 +01:00
fi
done
exit 0