[test-suite] r218054 - Make the use of Perf optional

Yi Kong Yi.Kong at arm.com
Thu Sep 18 08:50:47 PDT 2014


Author: kongyi
Date: Thu Sep 18 10:50:47 2014
New Revision: 218054

URL: http://llvm.org/viewvc/llvm-project?rev=218054&view=rev
Log:
Make the use of Perf optional

Do not try to automatically detect and use perf on Linux, thus giving
user more control of which tool to use.

Also this fixes the mistake that Perf wasn't used when not using
user mode emulation.


Modified:
    test-suite/trunk/tools/Makefile
    test-suite/trunk/tools/timeit.sh

Modified: test-suite/trunk/tools/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/tools/Makefile?rev=218054&r1=218053&r2=218054&view=diff
==============================================================================
--- test-suite/trunk/tools/Makefile (original)
+++ test-suite/trunk/tools/Makefile Thu Sep 18 10:50:47 2014
@@ -8,20 +8,21 @@ ifndef USER_MODE_EMULATION
 all:: timeit-target
 endif
 
-ifeq ($(TARGET_OS),Linux)
-all:: ctimeit
-timeit: timeit.sh
-	cp -f $< $@
-	chmod u+x $@
-ctimeit: timeit.c
-	$(ORIGINAL_CC) $(CFLAGS) -O3 -o $@ $<
-else
+ifndef USE_PERF
 timeit: timeit.c
 	$(ORIGINAL_CC) $(CFLAGS) -O3 -o $@ $<
-endif
 
 timeit-target: timeit.c
 	$(LD_ENV_OVERRIDES) $(LCC) -o $@ $< $(LDFLAGS) $(CFLAGS) $(TARGET_FLAGS) -O3
+else
+timeit: timeit.sh
+	cp -f $< $@
+	chmod u+x $@
+
+timeit-target: timeit.sh
+	cp -f $< $@
+	chmod u+x $@
+endif
 
 fpcmp: fpcmp.c
 	$(ORIGINAL_CC) $(CFLAGS) -O3 -o $@ $<

Modified: test-suite/trunk/tools/timeit.sh
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/tools/timeit.sh?rev=218054&r1=218053&r2=218054&view=diff
==============================================================================
--- test-suite/trunk/tools/timeit.sh (original)
+++ test-suite/trunk/tools/timeit.sh Thu Sep 18 10:50:47 2014
@@ -1,24 +1,6 @@
 #! /bin/bash
 # A wrapper over perf to provide similar functionality to timeit.c
 
-# Fall back to ctimeit for PowerPC
-TARGET=`uname -m`
-
-if [ \( $TARGET = "ppc64" \) -o \( $TARGET = "ppc64le" \) ]; then
-    $(dirname $0)/ctimeit $@
-    exit $?
-fi
-
-DEPENDS="perf"
-
-# Fallback to ctimeit if dependencies are not met
-for cmd in ${DEPENDS} ; do
-	if ! command -v ${cmd} &> /dev/null ; then
-		$(dirname $0)/ctimeit $@
-		exit $?
-	fi
-done
-
 REPORT=/dev/stderr
 INPUT=/dev/stdin
 OUTPUT=/dev/stdout
@@ -36,7 +18,7 @@ while [[ $1 = -* ]]; do
 	shift 2
 done
 
-perf stat -o $PERFSTAT $@ < $INPUT > $OUTPUT
+perf stat -o $PERFSTAT $@ < $INPUT &> $OUTPUT
 
 EXITCODE=$?
 





More information about the llvm-commits mailing list