linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Peter Hurley <peter@hurleysoftware.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 12/21] perf tools: Make numa benchmark optional
Date: Wed, 30 Jan 2013 11:46:53 -0300	[thread overview]
Message-ID: <1359557222-17547-13-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1359557222-17547-1-git-send-email-acme@infradead.org>

From: Peter Hurley <peter@hurleysoftware.com>

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>
---
 tools/perf/Makefile                 | 16 ++++++++++++++--
 tools/perf/builtin-bench.c          |  4 ++++
 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 b62dbc0..4b1044c 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -47,6 +47,8 @@ include config/utilities.mak
 # backtrace post unwind.
 #
 # Define NO_BACKTRACE if you do not want stack backtrace debug feature
+#
+# Define NO_LIBNUMA if you do not want numa perf benchmark
 
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -103,7 +105,7 @@ ifdef PARSER_DEBUG
 endif
 
 CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
-EXTLIBS = -lpthread -lrt -lelf -lm -lnuma
+EXTLIBS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
@@ -492,7 +494,6 @@ LIB_OBJS += $(OUTPUT)tests/python-use.o
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
 # Benchmark modules
-BUILTIN_OBJS += $(OUTPUT)bench/numa.o
 BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
 BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
 ifeq ($(RAW_ARCH),x86_64)
@@ -839,6 +840,17 @@ ifndef NO_BACKTRACE
        endif
 endif
 
+ifndef NO_LIBNUMA
+	FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma
+	ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
+		msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev);
+	else
+		BASIC_CFLAGS += -DLIBNUMA_SUPPORT
+		BUILTIN_OBJS += $(OUTPUT)bench/numa.o
+		EXTLIBS += -lnuma
+	endif
+endif
+
 ifdef ASCIIDOC8
 	export ASCIIDOC8
 endif
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index e5d514b..77298bf 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -35,6 +35,7 @@ struct bench_suite {
 /* sentinel: easy for help */
 #define suite_all { "all", "Test all benchmark suites", NULL }
 
+#ifdef LIBNUMA_SUPPORT
 static struct bench_suite numa_suites[] = {
 	{ "mem",
 	  "Benchmark for NUMA workloads",
@@ -44,6 +45,7 @@ static struct bench_suite numa_suites[] = {
 	  NULL,
 	  NULL                  }
 };
+#endif
 
 static struct bench_suite sched_suites[] = {
 	{ "messaging",
@@ -78,9 +80,11 @@ struct bench_subsys {
 };
 
 static struct bench_subsys subsystems[] = {
+#ifdef LIBNUMA_SUPPORT
 	{ "numa",
 	  "NUMA scheduling and MM behavior",
 	  numa_suites },
+#endif
 	{ "sched",
 	  "scheduler and IPC mechanism",
 	  sched_suites },
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index f5ac774..b4eabb4 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -225,3 +225,14 @@ int main(void)
 	return on_exit(NULL, NULL);
 }
 endef
+
+define SOURCE_LIBNUMA
+#include <numa.h>
+#include <numaif.h>
+
+int main(void)
+{
+	numa_available();
+	return 0;
+}
+endef
\ No newline at end of file
-- 
1.8.1.1.361.gec3ae6e


  parent reply	other threads:[~2013-01-30 14:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-30 14:46 [GIT PULL 00/21] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 01/21] tools lib traceevent: Handle dynamic array's element size properly Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 02/21] perf tools: Stop using 'self' in strlist Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 03/21] perf tools: Stop using 'self' in map.[ch] Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 04/21] perf tools: Use memdup in map__clone Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 05/21] perf kmem: Use memdup() Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 06/21] perf header: Stop using die() calls when processing tracing data Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 07/21] perf ui browser: Free browser->helpline() on ui_browser__hide() Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 08/21] perf tests: Call machine__exit in the vmlinux matches kallsyms test Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 09/21] perf tests: Fix leaks on PERF_RECORD_* test Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 10/21] tools: Correct typo in tools Makefile Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 11/21] perf: Add 'perf bench numa mem' NUMA performance measurement suite Arnaldo Carvalho de Melo
2013-01-30 14:46 ` Arnaldo Carvalho de Melo [this message]
2013-01-30 14:46 ` [PATCH 13/21] perf evsel: Add prev_raw_count field Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 14/21] perf stat: Add interval printing Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 15/21] perf evsel: Fix memory leaks on evsel->counts Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 16/21] perf tools, powerpc: Fix compile warnings in tests/attr.c Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 17/21] perf tools: Fix possible double free on error Arnaldo Carvalho de Melo
2013-01-30 14:46 ` [PATCH 18/21] perf sort: Use pclose() instead of fclose() on pipe stream Arnaldo Carvalho de Melo
2013-01-30 14:47 ` [PATCH 19/21] perf tools: Fix memory leak on error Arnaldo Carvalho de Melo
2013-01-30 14:47 ` [PATCH 20/21] perf header: Fix memory leak for the "Not caching a kptr_restrict'ed /proc/kallsyms" case Arnaldo Carvalho de Melo
2013-01-30 14:47 ` [PATCH 21/21] perf header: Fix double fclose() on do_write(fd, xxx) failure Arnaldo Carvalho de Melo
2013-01-31  9:27 ` [GIT PULL 00/21] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359557222-17547-13-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peter@hurleysoftware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).