aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/config/feature-checks
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2013-10-29 10:43:16 -0600
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-11-05 10:03:22 -0300
commit87419c9afff1431d4b62b388baf6bfa07e0b14ff (patch)
tree67790f43f93fb6fde554ef37357e9bee7b124a89 /tools/perf/config/feature-checks
parentperf hists: Consolidate __hists__add_*entry() (diff)
downloadlinux-dev-87419c9afff1431d4b62b388baf6bfa07e0b14ff.tar.xz
linux-dev-87419c9afff1431d4b62b388baf6bfa07e0b14ff.zip
perf kvm: Disable live command if timerfd is not supported
If the OS does not have timerfd support (e.g., older OS'es like RHEL5) disable perf kvm stat live. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Jiri Olsa <jolsa@redhat.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1383064996-20933-2-git-send-email-dsahern@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/config/feature-checks')
-rw-r--r--tools/perf/config/feature-checks/Makefile6
-rw-r--r--tools/perf/config/feature-checks/test-all.c5
-rw-r--r--tools/perf/config/feature-checks/test-timerfd.c18
3 files changed, 28 insertions, 1 deletions
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile
index d37d58d273fe..c803f17fb986 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -25,7 +25,8 @@ FILES= \
test-libunwind \
test-on-exit \
test-stackprotector-all \
- test-stackprotector
+ test-stackprotector \
+ test-timerfd
CC := $(CC) -MD
@@ -136,6 +137,9 @@ test-on-exit:
test-backtrace:
$(BUILD)
+test-timerfd:
+ $(BUILD)
+
-include *.d
###############################
diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c
index 50d431892a0c..59e7a705e146 100644
--- a/tools/perf/config/feature-checks/test-all.c
+++ b/tools/perf/config/feature-checks/test-all.c
@@ -81,6 +81,10 @@
# include "test-libnuma.c"
#undef main
+#define main main_test_timerfd
+# include "test-timerfd.c"
+#undef main
+
int main(int argc, char *argv[])
{
main_test_libpython();
@@ -101,6 +105,7 @@ int main(int argc, char *argv[])
main_test_on_exit();
main_test_backtrace();
main_test_libnuma();
+ main_test_timerfd();
return 0;
}
diff --git a/tools/perf/config/feature-checks/test-timerfd.c b/tools/perf/config/feature-checks/test-timerfd.c
new file mode 100644
index 000000000000..8c5c083b4d3c
--- /dev/null
+++ b/tools/perf/config/feature-checks/test-timerfd.c
@@ -0,0 +1,18 @@
+/*
+ * test for timerfd functions used by perf-kvm-stat-live
+ */
+#include <sys/timerfd.h>
+
+int main(void)
+{
+ struct itimerspec new_value;
+
+ int fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
+ if (fd < 0)
+ return 1;
+
+ if (timerfd_settime(fd, 0, &new_value, NULL) != 0)
+ return 1;
+
+ return 0;
+}