diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2013-01-27 20:51:22 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-01-30 08:36:21 -0500 |
commit | 79d824e31692d165f6c7d92bf4d1af0b9d969d76 (patch) | |
tree | 9bfae3b337f15579a1ec4ae43ed6295ad3932ffc /tools | |
parent | 1c13f3c9042f9d222959af7c9da6db93ea9f7e4c (diff) |
perf tools: Make numa benchmark optional
Commit "perf: Add 'perf bench numa mem'..." added a NUMA performance
benchmark to perf. Make this optional and test for required
dependencies.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1359337882-21821-1-git-send-email-peter@hurleysoftware.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/Makefile | 16 | ||||
-rw-r--r-- | tools/perf/builtin-bench.c | 4 | ||||
-rw-r--r-- | tools/perf/config/feature-tests.mak | 11 |
3 files changed, 29 insertions, 2 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index b62dbc0d974a..4b1044cbd84c 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -47,6 +47,8 @@ include config/utilities.mak | |||
47 | # backtrace post unwind. | 47 | # backtrace post unwind. |
48 | # | 48 | # |
49 | # Define NO_BACKTRACE if you do not want stack backtrace debug feature | 49 | # Define NO_BACKTRACE if you do not want stack backtrace debug feature |
50 | # | ||
51 | # Define NO_LIBNUMA if you do not want numa perf benchmark | ||
50 | 52 | ||
51 | $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE | 53 | $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE |
52 | @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) | 54 | @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) |
@@ -103,7 +105,7 @@ ifdef PARSER_DEBUG | |||
103 | endif | 105 | endif |
104 | 106 | ||
105 | CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS) | 107 | CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS) |
106 | EXTLIBS = -lpthread -lrt -lelf -lm -lnuma | 108 | EXTLIBS = -lpthread -lrt -lelf -lm |
107 | ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE | 109 | ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
108 | ALL_LDFLAGS = $(LDFLAGS) | 110 | ALL_LDFLAGS = $(LDFLAGS) |
109 | STRIP ?= strip | 111 | STRIP ?= strip |
@@ -492,7 +494,6 @@ LIB_OBJS += $(OUTPUT)tests/python-use.o | |||
492 | BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o | 494 | BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o |
493 | BUILTIN_OBJS += $(OUTPUT)builtin-bench.o | 495 | BUILTIN_OBJS += $(OUTPUT)builtin-bench.o |
494 | # Benchmark modules | 496 | # Benchmark modules |
495 | BUILTIN_OBJS += $(OUTPUT)bench/numa.o | ||
496 | BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o | 497 | BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o |
497 | BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o | 498 | BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o |
498 | ifeq ($(RAW_ARCH),x86_64) | 499 | ifeq ($(RAW_ARCH),x86_64) |
@@ -839,6 +840,17 @@ ifndef NO_BACKTRACE | |||
839 | endif | 840 | endif |
840 | endif | 841 | endif |
841 | 842 | ||
843 | ifndef NO_LIBNUMA | ||
844 | FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma | ||
845 | ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y) | ||
846 | msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev); | ||
847 | else | ||
848 | BASIC_CFLAGS += -DLIBNUMA_SUPPORT | ||
849 | BUILTIN_OBJS += $(OUTPUT)bench/numa.o | ||
850 | EXTLIBS += -lnuma | ||
851 | endif | ||
852 | endif | ||
853 | |||
842 | ifdef ASCIIDOC8 | 854 | ifdef ASCIIDOC8 |
843 | export ASCIIDOC8 | 855 | export ASCIIDOC8 |
844 | endif | 856 | endif |
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c index e5d514bf5365..77298bf892b8 100644 --- a/tools/perf/builtin-bench.c +++ b/tools/perf/builtin-bench.c | |||
@@ -35,6 +35,7 @@ struct bench_suite { | |||
35 | /* sentinel: easy for help */ | 35 | /* sentinel: easy for help */ |
36 | #define suite_all { "all", "Test all benchmark suites", NULL } | 36 | #define suite_all { "all", "Test all benchmark suites", NULL } |
37 | 37 | ||
38 | #ifdef LIBNUMA_SUPPORT | ||
38 | static struct bench_suite numa_suites[] = { | 39 | static struct bench_suite numa_suites[] = { |
39 | { "mem", | 40 | { "mem", |
40 | "Benchmark for NUMA workloads", | 41 | "Benchmark for NUMA workloads", |
@@ -44,6 +45,7 @@ static struct bench_suite numa_suites[] = { | |||
44 | NULL, | 45 | NULL, |
45 | NULL } | 46 | NULL } |
46 | }; | 47 | }; |
48 | #endif | ||
47 | 49 | ||
48 | static struct bench_suite sched_suites[] = { | 50 | static struct bench_suite sched_suites[] = { |
49 | { "messaging", | 51 | { "messaging", |
@@ -78,9 +80,11 @@ struct bench_subsys { | |||
78 | }; | 80 | }; |
79 | 81 | ||
80 | static struct bench_subsys subsystems[] = { | 82 | static struct bench_subsys subsystems[] = { |
83 | #ifdef LIBNUMA_SUPPORT | ||
81 | { "numa", | 84 | { "numa", |
82 | "NUMA scheduling and MM behavior", | 85 | "NUMA scheduling and MM behavior", |
83 | numa_suites }, | 86 | numa_suites }, |
87 | #endif | ||
84 | { "sched", | 88 | { "sched", |
85 | "scheduler and IPC mechanism", | 89 | "scheduler and IPC mechanism", |
86 | sched_suites }, | 90 | sched_suites }, |
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak index f5ac77485a4f..b4eabb44e381 100644 --- a/tools/perf/config/feature-tests.mak +++ b/tools/perf/config/feature-tests.mak | |||
@@ -225,3 +225,14 @@ int main(void) | |||
225 | return on_exit(NULL, NULL); | 225 | return on_exit(NULL, NULL); |
226 | } | 226 | } |
227 | endef | 227 | endef |
228 | |||
229 | define SOURCE_LIBNUMA | ||
230 | #include <numa.h> | ||
231 | #include <numaif.h> | ||
232 | |||
233 | int main(void) | ||
234 | { | ||
235 | numa_available(); | ||
236 | return 0; | ||
237 | } | ||
238 | endef \ No newline at end of file | ||