tools/perf/build: Fix detection of non-core features
PATCH 1/2 tools/perf/build: Fix detection of non-core features
feature_check needs to be invoked through call, and LDFLAGS may not be set so quotes are needed.
Thanks to Jiri for spotting the quotes around LDFLAGS; that one was driving me nuts with the upcoming timerfd feature detection.
--- tools/perf/config/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tools/perf/config/Makefile +5 -5
@@ -96,7 +96,7 @@ endif feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS="$(LDFLAGS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code))
@@ -233,7 +233,7 @@ CFLAGS += -I$(LIB_INCLUDE) CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE ifndef NO_BIONIC - $(feature_check,bionic) + $(call feature_check,bionic) ifeq ($(feature-bionic), 1) BIONIC := 1 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
@@ -470,15 +470,15 @@ else CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT else ifneq ($(feature-libbfd), 1) - $(feature_check,liberty) + $(call feature_check,liberty) ifeq ($(feature-liberty), 1) EXTLIBS += -lbfd -liberty else - $(feature_check,liberty-z) + $(call feature_check,liberty-z) ifeq ($(feature-liberty-z), 1) EXTLIBS += -lbfd -liberty -lz else - $(feature_check,cplus-demangle) + $(call feature_check,cplus-demangle) ifeq ($(feature-cplus-demangle), 1) EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
Signature · 1 line
1.7.12.4 (Apple Git-37)
PATCH 2/2 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.
--- tools/perf/builtin-kvm.c | 12 ++++++++++++ tools/perf/config/Makefile | 7 +++++++ tools/perf/config/feature-checks/Makefile | 6 +++++- tools/perf/config/feature-checks/test-all.c | 5 +++++ tools/perf/config/feature-checks/test-timerfd.c | 18 ++++++++++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 tools/perf/config/feature-checks/test-timerfd.c
tools/perf/builtin-kvm.c +12 -0
@@ -20,7 +20,9 @@#include "util/data.h" #include <sys/prctl.h> +#ifdef HAVE_TIMERFD_SUPPORT #include <sys/timerfd.h> +#endif #include <termios.h> #include <semaphore.h>
@@ -337,6 +339,7 @@ static void init_kvm_event_record(struct perf_kvm_stat *kvm)INIT_LIST_HEAD (&kvm->kvm_events_cache[i]); } +#ifdef HAVE_TIMERFD_SUPPORT static void clear_events_cache_stats (struct list_head *kvm_events_cache) {struct list_head *head;
@@ -358,6 +361,7 @@ static void clear_events_cache_stats(struct list_head *kvm_events_cache) } } } +#endif static int kvm_events_hash_fn (u64 key) {
@@ -783,6 +787,7 @@ static void print_result(struct perf_kvm_stat *kvm)pr_info ("\nLost events: %" PRIu64"\n\n" , kvm->lost_events); } +#ifdef HAVE_TIMERFD_SUPPORT static int process_lost_event(struct perf_tool *tool, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused,
@@ -793,6 +798,7 @@ static int process_lost_event(struct perf_tool *tool, kvm->lost_events++; return 0; } +#endif static bool skip_sample (struct perf_kvm_stat *kvm,struct perf_sample *sample)
@@ -872,6 +878,7 @@ static bool verify_vcpu(int vcpu)return true; } +#ifdef HAVE_TIMERFD_SUPPORT /* keeping the max events to a modest level to keep * the processing of samples per mmap smooth. */
@@ -1213,6 +1220,7 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm) out: return rc; } +#endif static int read_events (struct perf_kvm_stat *kvm) {
@@ -1379,6 +1387,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)return kvm_events_report_vcpu (kvm); } +#ifdef HAVE_TIMERFD_SUPPORT static struct perf_evlist *kvm_live_event_list (void ) {struct perf_evlist *evlist;
@@ -1566,6 +1575,7 @@ out: return err; } +#endif static void print_kvm_stat_usage (void ) {
@@ -1604,8 +1614,10 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)if (!strncmp (argv[1 ],"rep" ,3 ))return kvm_events_report (&kvm, argc -1 , argv +1 ); +#ifdef HAVE_TIMERFD_SUPPORT if (!strncmp (argv[1 ],"live" ,4 ))return kvm_events_live (&kvm, argc -1 , argv +1 ); +#endif perf_stat:return cmd_stat (argc, argv,NULL );
tools/perf/config/Makefile +7 -0
@@ -395,6 +395,13 @@ else endif endif +$(call feature_check,timerfd) +ifeq ($(feature-timerfd), 1) + CFLAGS += -DHAVE_TIMERFD_SUPPORT +else + msg := $(warning No timerfd support. Disables 'perf kvm stat live'); +endif + disable-python = $(eval $(disable-python_code)) define disable-python_code CFLAGS += -DNO_LIBPYTHON
tools/perf/config/feature-checks/Makefile +5 -1
@@ -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 ###############################
tools/perf/config/feature-checks/test-all.c +5 -0
@@ -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 ; }
tools/perf/config/feature-checks/test-timerfd.c new file +18 -0
@@ -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 ; +}
Signature · 1 line
1.7.12.4 (Apple Git-37)
Quoted 2 lines · David Ahern
feature_checkneeds to be invoked through call, and LDFLAGS may not be set so quotes are needed.
and the problem is also when there's more than one option in LDFLAGS
Quoted 9 lines
Thanks to Jiri for spotting the quotes around LDFLAGS; that one was driving me nuts with the upcoming timerfd feature detection.
Signed-off-by David Ahern <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Namhyung Kim <[email protected]>Cc Jiri Olsa <[email protected]>
jirka
Re: [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported
In reply to David AhernQuoted 8 lines · David Ahern
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 <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Namhyung Kim <[email protected]>Cc Jiri Olsa <[email protected]>
looks ok,
jirka
Ingo Molnar
Acked-byQuoted 5 lines · Jiri Olsa
Quoted 2 lines · David Ahern
feature_checkneeds to be invoked through call, and LDFLAGS may not be set so quotes are needed.and the problem is also when there's more than one option in LDFLAGS
yeah.
Quoted 10 lines
Quoted 8 lines
Thanks to Jiri for spotting the quotes around LDFLAGS; that one was driving me nuts with the upcoming timerfd feature detection.
Signed-off-by David Ahern <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Namhyung Kim <[email protected]>Cc Jiri Olsa <[email protected]>Reviewed-and-tested-by Jiri Olsa <[email protected]>
Thanks,
Ingo
ping. did not see this one in your last push to Ingo.
Quoted 57 lines · David Ahern
feature_checkneeds to be invoked through call, and LDFLAGS may not be set so quotes are needed.Thanks to Jiri for spotting the quotes around LDFLAGS; that one was driving me nuts with the upcoming timerfd feature detection.
Signed-off-by David Ahern <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Namhyung Kim <[email protected]>Cc Jiri Olsa <[email protected]>--- tools/perf/config/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)tools/perf/config/Makefile +5
-5@@ -96,7 +96,7 @@ endif feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS="$(LDFLAGS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code))@@ -233,7 +233,7 @@ CFLAGS += -I$(LIB_INCLUDE) CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE ifndef NO_BIONIC - $(feature_check,bionic) + $(call feature_check,bionic) ifeq ($(feature-bionic), 1) BIONIC := 1 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))@@ -470,15 +470,15 @@ else CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT else ifneq ($(feature-libbfd), 1) - $(feature_check,liberty) + $(call feature_check,liberty) ifeq ($(feature-liberty), 1) EXTLIBS += -lbfd -liberty else - $(feature_check,liberty-z) + $(call feature_check,liberty-z) ifeq ($(feature-liberty-z), 1) EXTLIBS += -lbfd -liberty -lz else - $(feature_check,cplus-demangle) + $(call feature_check,cplus-demangle) ifeq ($(feature-cplus-demangle), 1) EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
Re: [PATCH 2/2] perf kvm: Disable live command if timerfd is not supported
In reply to David Ahernditto
Quoted 196 lines · David Ahern
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 <[email protected]>Cc Ingo Molnar <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Namhyung Kim <[email protected]>Cc Jiri Olsa <[email protected]>--- tools/perf/builtin-kvm.c | 12 ++++++++++++ tools/perf/config/Makefile | 7 +++++++ tools/perf/config/feature-checks/Makefile | 6 +++++- tools/perf/config/feature-checks/test-all.c | 5 +++++ tools/perf/config/feature-checks/test-timerfd.c | 18 ++++++++++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-)create mode 100644
tools/perf/config/feature-checks/test-timerfd.ctools/perf/builtin-kvm.c +12
-0@@ -20,7 +20,9 @@#include "util/data.h" #include <sys/prctl.h> +#ifdef HAVE_TIMERFD_SUPPORT #include <sys/timerfd.h> +#endif #include <termios.h> #include <semaphore.h> @@ -337,6 +339,7 @@ static void init_kvm_event_record(struct perf_kvm_stat *kvm)INIT_LIST_HEAD (&kvm->kvm_events_cache[i]); } +#ifdef HAVE_TIMERFD_SUPPORT static void clear_events_cache_stats (struct list_head *kvm_events_cache) {struct list_head *head;@@ -358,6 +361,7 @@ static void clear_events_cache_stats(struct list_head *kvm_events_cache) } } } +#endif static int kvm_events_hash_fn (u64 key) {@@ -783,6 +787,7 @@ static void print_result(struct perf_kvm_stat *kvm)pr_info ("\nLost events: %" PRIu64"\n\n" , kvm->lost_events); } +#ifdef HAVE_TIMERFD_SUPPORT static int process_lost_event(struct perf_tool *tool, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused,@@ -793,6 +798,7 @@ static int process_lost_event(struct perf_tool *tool, kvm->lost_events++; return 0; } +#endif static bool skip_sample (struct perf_kvm_stat *kvm,struct perf_sample *sample)@@ -872,6 +878,7 @@ static bool verify_vcpu(int vcpu)return true; } +#ifdef HAVE_TIMERFD_SUPPORT /* keeping the max events to a modest level to keep * the processing of samples per mmap smooth. */ @@ -1213,6 +1220,7 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm) out: return rc; } +#endif static int read_events (struct perf_kvm_stat *kvm) {@@ -1379,6 +1387,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)return kvm_events_report_vcpu (kvm); } +#ifdef HAVE_TIMERFD_SUPPORT static struct perf_evlist *kvm_live_event_list (void ) {struct perf_evlist *evlist;@@ -1566,6 +1575,7 @@ out: return err; } +#endif static void print_kvm_stat_usage (void ) {@@ -1604,8 +1614,10 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)if (!strncmp (argv[1 ],"rep" ,3 ))return kvm_events_report (&kvm, argc -1 , argv +1 ); +#ifdef HAVE_TIMERFD_SUPPORT if (!strncmp (argv[1 ],"live" ,4 ))return kvm_events_live (&kvm, argc -1 , argv +1 ); +#endif perf_stat:return cmd_stat (argc, argv,NULL );tools/perf/config/Makefile +7
-0@@ -395,6 +395,13 @@ else endif endif +$(call feature_check,timerfd) +ifeq ($(feature-timerfd), 1) + CFLAGS += -DHAVE_TIMERFD_SUPPORT +else + msg := $(warning No timerfd support. Disables 'perf kvm stat live'); +endif + disable-python = $(eval $(disable-python_code)) define disable-python_code CFLAGS += -DNO_LIBPYTHONtools/perf/config/feature-checks/Makefile +5
-1@@ -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 ###############################tools/perf/config/feature-checks/test-all.c +5
-0@@ -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 ; }tools/perf/config/feature-checks/test-timerfd.c new file +18
-0@@ -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 ; +}
tip-bot for David Ahern
merge bottools/perf/build: Fix detection of non-core features
Commit-ID: 5febff0066b8111785d58903b54d414e9ec6a3d0 Gitweb: http://git.kernel.org/tip/5febff0066b8111785d58903b54d414e9ec6a3d0 Author: David Ahern <[email protected]> AuthorDate: Tue, 29 Oct 2013 10:43:15 -0600 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 5 Nov 2013 10:08:03 -0300
tools/perf/build: Fix detection of non-core features
feature_check needs to be invoked through call, and LDFLAGS may not be set so quotes are needed.
Thanks to Jiri for spotting the quotes around LDFLAGS; that one was driving me nuts with the upcoming timerfd feature detection.
--- tools/perf/config/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tools/perf/config/Makefile +5 -5
@@ -98,7 +98,7 @@ endif feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code))
@@ -235,7 +235,7 @@ CFLAGS += -I$(LIB_INCLUDE) CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE ifndef NO_BIONIC - $(feature_check,bionic) + $(call feature_check,bionic) ifeq ($(feature-bionic), 1) BIONIC := 1 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
@@ -479,15 +479,15 @@ else CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT else ifneq ($(feature-libbfd), 1) - $(feature_check,liberty) + $(call feature_check,liberty) ifeq ($(feature-liberty), 1) EXTLIBS += -lbfd -liberty else - $(feature_check,liberty-z) + $(call feature_check,liberty-z) ifeq ($(feature-liberty-z), 1) EXTLIBS += -lbfd -liberty -lz else - $(feature_check,cplus-demangle) + $(call feature_check,cplus-demangle) ifeq ($(feature-cplus-demangle), 1) EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
tip-bot for David Ahern
merge bot[tip:perf/core] perf kvm: Disable live command if timerfd is not supported
In reply to David Ahernperf kvm: Disable live command if timerfd is not supported
Commit-ID: 87419c9afff1431d4b62b388baf6bfa07e0b14ff Gitweb: http://git.kernel.org/tip/87419c9afff1431d4b62b388baf6bfa07e0b14ff Author: David Ahern <[email protected]> AuthorDate: Tue, 29 Oct 2013 10:43:16 -0600 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 5 Nov 2013 10:03:22 -0300
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.
--- tools/perf/builtin-kvm.c | 12 ++++++++++++ tools/perf/config/Makefile | 7 +++++++ tools/perf/config/feature-checks/Makefile | 6 +++++- tools/perf/config/feature-checks/test-all.c | 5 +++++ tools/perf/config/feature-checks/test-timerfd.c | 18 ++++++++++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-)
tools/perf/builtin-kvm.c +12 -0
@@ -20,7 +20,9 @@#include "util/data.h" #include <sys/prctl.h> +#ifdef HAVE_TIMERFD_SUPPORT #include <sys/timerfd.h> +#endif #include <termios.h> #include <semaphore.h>
@@ -337,6 +339,7 @@ static void init_kvm_event_record(struct perf_kvm_stat *kvm)INIT_LIST_HEAD (&kvm->kvm_events_cache[i]); } +#ifdef HAVE_TIMERFD_SUPPORT static void clear_events_cache_stats (struct list_head *kvm_events_cache) {struct list_head *head;
@@ -358,6 +361,7 @@ static void clear_events_cache_stats(struct list_head *kvm_events_cache) } } } +#endif static int kvm_events_hash_fn (u64 key) {
@@ -783,6 +787,7 @@ static void print_result(struct perf_kvm_stat *kvm)pr_info ("\nLost events: %" PRIu64"\n\n" , kvm->lost_events); } +#ifdef HAVE_TIMERFD_SUPPORT static int process_lost_event(struct perf_tool *tool, union perf_event *event __maybe_unused, struct perf_sample *sample __maybe_unused,
@@ -793,6 +798,7 @@ static int process_lost_event(struct perf_tool *tool, kvm->lost_events++; return 0; } +#endif static bool skip_sample (struct perf_kvm_stat *kvm,struct perf_sample *sample)
@@ -872,6 +878,7 @@ static bool verify_vcpu(int vcpu)return true; } +#ifdef HAVE_TIMERFD_SUPPORT /* keeping the max events to a modest level to keep * the processing of samples per mmap smooth. */
@@ -1213,6 +1220,7 @@ static int kvm_live_open_events(struct perf_kvm_stat *kvm) out: return rc; } +#endif static int read_events (struct perf_kvm_stat *kvm) {
@@ -1379,6 +1387,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)return kvm_events_report_vcpu (kvm); } +#ifdef HAVE_TIMERFD_SUPPORT static struct perf_evlist *kvm_live_event_list (void ) {struct perf_evlist *evlist;
@@ -1566,6 +1575,7 @@ out: return err; } +#endif static void print_kvm_stat_usage (void ) {
@@ -1604,8 +1614,10 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)if (!strncmp (argv[1 ],"rep" ,3 ))return kvm_events_report (&kvm, argc -1 , argv +1 ); +#ifdef HAVE_TIMERFD_SUPPORT if (!strncmp (argv[1 ],"live" ,4 ))return kvm_events_live (&kvm, argc -1 , argv +1 ); +#endif perf_stat:return cmd_stat (argc, argv,NULL );
tools/perf/config/Makefile +7 -0
@@ -397,6 +397,13 @@ else endif endif +$(call feature_check,timerfd) +ifeq ($(feature-timerfd), 1) + CFLAGS += -DHAVE_TIMERFD_SUPPORT +else + msg := $(warning No timerfd support. Disables 'perf kvm stat live'); +endif + disable-python = $(eval $(disable-python_code)) define disable-python_code CFLAGS += -DNO_LIBPYTHON
tools/perf/config/feature-checks/Makefile +5 -1
@@ -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 ###############################
tools/perf/config/feature-checks/test-all.c +5 -0
@@ -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 ; }
tools/perf/config/feature-checks/test-timerfd.c new file +18 -0
@@ -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 ; +}