about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHaitao Li <lihaitao@gmail.com>2012-01-16 19:20:07 +0800
committerHaitao Li <lihaitao@gmail.com>2012-01-17 10:48:46 +0800
commitef0775fec884256ea733a63bbeb855f169779b56 (patch)
tree22c2ac0ccde0779cac611732d6275731c41a943c
parent293678847b8c6291389826b1a7e9c5bda889c8d9 (diff)
build: Check and set perf --log-fd option
Linux perf tool version 3.2 introduced a new option "--log-fd" defaults
to 0, which leads to error "Failed opening logfd: Illegal argument" when
executing perf tests.

Set logfd to stderr to let perf test work.

Issue #1538
-rwxr-xr-xconfigure10
-rw-r--r--mk/platform.mk6
2 files changed, 15 insertions, 1 deletions
diff --git a/configure b/configure
index e44338a99aa..3563f0b8826 100755
--- a/configure
+++ b/configure
@@ -363,6 +363,16 @@ then
     err "either clang or gcc is required"
 fi
 
+if [ ! -z "$CFG_PERF" ]
+then
+    HAVE_PERF_LOGFD=`$CFG_PERF stat --log-fd 2>&1 | grep 'unknown option'`
+    if [ -z "$HAVE_PERF_LOGFD" ];
+    then
+        CFG_PERF_WITH_LOGFD=1
+        putvar CFG_PERF_WITH_LOGFD
+    fi
+fi
+
 step_msg "making directories"
 
 for i in \
diff --git a/mk/platform.mk b/mk/platform.mk
index 3d070724abc..0018a3bd8e5 100644
--- a/mk/platform.mk
+++ b/mk/platform.mk
@@ -58,7 +58,11 @@ ifneq ($(findstring linux,$(CFG_OSTYPE)),)
   CFG_LDENV := LD_LIBRARY_PATH
   CFG_DEF_SUFFIX := .linux.def
   ifdef CFG_PERF
-	CFG_PERF_TOOL := $(CFG_PERF) stat -r 3
+    ifneq ($(CFG_PERF_WITH_LOGFD),)
+        CFG_PERF_TOOL := $(CFG_PERF) stat -r 3 --log-fd 2
+    else
+        CFG_PERF_TOOL := $(CFG_PERF) stat -r 3
+    endif
   else
     ifdef CFG_VALGRIND
       CFG_PERF_TOOL :=\