summaryrefslogtreecommitdiff
path: root/libstdc++-v3/scripts/check_performance
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/scripts/check_performance
downloadcbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2
cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/scripts/check_performance')
-rwxr-xr-xlibstdc++-v3/scripts/check_performance95
1 files changed, 95 insertions, 0 deletions
diff --git a/libstdc++-v3/scripts/check_performance b/libstdc++-v3/scripts/check_performance
new file mode 100755
index 000000000..d196355bd
--- /dev/null
+++ b/libstdc++-v3/scripts/check_performance
@@ -0,0 +1,95 @@
+#!/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`
+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 $FLAGS -std=gnu++0x $CXXFLAGS $LINK"
+LIBS="./libtestc++.a"
+TESTS_FILE="testsuite_files_performance"
+
+echo CXX is $CXX
+
+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`
+ 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
+ done
+
+ for CYCLE in `sed -n 's,.*\(TEST_[TB][0-9]*\)$,\1,p' $TESTNAME`
+ 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
+ done
+
+ 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
+ fi
+done
+
+exit 0