[test-suite] r209797 - Revert "Revert perf tool patch, as it breaks buildbots"

Yi Kong Yi.Kong at arm.com
Thu May 29 01:21:43 PDT 2014


Author: kongyi
Date: Thu May 29 03:21:43 2014
New Revision: 209797

URL: http://llvm.org/viewvc/llvm-project?rev=209797&view=rev
Log:
Revert "Revert perf tool patch, as it breaks buildbots"

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

Modified: test-suite/trunk/tools/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/tools/Makefile?rev=209797&r1=209796&r2=209797&view=diff
==============================================================================
--- test-suite/trunk/tools/Makefile (original)
+++ test-suite/trunk/tools/Makefile Thu May 29 03:21:43 2014
@@ -8,8 +8,17 @@ 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
 timeit: timeit.c
 	$(ORIGINAL_CC) $(CFLAGS) -O3 -o $@ $<
+endif
 
 timeit-target: timeit.c
 	$(LD_ENV_OVERRIDES) $(LCC) -o $@ $< $(LDFLAGS) $(CFLAGS) $(TARGET_FLAGS) -O3

Added: test-suite/trunk/tools/timeit.sh
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/tools/timeit.sh?rev=209797&view=auto
==============================================================================
--- test-suite/trunk/tools/timeit.sh (added)
+++ test-suite/trunk/tools/timeit.sh Thu May 29 03:21:43 2014
@@ -0,0 +1,38 @@
+#! /bin/bash
+# A wrapper over perf to provide similar functionality to timeit.c
+
+DEPENDS="perf schedtool"
+
+# 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
+
+while [[ $1 = -* ]]; do
+	if [ $1 = "--summary" ]; then
+		REPORT=$2
+	elif [ $1 = "--redirect-input" ]; then
+		INPUT=$2
+	elif [ $1 = "--redirect-output" ]; then
+		OUTPUT=$2
+	fi
+	shift 2
+done
+
+perf stat -o stats schedtool -a 0x1 -e $@ < $INPUT > $OUTPUT
+
+EXITCODE=$?
+
+echo exit $EXITCODE > $REPORT
+awk -F' ' '{if ($2 == "task-clock") print "user",$1/1000; else if($2 =="seconds") print "real",$1;}' stats >> $REPORT
+
+rm stats
+
+exit $EXITCODE





More information about the llvm-commits mailing list