linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 00/23] perf/core improvements and fixes
@ 2015-10-19 21:39 Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 01/23] perf test: Silence tracepoint event failures Arnaldo Carvalho de Melo
                   ` (23 more replies)
  0 siblings, 24 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Andrew Morton, David Ahern, Hitoshi Mitake, Jiri Olsa, Kan Liang,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra,
	Ramkumar Ramachandra, Sriram Raghunathan, Thomas Gleixner,
	Wang Nan, Yunlong Song, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit e9363deeb286e916353f11b11d1f351c6ff54082:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-10-14 15:06:33 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo

for you to fetch changes up to a4c6a3e8bbb675a601f529881c51ff226f83c3f1:

  perf bench: Use named initializers in the trailer too (2015-10-19 18:17:25 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

- 'perf bench mem' now prefaults unconditionally, no sense in
  providing modes where page faults are measured (Ingo Molnar)

- Harmonize -l/--nr_loops accross 'perf bench' (Ingo Molnar)

- Various 'perf bench' consistency improvements (Ingo Molnar)

- Suppress libtraceevent warnings in non-verbose 'perf test' mode
  (Namhyung Kim)

- Move some tracepoint event test error messages to the verbose mode
  of 'perf test' (Namhyung Kim)

- Make 'perf help' usage message consistent with other tools (Yunlong Song)

Build fixes:

- Fix 'perf bench' build with gcc 4.4.7 (Arnaldo Carvalho de Melo)

Infrastructure:

- 'perf stat' prep work for the 'perf stat scripting' patchkit (Jiri Olsa)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (1):
      perf bench: Use named initializers in the trailer too

Ingo Molnar (14):
      perf bench: Improve the 'perf bench mem memcpy' code readability
      perf bench: Default to all routines in 'perf bench mem'
      perf bench: Eliminate unused argument from bench_mem_common()
      perf bench: Rename 'mem-memcpy.c' => 'mem-functions.c'
      perf bench: Remove the prefaulting complication from 'perf bench mem mem*'
      perf bench: List output formatting options on 'perf bench -h'
      perf bench mem: Change 'cycle' to 'cycles'
      perf bench mem: Rename 'routine' to 'routine_str'
      perf bench mem: Fix 'length' vs. 'size' naming confusion
      perf bench mem: Improve user visible strings
      perf bench mem: Reorganize the code a bit
      perf bench: Harmonize all the -l/--nr_loops options
      perf bench mem: Rename 'routine' to 'function'
      perf bench: Run benchmarks, don't test them

Jiri Olsa (5):
      perf stat: Rename perf_stat struct into perf_stat_evsel
      perf stat: Add AGGR_UNSET mode
      perf cpu_map: Make cpu_map__build_map global
      perf cpu_map: Add data arg to cpu_map__build_map callback
      perf script: Check output fields only for samples

Namhyung Kim (2):
      perf test: Silence tracepoint event failures
      perf test: Suppress libtraceevent warnings

Yunlong Song (1):
      perf help: Change 'usage' to 'Usage' for consistency

 tools/perf/Documentation/perf-bench.txt     |  54 ++--
 tools/perf/bench/Build                      |   2 +-
 tools/perf/bench/mem-functions.c            | 379 ++++++++++++++++++++++++
 tools/perf/bench/mem-memcpy.c               | 434 ----------------------------
 tools/perf/bench/numa.c                     |   4 +-
 tools/perf/bench/sched-messaging.c          |  10 +-
 tools/perf/builtin-bench.c                  |  14 +-
 tools/perf/builtin-help.c                   |   2 +-
 tools/perf/builtin-script.c                 |   5 +-
 tools/perf/builtin-stat.c                   |  23 +-
 tools/perf/tests/openat-syscall-all-cpus.c  |   2 +-
 tools/perf/tests/openat-syscall-tp-fields.c |   2 +-
 tools/perf/tests/openat-syscall.c           |   2 +-
 tools/perf/tests/parse-events.c             |  14 +
 tools/perf/tests/topology.c                 |   4 +-
 tools/perf/util/cpumap.c                    |  17 +-
 tools/perf/util/cpumap.h                    |   7 +-
 tools/perf/util/parse-options.c             |   4 +-
 tools/perf/util/stat.c                      |  13 +-
 tools/perf/util/stat.h                      |   3 +-
 tools/perf/util/usage.c                     |   5 +
 tools/perf/util/util.h                      |   1 +
 22 files changed, 487 insertions(+), 514 deletions(-)
 create mode 100644 tools/perf/bench/mem-functions.c
 delete mode 100644 tools/perf/bench/mem-memcpy.c

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 01/23] perf test: Silence tracepoint event failures
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 02/23] perf test: Suppress libtraceevent warnings Arnaldo Carvalho de Melo
                   ` (22 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Jiri Olsa, Peter Zijlstra, Wang Nan,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

Currently, when 'perf test' is run by a normal user, it'll fail to
access tracepoint events.  The output becomes somewhat messy because it
tries to be nice with long error messages and hints.

IMHO this is not needed for 'perf test' by default and AFAIK 'perf test'
uses pr_debug() rather than pr_err() for such messages so that one can
use -v option to see further details on failed testcases if needed.

Before:
  $ perf test
   1: vmlinux symtab matches kallsyms                          : FAILED!
   2: detect openat syscall event                              :Error:
  No permissions to read
  /sys/kernel/debug/tracing/events/syscalls/sys_enter_openat
  Hint:	Try 'sudo mount -o remount,mode=755 /sys/kernel/debug/tracing'
  FAILED!
   3: detect openat syscall event on all cpus                  :Error:
  No permissions to read
  /sys/kernel/debug/tracing/events/syscalls/sys_enter_openat
  Hint:	Try 'sudo mount -o remount,mode=755 /sys/kernel/debug/tracing'
  FAILED!
   ...

After:
  $ perf test
   1: vmlinux symtab matches kallsyms                          : FAILED!
   2: detect openat syscall event                              : FAILED!
   3: detect openat syscall event on all cpus                  : FAILED!
   ...

  $ perf test -v 2
   2: detect openat syscall event                              :
  --- start ---
  test child forked, pid 30575
  Error:	    No permissions to read
  /sys/kernel/debug/tracing/events/syscalls/sys_enter_openat
  Hint:  Try 'sudo mount -o remount,mode=755 /sys/kernel/debug/tracing'

  test child finished with -1
  ---- end ----
  detect openat syscall event: FAILED!

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1445268229-1601-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/openat-syscall-all-cpus.c  | 2 +-
 tools/perf/tests/openat-syscall-tp-fields.c | 2 +-
 tools/perf/tests/openat-syscall.c           | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c
index 9e104a2e973d..2006485a2859 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -34,7 +34,7 @@ int test__openat_syscall_event_on_all_cpus(void)
 	evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
 	if (IS_ERR(evsel)) {
 		tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat");
-		pr_err("%s\n", errbuf);
+		pr_debug("%s\n", errbuf);
 		goto out_thread_map_delete;
 	}
 
diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests/openat-syscall-tp-fields.c
index 473d3869727e..5e811cd8f1c3 100644
--- a/tools/perf/tests/openat-syscall-tp-fields.c
+++ b/tools/perf/tests/openat-syscall-tp-fields.c
@@ -89,7 +89,7 @@ int test__syscall_openat_tp_fields(void)
 
 				err = perf_evsel__parse_sample(evsel, event, &sample);
 				if (err) {
-					pr_err("Can't parse sample, err = %d\n", err);
+					pr_debug("Can't parse sample, err = %d\n", err);
 					goto out_delete_evlist;
 				}
 
diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c
index 7b1db8306098..033b54797b8a 100644
--- a/tools/perf/tests/openat-syscall.c
+++ b/tools/perf/tests/openat-syscall.c
@@ -22,7 +22,7 @@ int test__openat_syscall_event(void)
 	evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
 	if (IS_ERR(evsel)) {
 		tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat");
-		pr_err("%s\n", errbuf);
+		pr_debug("%s\n", errbuf);
 		goto out_thread_map_delete;
 	}
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 02/23] perf test: Suppress libtraceevent warnings
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 01/23] perf test: Silence tracepoint event failures Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 03/23] perf bench: Improve the 'perf bench mem memcpy' code readability Arnaldo Carvalho de Melo
                   ` (21 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Jiri Olsa, Peter Zijlstra, Wang Nan,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

Currently libtraceevent emits warning on unsupported event formats.
However it'd be better to see them only -v option is given.  To do that,
it needs to override the warning() function which is used in the
libtracevent.  Thus add set_warning_routine() same as set_die_routine()
and check the verbose flag in our warning routine.

Before:
  # perf test 5
   5: parse events tests                                       :
    Warning: [kvmmmu:kvm_mmu_get_page] bad op token {
    Warning: [kvmmmu:kvm_mmu_sync_page] bad op token {
    Warning: [kvmmmu:kvm_mmu_unsync_page] bad op token {
    Warning: [kvmmmu:kvm_mmu_prepare_zap_page] bad op token {
    Warning: [kvmmmu:fast_page_fault] function is_writable_pte not defined
    ...
   Ok

After:
  # perf test 5
   5: parse events tests                                       : Ok

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1445268229-1601-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/parse-events.c | 14 ++++++++++++++
 tools/perf/util/usage.c         |  5 +++++
 tools/perf/util/util.h          |  1 +
 3 files changed, 20 insertions(+)

diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 0648b84a9171..636d7b42d844 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -5,6 +5,7 @@
 #include <api/fs/fs.h>
 #include "tests.h"
 #include "debug.h"
+#include "util.h"
 #include <linux/hw_breakpoint.h>
 #include <api/fs/fs.h>
 
@@ -1753,6 +1754,17 @@ static int test_pmu_events(void)
 	return ret;
 }
 
+static void debug_warn(const char *warn, va_list params)
+{
+	char msg[1024];
+
+	if (!verbose)
+		return;
+
+	vsnprintf(msg, sizeof(msg), warn, params);
+	fprintf(stderr, " Warning: %s\n", msg);
+}
+
 int test__parse_events(void)
 {
 	int ret1, ret2 = 0;
@@ -1764,6 +1776,8 @@ do {							\
 		ret2 = ret1;				\
 } while (0)
 
+	set_warning_routine(debug_warn);
+
 	TEST_EVENTS(test__events);
 
 	if (test_pmu())
diff --git a/tools/perf/util/usage.c b/tools/perf/util/usage.c
index 4007aca8e0ca..6adfa18cdd4e 100644
--- a/tools/perf/util/usage.c
+++ b/tools/perf/util/usage.c
@@ -50,6 +50,11 @@ void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN)
 	die_routine = routine;
 }
 
+void set_warning_routine(void (*routine)(const char *err, va_list params))
+{
+	warn_routine = routine;
+}
+
 void usage(const char *err)
 {
 	usage_routine(err);
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 3d5b01e8978f..4cfb913aa9e0 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -145,6 +145,7 @@ extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)))
 
 
 extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN);
+extern void set_warning_routine(void (*routine)(const char *err, va_list params));
 
 extern int prefixcmp(const char *str, const char *prefix);
 extern void set_buildid_dir(const char *dir);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 03/23] perf bench: Improve the 'perf bench mem memcpy' code readability
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 01/23] perf test: Silence tracepoint event failures Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 02/23] perf test: Suppress libtraceevent warnings Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 04/23] perf bench: Default to all routines in 'perf bench mem' Arnaldo Carvalho de Melo
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Andrew Morton, David Ahern, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

 - improve the readability of initializations
 - fix unnecessary double negations
 - fix ugly line breaks
 - fix other small details

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-2-git-send-email-mingo@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/mem-memcpy.c | 101 +++++++++++++++++++-----------------------
 1 file changed, 45 insertions(+), 56 deletions(-)

diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-memcpy.c
index d3dfb7936dcd..27606ff5c4f9 100644
--- a/tools/perf/bench/mem-memcpy.c
+++ b/tools/perf/bench/mem-memcpy.c
@@ -1,7 +1,7 @@
 /*
  * mem-memcpy.c
  *
- * memcpy: Simple memory copy in various ways
+ * Simple memcpy() and memset() benchmarks
  *
  * Written by Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
  */
@@ -61,20 +61,17 @@ struct routine {
 };
 
 struct routine memcpy_routines[] = {
-	{ .name = "default",
-	  .desc = "Default memcpy() provided by glibc",
-	  .fn.memcpy = memcpy },
-#ifdef HAVE_ARCH_X86_64_SUPPORT
-
-#define MEMCPY_FN(_fn, _name, _desc) {.name = _name, .desc = _desc, .fn.memcpy = _fn},
-#include "mem-memcpy-x86-64-asm-def.h"
-#undef MEMCPY_FN
+	{ .name		= "default",
+	  .desc		= "Default memcpy() provided by glibc",
+	  .fn.memcpy	= memcpy },
 
+#ifdef HAVE_ARCH_X86_64_SUPPORT
+# define MEMCPY_FN(_fn, _name, _desc) {.name = _name, .desc = _desc, .fn.memcpy = _fn},
+# include "mem-memcpy-x86-64-asm-def.h"
+# undef MEMCPY_FN
 #endif
 
-	{ NULL,
-	  NULL,
-	  {NULL}   }
+	{ NULL, }
 };
 
 static const char * const bench_mem_memcpy_usage[] = {
@@ -89,8 +86,7 @@ static struct perf_event_attr cycle_attr = {
 
 static void init_cycle(void)
 {
-	cycle_fd = sys_perf_event_open(&cycle_attr, getpid(), -1, -1,
-				       perf_event_open_cloexec_flag());
+	cycle_fd = sys_perf_event_open(&cycle_attr, getpid(), -1, -1, perf_event_open_cloexec_flag());
 
 	if (cycle_fd < 0 && errno == ENOSYS)
 		die("No CONFIG_PERF_EVENTS=y kernel support configured?\n");
@@ -111,12 +107,9 @@ static u64 get_cycle(void)
 
 static double timeval2double(struct timeval *ts)
 {
-	return (double)ts->tv_sec +
-		(double)ts->tv_usec / (double)1000000;
+	return (double)ts->tv_sec + (double)ts->tv_usec / (double)1000000;
 }
 
-#define pf (no_prefault ? 0 : 1)
-
 #define print_bps(x) do {					\
 		if (x < K)					\
 			printf(" %14lf B/Sec", x);		\
@@ -140,6 +133,7 @@ static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t l
 	const struct routine *r = &info->routines[r_idx];
 	double result_bps[2];
 	u64 result_cycle[2];
+	int prefault = no_prefault ? 0 : 1;
 
 	result_cycle[0] = result_cycle[1] = 0ULL;
 	result_bps[0] = result_bps[1] = 0.0;
@@ -149,8 +143,8 @@ static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t l
 	if (bench_format == BENCH_FORMAT_DEFAULT)
 		printf("# Copying %s Bytes ...\n\n", length_str);
 
-	if (!only_prefault && !no_prefault) {
-		/* show both of results */
+	if (!only_prefault && prefault) {
+		/* Show both results: */
 		if (use_cycle) {
 			result_cycle[0] = info->do_cycle(r, len, false);
 			result_cycle[1] = info->do_cycle(r, len, true);
@@ -160,14 +154,14 @@ static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t l
 		}
 	} else {
 		if (use_cycle)
-			result_cycle[pf] = info->do_cycle(r, len, only_prefault);
+			result_cycle[prefault] = info->do_cycle(r, len, only_prefault);
 		else
-			result_bps[pf] = info->do_gettimeofday(r, len, only_prefault);
+			result_bps[prefault] = info->do_gettimeofday(r, len, only_prefault);
 	}
 
 	switch (bench_format) {
 	case BENCH_FORMAT_DEFAULT:
-		if (!only_prefault && !no_prefault) {
+		if (!only_prefault && prefault) {
 			if (use_cycle) {
 				printf(" %14lf Cycle/Byte\n",
 					(double)result_cycle[0]
@@ -184,16 +178,16 @@ static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t l
 		} else {
 			if (use_cycle) {
 				printf(" %14lf Cycle/Byte",
-					(double)result_cycle[pf]
+					(double)result_cycle[prefault]
 					/ totallen);
 			} else
-				print_bps(result_bps[pf]);
+				print_bps(result_bps[prefault]);
 
 			printf("%s\n", only_prefault ? " (with prefault)" : "");
 		}
 		break;
 	case BENCH_FORMAT_SIMPLE:
-		if (!only_prefault && !no_prefault) {
+		if (!only_prefault && prefault) {
 			if (use_cycle) {
 				printf("%lf %lf\n",
 					(double)result_cycle[0] / totallen,
@@ -204,14 +198,14 @@ static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t l
 			}
 		} else {
 			if (use_cycle) {
-				printf("%lf\n", (double)result_cycle[pf]
+				printf("%lf\n", (double)result_cycle[prefault]
 					/ totallen);
 			} else
-				printf("%lf\n", result_bps[pf]);
+				printf("%lf\n", result_bps[prefault]);
 		}
 		break;
 	default:
-		/* reaching this means there's some disaster: */
+		/* Reaching this means there's some disaster: */
 		die("unknown format: %d\n", bench_format);
 		break;
 	}
@@ -225,8 +219,7 @@ static int bench_mem_common(int argc, const char **argv,
 	size_t len;
 	double totallen;
 
-	argc = parse_options(argc, argv, options,
-			     info->usage, 0);
+	argc = parse_options(argc, argv, options, info->usage, 0);
 
 	if (no_prefault && only_prefault) {
 		fprintf(stderr, "Invalid options: -o and -n are mutually exclusive\n");
@@ -244,7 +237,7 @@ static int bench_mem_common(int argc, const char **argv,
 		return 1;
 	}
 
-	/* same to without specifying either of prefault and no-prefault */
+	/* Same as without specifying either of prefault and no-prefault: */
 	if (only_prefault && no_prefault)
 		only_prefault = no_prefault = false;
 
@@ -282,7 +275,8 @@ static void memcpy_alloc_mem(void **dst, void **src, size_t length)
 	*src = zalloc(length);
 	if (!*src)
 		die("memory allocation failed - maybe length is too large?\n");
-	/* Make sure to always replace the zero pages even if MMAP_THRESH is crossed */
+
+	/* Make sure to always prefault zero pages even if MMAP_THRESH is crossed: */
 	memset(*src, 0, length);
 }
 
@@ -308,8 +302,7 @@ static u64 do_memcpy_cycle(const struct routine *r, size_t len, bool prefault)
 	return cycle_end - cycle_start;
 }
 
-static double do_memcpy_gettimeofday(const struct routine *r, size_t len,
-				     bool prefault)
+static double do_memcpy_gettimeofday(const struct routine *r, size_t len, bool prefault)
 {
 	struct timeval tv_start, tv_end, tv_diff;
 	memcpy_t fn = r->fn.memcpy;
@@ -337,10 +330,10 @@ int bench_mem_memcpy(int argc, const char **argv,
 		     const char *prefix __maybe_unused)
 {
 	struct bench_mem_info info = {
-		.routines = memcpy_routines,
-		.do_cycle = do_memcpy_cycle,
-		.do_gettimeofday = do_memcpy_gettimeofday,
-		.usage = bench_mem_memcpy_usage,
+		.routines		= memcpy_routines,
+		.do_cycle		= do_memcpy_cycle,
+		.do_gettimeofday	= do_memcpy_gettimeofday,
+		.usage			= bench_mem_memcpy_usage,
 	};
 
 	return bench_mem_common(argc, argv, prefix, &info);
@@ -404,30 +397,26 @@ static const char * const bench_mem_memset_usage[] = {
 };
 
 static const struct routine memset_routines[] = {
-	{ .name ="default",
-	  .desc = "Default memset() provided by glibc",
-	  .fn.memset = memset },
-#ifdef HAVE_ARCH_X86_64_SUPPORT
-
-#define MEMSET_FN(_fn, _name, _desc) { .name = _name, .desc = _desc, .fn.memset = _fn },
-#include "mem-memset-x86-64-asm-def.h"
-#undef MEMSET_FN
+	{ .name		= "default",
+	  .desc		= "Default memset() provided by glibc",
+	  .fn.memset	= memset },
 
+#ifdef HAVE_ARCH_X86_64_SUPPORT
+# define MEMSET_FN(_fn, _name, _desc) { .name = _name, .desc = _desc, .fn.memset = _fn },
+# include "mem-memset-x86-64-asm-def.h"
+# undef MEMSET_FN
 #endif
 
-	{ .name = NULL,
-	  .desc = NULL,
-	  .fn.memset = NULL   }
+	{ NULL, }
 };
 
-int bench_mem_memset(int argc, const char **argv,
-		     const char *prefix __maybe_unused)
+int bench_mem_memset(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	struct bench_mem_info info = {
-		.routines = memset_routines,
-		.do_cycle = do_memset_cycle,
-		.do_gettimeofday = do_memset_gettimeofday,
-		.usage = bench_mem_memset_usage,
+		.routines		= memset_routines,
+		.do_cycle		= do_memset_cycle,
+		.do_gettimeofday	= do_memset_gettimeofday,
+		.usage			= bench_mem_memset_usage,
 	};
 
 	return bench_mem_common(argc, argv, prefix, &info);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 04/23] perf bench: Default to all routines in 'perf bench mem'
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 03/23] perf bench: Improve the 'perf bench mem memcpy' code readability Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 05/23] perf bench: Eliminate unused argument from bench_mem_common() Arnaldo Carvalho de Melo
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

So few people know that the --routine option to 'perf bench memcpy/memset'
exists, and would not know that it's capable of testing the kernel's
memcpy/memset implementations.

Furthermore, 'perf bench mem all' will not run all routines:

	vega:~> perf bench mem all
	# Running mem/memcpy benchmark...
	Routine default (Default memcpy() provided by glibc)
	# Copying 1MB Bytes ...

	     894.454383 MB/Sec
	       3.844734 GB/Sec (with prefault)

	# Running mem/memset benchmark...
	Routine default (Default memset() provided by glibc)
	# Copying 1MB Bytes ...

	       1.220703 GB/Sec
	       9.042245 GB/Sec (with prefault)

Because misleadingly the 'all' refers to 'all sub-benchmarks', not 'all
sub-benchmarks and routines'.

Fix all this by making the memcpy/memset routine to default to 'all',
which results in all the benchmarks being run:

	triton:~> perf bench mem all
	# Running mem/memcpy benchmark...
	Routine default (Default memcpy() provided by glibc)
	# Copying 1MB Bytes ...

	       1.448906 GB/Sec
	       4.957170 GB/Sec (with prefault)
	Routine x86-64-unrolled (unrolled memcpy() in arch/x86/lib/memcpy_64.S)
	# Copying 1MB Bytes ...

	       1.614153 GB/Sec
	       4.379204 GB/Sec (with prefault)
	Routine x86-64-movsq (movsq-based memcpy() in arch/x86/lib/memcpy_64.S)
	# Copying 1MB Bytes ...

	       1.570036 GB/Sec
	       4.264465 GB/Sec (with prefault)
	Routine x86-64-movsb (movsb-based memcpy() in arch/x86/lib/memcpy_64.S)
	# Copying 1MB Bytes ...

	       1.788576 GB/Sec
	       6.554111 GB/Sec (with prefault)

	# Running mem/memset benchmark...
	Routine default (Default memset() provided by glibc)
	# Copying 1MB Bytes ...

	       2.082223 GB/Sec
	       9.126752 GB/Sec (with prefault)
	Routine x86-64-unrolled (unrolled memset() in arch/x86/lib/memset_64.S)
	# Copying 1MB Bytes ...

	       5.710892 GB/Sec
	       8.346688 GB/Sec (with prefault)
	Routine x86-64-stosq (movsq-based memset() in arch/x86/lib/memset_64.S)
	# Copying 1MB Bytes ...

	       9.765625 GB/Sec
	      12.520032 GB/Sec (with prefault)
	Routine x86-64-stosb (movsb-based memset() in arch/x86/lib/memset_64.S)
	# Copying 1MB Bytes ...

	       9.668936 GB/Sec
	      12.682630 GB/Sec (with prefault)

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-3-git-send-email-mingo@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/mem-memcpy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-memcpy.c
index 27606ff5c4f9..263f84171ae5 100644
--- a/tools/perf/bench/mem-memcpy.c
+++ b/tools/perf/bench/mem-memcpy.c
@@ -24,7 +24,7 @@
 #define K 1024
 
 static const char	*length_str	= "1MB";
-static const char	*routine	= "default";
+static const char	*routine	= "all";
 static int		iterations	= 1;
 static bool		use_cycle;
 static int		cycle_fd;
@@ -35,7 +35,7 @@ static const struct option options[] = {
 	OPT_STRING('l', "length", &length_str, "1MB",
 		    "Specify length of memory to copy. "
 		    "Available units: B, KB, MB, GB and TB (upper and lower)"),
-	OPT_STRING('r', "routine", &routine, "default",
+	OPT_STRING('r', "routine", &routine, "all",
 		    "Specify routine to copy, \"all\" runs all available routines"),
 	OPT_INTEGER('i', "iterations", &iterations,
 		    "repeat memcpy() invocation this number of times"),
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 05/23] perf bench: Eliminate unused argument from bench_mem_common()
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 04/23] perf bench: Default to all routines in 'perf bench mem' Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 06/23] perf bench: Rename 'mem-memcpy.c' => 'mem-functions.c' Arnaldo Carvalho de Melo
                   ` (18 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-4-git-send-email-mingo@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/mem-memcpy.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-memcpy.c
index 263f84171ae5..7acb9b83382c 100644
--- a/tools/perf/bench/mem-memcpy.c
+++ b/tools/perf/bench/mem-memcpy.c
@@ -211,9 +211,7 @@ static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t l
 	}
 }
 
-static int bench_mem_common(int argc, const char **argv,
-		     const char *prefix __maybe_unused,
-		     struct bench_mem_info *info)
+static int bench_mem_common(int argc, const char **argv, struct bench_mem_info *info)
 {
 	int i;
 	size_t len;
@@ -326,8 +324,7 @@ static double do_memcpy_gettimeofday(const struct routine *r, size_t len, bool p
 	return (double)(((double)len * iterations) / timeval2double(&tv_diff));
 }
 
-int bench_mem_memcpy(int argc, const char **argv,
-		     const char *prefix __maybe_unused)
+int bench_mem_memcpy(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	struct bench_mem_info info = {
 		.routines		= memcpy_routines,
@@ -336,7 +333,7 @@ int bench_mem_memcpy(int argc, const char **argv,
 		.usage			= bench_mem_memcpy_usage,
 	};
 
-	return bench_mem_common(argc, argv, prefix, &info);
+	return bench_mem_common(argc, argv, &info);
 }
 
 static void memset_alloc_mem(void **dst, size_t length)
@@ -419,5 +416,5 @@ int bench_mem_memset(int argc, const char **argv, const char *prefix __maybe_unu
 		.usage			= bench_mem_memset_usage,
 	};
 
-	return bench_mem_common(argc, argv, prefix, &info);
+	return bench_mem_common(argc, argv, &info);
 }
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 06/23] perf bench: Rename 'mem-memcpy.c' => 'mem-functions.c'
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 05/23] perf bench: Eliminate unused argument from bench_mem_common() Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 07/23] perf bench: Remove the prefaulting complication from 'perf bench mem mem*' Arnaldo Carvalho de Melo
                   ` (17 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

So mem-memcpy.c started out as a simple memcpy() benchmark, then it grew
memset() functionality and now I plan to add string copy benchmarks as
well.

This makes the file name a misnomer: rename it to the more generic
mem-functions.c name.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-5-git-send-email-mingo@kernel.org
[ The "rename" was introducing __unused, wasn't removing the old file,
  and didn't update tools/perf/bench/Build, fix it ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/Build                             | 2 +-
 tools/perf/bench/{mem-memcpy.c => mem-functions.c} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename tools/perf/bench/{mem-memcpy.c => mem-functions.c} (100%)

diff --git a/tools/perf/bench/Build b/tools/perf/bench/Build
index 573e28896038..60bf11943047 100644
--- a/tools/perf/bench/Build
+++ b/tools/perf/bench/Build
@@ -1,6 +1,6 @@
 perf-y += sched-messaging.o
 perf-y += sched-pipe.o
-perf-y += mem-memcpy.o
+perf-y += mem-functions.o
 perf-y += futex-hash.o
 perf-y += futex-wake.o
 perf-y += futex-wake-parallel.o
diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-functions.c
similarity index 100%
rename from tools/perf/bench/mem-memcpy.c
rename to tools/perf/bench/mem-functions.c
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 07/23] perf bench: Remove the prefaulting complication from 'perf bench mem mem*'
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 06/23] perf bench: Rename 'mem-memcpy.c' => 'mem-functions.c' Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 08/23] perf bench: List output formatting options on 'perf bench -h' Arnaldo Carvalho de Melo
                   ` (16 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

So 'perf bench mem memcpy/memset' has elaborate code to measure
memcpy()/memset() performance both with freshly allocated buffers (which
includes initial page fault overhead) and with preallocated buffers.

But the thing is, the resulting bandwidth results are mostly
meaningless, because page faults dominate so much of the cost.

It might make sense to measure cache cold vs. cache hot performance, but
the code does not do this.

So remove this complication, and always prefault the ranges before using
them.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-6-git-send-email-mingo@kernel.org
[ Remove --no-prefault, --only-prefault from docs, noticed by David Ahern ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-bench.txt |  16 ----
 tools/perf/bench/mem-functions.c        | 146 +++++++++++---------------------
 2 files changed, 50 insertions(+), 112 deletions(-)

diff --git a/tools/perf/Documentation/perf-bench.txt b/tools/perf/Documentation/perf-bench.txt
index ab632d9fbd7d..9cb60abe03aa 100644
--- a/tools/perf/Documentation/perf-bench.txt
+++ b/tools/perf/Documentation/perf-bench.txt
@@ -157,14 +157,6 @@ Repeat memcpy invocation this number of times.
 --cycle::
 Use perf's cpu-cycles event instead of gettimeofday syscall.
 
--o::
---only-prefault::
-Show only the result with page faults before memcpy.
-
--n::
---no-prefault::
-Show only the result without page faults before memcpy.
-
 *memset*::
 Suite for evaluating performance of simple memory set in various ways.
 
@@ -189,14 +181,6 @@ Repeat memset invocation this number of times.
 --cycle::
 Use perf's cpu-cycles event instead of gettimeofday syscall.
 
--o::
---only-prefault::
-Show only the result with page faults before memset.
-
--n::
---no-prefault::
-Show only the result without page faults before memset.
-
 SUITES FOR 'numa'
 ~~~~~~~~~~~~~~~~~
 *mem*::
diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index 7acb9b83382c..9c18a4b976b6 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -28,8 +28,6 @@ static const char	*routine	= "all";
 static int		iterations	= 1;
 static bool		use_cycle;
 static int		cycle_fd;
-static bool		only_prefault;
-static bool		no_prefault;
 
 static const struct option options[] = {
 	OPT_STRING('l', "length", &length_str, "1MB",
@@ -41,10 +39,6 @@ static const struct option options[] = {
 		    "repeat memcpy() invocation this number of times"),
 	OPT_BOOLEAN('c', "cycle", &use_cycle,
 		    "Use cycles event instead of gettimeofday() for measuring"),
-	OPT_BOOLEAN('o', "only-prefault", &only_prefault,
-		    "Show only the result with page faults before memcpy()"),
-	OPT_BOOLEAN('n', "no-prefault", &no_prefault,
-		    "Show only the result without page faults before memcpy()"),
 	OPT_END()
 };
 
@@ -110,103 +104,60 @@ static double timeval2double(struct timeval *ts)
 	return (double)ts->tv_sec + (double)ts->tv_usec / (double)1000000;
 }
 
-#define print_bps(x) do {					\
-		if (x < K)					\
-			printf(" %14lf B/Sec", x);		\
-		else if (x < K * K)				\
-			printf(" %14lfd KB/Sec", x / K);	\
-		else if (x < K * K * K)				\
-			printf(" %14lf MB/Sec", x / K / K);	\
-		else						\
-			printf(" %14lf GB/Sec", x / K / K / K); \
+#define print_bps(x) do {						\
+		if (x < K)						\
+			printf(" %14lf B/Sec\n", x);			\
+		else if (x < K * K)					\
+			printf(" %14lfd KB/Sec\n", x / K);		\
+		else if (x < K * K * K)					\
+			printf(" %14lf MB/Sec\n", x / K / K);		\
+		else							\
+			printf(" %14lf GB/Sec\n", x / K / K / K);	\
 	} while (0)
 
 struct bench_mem_info {
 	const struct routine *routines;
-	u64 (*do_cycle)(const struct routine *r, size_t len, bool prefault);
-	double (*do_gettimeofday)(const struct routine *r, size_t len, bool prefault);
+	u64 (*do_cycle)(const struct routine *r, size_t len);
+	double (*do_gettimeofday)(const struct routine *r, size_t len);
 	const char *const *usage;
 };
 
 static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t len, double totallen)
 {
 	const struct routine *r = &info->routines[r_idx];
-	double result_bps[2];
-	u64 result_cycle[2];
-	int prefault = no_prefault ? 0 : 1;
-
-	result_cycle[0] = result_cycle[1] = 0ULL;
-	result_bps[0] = result_bps[1] = 0.0;
+	double result_bps = 0.0;
+	u64 result_cycle = 0;
 
 	printf("Routine %s (%s)\n", r->name, r->desc);
 
 	if (bench_format == BENCH_FORMAT_DEFAULT)
 		printf("# Copying %s Bytes ...\n\n", length_str);
 
-	if (!only_prefault && prefault) {
-		/* Show both results: */
-		if (use_cycle) {
-			result_cycle[0] = info->do_cycle(r, len, false);
-			result_cycle[1] = info->do_cycle(r, len, true);
-		} else {
-			result_bps[0]   = info->do_gettimeofday(r, len, false);
-			result_bps[1]   = info->do_gettimeofday(r, len, true);
-		}
+	if (use_cycle) {
+		result_cycle = info->do_cycle(r, len);
 	} else {
-		if (use_cycle)
-			result_cycle[prefault] = info->do_cycle(r, len, only_prefault);
-		else
-			result_bps[prefault] = info->do_gettimeofday(r, len, only_prefault);
+		result_bps = info->do_gettimeofday(r, len);
 	}
 
 	switch (bench_format) {
 	case BENCH_FORMAT_DEFAULT:
-		if (!only_prefault && prefault) {
-			if (use_cycle) {
-				printf(" %14lf Cycle/Byte\n",
-					(double)result_cycle[0]
-					/ totallen);
-				printf(" %14lf Cycle/Byte (with prefault)\n",
-					(double)result_cycle[1]
-					/ totallen);
-			} else {
-				print_bps(result_bps[0]);
-				printf("\n");
-				print_bps(result_bps[1]);
-				printf(" (with prefault)\n");
-			}
+		if (use_cycle) {
+			printf(" %14lf Cycle/Byte\n", (double)result_cycle/totallen);
 		} else {
-			if (use_cycle) {
-				printf(" %14lf Cycle/Byte",
-					(double)result_cycle[prefault]
-					/ totallen);
-			} else
-				print_bps(result_bps[prefault]);
-
-			printf("%s\n", only_prefault ? " (with prefault)" : "");
+			print_bps(result_bps);
 		}
 		break;
+
 	case BENCH_FORMAT_SIMPLE:
-		if (!only_prefault && prefault) {
-			if (use_cycle) {
-				printf("%lf %lf\n",
-					(double)result_cycle[0] / totallen,
-					(double)result_cycle[1] / totallen);
-			} else {
-				printf("%lf %lf\n",
-					result_bps[0], result_bps[1]);
-			}
+		if (use_cycle) {
+			printf("%lf\n", (double)result_cycle/totallen);
 		} else {
-			if (use_cycle) {
-				printf("%lf\n", (double)result_cycle[prefault]
-					/ totallen);
-			} else
-				printf("%lf\n", result_bps[prefault]);
+			printf("%lf\n", result_bps);
 		}
 		break;
+
 	default:
-		/* Reaching this means there's some disaster: */
-		die("unknown format: %d\n", bench_format);
+		BUG_ON(1);
 		break;
 	}
 }
@@ -219,11 +170,6 @@ static int bench_mem_common(int argc, const char **argv, struct bench_mem_info *
 
 	argc = parse_options(argc, argv, options, info->usage, 0);
 
-	if (no_prefault && only_prefault) {
-		fprintf(stderr, "Invalid options: -o and -n are mutually exclusive\n");
-		return 1;
-	}
-
 	if (use_cycle)
 		init_cycle();
 
@@ -235,10 +181,6 @@ static int bench_mem_common(int argc, const char **argv, struct bench_mem_info *
 		return 1;
 	}
 
-	/* Same as without specifying either of prefault and no-prefault: */
-	if (only_prefault && no_prefault)
-		only_prefault = no_prefault = false;
-
 	if (!strncmp(routine, "all", 3)) {
 		for (i = 0; info->routines[i].name; i++)
 			__bench_mem_routine(info, i, len, totallen);
@@ -278,7 +220,7 @@ static void memcpy_alloc_mem(void **dst, void **src, size_t length)
 	memset(*src, 0, length);
 }
 
-static u64 do_memcpy_cycle(const struct routine *r, size_t len, bool prefault)
+static u64 do_memcpy_cycle(const struct routine *r, size_t len)
 {
 	u64 cycle_start = 0ULL, cycle_end = 0ULL;
 	void *src = NULL, *dst = NULL;
@@ -287,8 +229,11 @@ static u64 do_memcpy_cycle(const struct routine *r, size_t len, bool prefault)
 
 	memcpy_alloc_mem(&dst, &src, len);
 
-	if (prefault)
-		fn(dst, src, len);
+	/*
+	 * We prefault the freshly allocated memory range here,
+	 * to not measure page fault overhead:
+	 */
+	fn(dst, src, len);
 
 	cycle_start = get_cycle();
 	for (i = 0; i < iterations; ++i)
@@ -300,7 +245,7 @@ static u64 do_memcpy_cycle(const struct routine *r, size_t len, bool prefault)
 	return cycle_end - cycle_start;
 }
 
-static double do_memcpy_gettimeofday(const struct routine *r, size_t len, bool prefault)
+static double do_memcpy_gettimeofday(const struct routine *r, size_t len)
 {
 	struct timeval tv_start, tv_end, tv_diff;
 	memcpy_t fn = r->fn.memcpy;
@@ -309,8 +254,11 @@ static double do_memcpy_gettimeofday(const struct routine *r, size_t len, bool p
 
 	memcpy_alloc_mem(&dst, &src, len);
 
-	if (prefault)
-		fn(dst, src, len);
+	/*
+	 * We prefault the freshly allocated memory range here,
+	 * to not measure page fault overhead:
+	 */
+	fn(dst, src, len);
 
 	BUG_ON(gettimeofday(&tv_start, NULL));
 	for (i = 0; i < iterations; ++i)
@@ -321,6 +269,7 @@ static double do_memcpy_gettimeofday(const struct routine *r, size_t len, bool p
 
 	free(src);
 	free(dst);
+
 	return (double)(((double)len * iterations) / timeval2double(&tv_diff));
 }
 
@@ -343,7 +292,7 @@ static void memset_alloc_mem(void **dst, size_t length)
 		die("memory allocation failed - maybe length is too large?\n");
 }
 
-static u64 do_memset_cycle(const struct routine *r, size_t len, bool prefault)
+static u64 do_memset_cycle(const struct routine *r, size_t len)
 {
 	u64 cycle_start = 0ULL, cycle_end = 0ULL;
 	memset_t fn = r->fn.memset;
@@ -352,8 +301,11 @@ static u64 do_memset_cycle(const struct routine *r, size_t len, bool prefault)
 
 	memset_alloc_mem(&dst, len);
 
-	if (prefault)
-		fn(dst, -1, len);
+	/*
+	 * We prefault the freshly allocated memory range here,
+	 * to not measure page fault overhead:
+	 */
+	fn(dst, -1, len);
 
 	cycle_start = get_cycle();
 	for (i = 0; i < iterations; ++i)
@@ -364,8 +316,7 @@ static u64 do_memset_cycle(const struct routine *r, size_t len, bool prefault)
 	return cycle_end - cycle_start;
 }
 
-static double do_memset_gettimeofday(const struct routine *r, size_t len,
-				     bool prefault)
+static double do_memset_gettimeofday(const struct routine *r, size_t len)
 {
 	struct timeval tv_start, tv_end, tv_diff;
 	memset_t fn = r->fn.memset;
@@ -374,8 +325,11 @@ static double do_memset_gettimeofday(const struct routine *r, size_t len,
 
 	memset_alloc_mem(&dst, len);
 
-	if (prefault)
-		fn(dst, -1, len);
+	/*
+	 * We prefault the freshly allocated memory range here,
+	 * to not measure page fault overhead:
+	 */
+	fn(dst, -1, len);
 
 	BUG_ON(gettimeofday(&tv_start, NULL));
 	for (i = 0; i < iterations; ++i)
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 08/23] perf bench: List output formatting options on 'perf bench -h'
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 07/23] perf bench: Remove the prefaulting complication from 'perf bench mem mem*' Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 09/23] perf bench mem: Change 'cycle' to 'cycles' Arnaldo Carvalho de Melo
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

So 'perf bench -h' is not very helpful when printing the help line
about the output formatting options:

    -f, --format <default>
                              Specify format style

There are two output format styles, 'default' and 'simple', so improve
the help text to:

    -f, --format <default|simple>
                              Specify the output formatting style

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-7-git-send-email-mingo@kernel.org
[ Removed leftovers from the mem-functions.c rename ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-bench.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index f67934d46d40..1b585213ba5a 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -110,7 +110,7 @@ int bench_format = BENCH_FORMAT_DEFAULT;
 unsigned int bench_repeat = 10; /* default number of times to repeat the run */
 
 static const struct option bench_options[] = {
-	OPT_STRING('f', "format", &bench_format_str, "default", "Specify format style"),
+	OPT_STRING('f', "format", &bench_format_str, "default|simple", "Specify the output formatting style"),
 	OPT_UINTEGER('r', "repeat",  &bench_repeat,   "Specify amount of times to repeat the run"),
 	OPT_END()
 };
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 09/23] perf bench mem: Change 'cycle' to 'cycles'
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 08/23] perf bench: List output formatting options on 'perf bench -h' Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 10/23] perf bench mem: Rename 'routine' to 'routine_str' Arnaldo Carvalho de Melo
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

So 'perf bench mem memset/memcpy' has a CPU cycles measurement method,
but calls it 'cycle' (singular) throughout the code, which makes it
harder to read.

Rename all related functions, variables and options to a plural 'cycles'
nomenclature.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-8-git-send-email-mingo@kernel.org
[ s/--cycle/--cycles/g in perf-bench man page ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-bench.txt |  4 +--
 tools/perf/bench/mem-functions.c        | 56 ++++++++++++++++-----------------
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/tools/perf/Documentation/perf-bench.txt b/tools/perf/Documentation/perf-bench.txt
index 9cb60abe03aa..17135ef92d70 100644
--- a/tools/perf/Documentation/perf-bench.txt
+++ b/tools/perf/Documentation/perf-bench.txt
@@ -154,7 +154,7 @@ On x86-64, x86-64-unrolled, x86-64-movsq and x86-64-movsb are supported.
 Repeat memcpy invocation this number of times.
 
 -c::
---cycle::
+--cycles::
 Use perf's cpu-cycles event instead of gettimeofday syscall.
 
 *memset*::
@@ -178,7 +178,7 @@ On x86-64, x86-64-unrolled, x86-64-stosq and x86-64-stosb are supported.
 Repeat memset invocation this number of times.
 
 -c::
---cycle::
+--cycles::
 Use perf's cpu-cycles event instead of gettimeofday syscall.
 
 SUITES FOR 'numa'
diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index 9c18a4b976b6..6fe8667fbdf2 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -26,8 +26,8 @@
 static const char	*length_str	= "1MB";
 static const char	*routine	= "all";
 static int		iterations	= 1;
-static bool		use_cycle;
-static int		cycle_fd;
+static bool		use_cycles;
+static int		cycles_fd;
 
 static const struct option options[] = {
 	OPT_STRING('l', "length", &length_str, "1MB",
@@ -37,8 +37,8 @@ static const struct option options[] = {
 		    "Specify routine to copy, \"all\" runs all available routines"),
 	OPT_INTEGER('i', "iterations", &iterations,
 		    "repeat memcpy() invocation this number of times"),
-	OPT_BOOLEAN('c', "cycle", &use_cycle,
-		    "Use cycles event instead of gettimeofday() for measuring"),
+	OPT_BOOLEAN('c', "cycles", &use_cycles,
+		    "Use a cycles event instead of gettimeofday() to measure performance"),
 	OPT_END()
 };
 
@@ -78,22 +78,22 @@ static struct perf_event_attr cycle_attr = {
 	.config		= PERF_COUNT_HW_CPU_CYCLES
 };
 
-static void init_cycle(void)
+static void init_cycles(void)
 {
-	cycle_fd = sys_perf_event_open(&cycle_attr, getpid(), -1, -1, perf_event_open_cloexec_flag());
+	cycles_fd = sys_perf_event_open(&cycle_attr, getpid(), -1, -1, perf_event_open_cloexec_flag());
 
-	if (cycle_fd < 0 && errno == ENOSYS)
+	if (cycles_fd < 0 && errno == ENOSYS)
 		die("No CONFIG_PERF_EVENTS=y kernel support configured?\n");
 	else
-		BUG_ON(cycle_fd < 0);
+		BUG_ON(cycles_fd < 0);
 }
 
-static u64 get_cycle(void)
+static u64 get_cycles(void)
 {
 	int ret;
 	u64 clk;
 
-	ret = read(cycle_fd, &clk, sizeof(u64));
+	ret = read(cycles_fd, &clk, sizeof(u64));
 	BUG_ON(ret != sizeof(u64));
 
 	return clk;
@@ -117,7 +117,7 @@ static double timeval2double(struct timeval *ts)
 
 struct bench_mem_info {
 	const struct routine *routines;
-	u64 (*do_cycle)(const struct routine *r, size_t len);
+	u64 (*do_cycles)(const struct routine *r, size_t len);
 	double (*do_gettimeofday)(const struct routine *r, size_t len);
 	const char *const *usage;
 };
@@ -126,31 +126,31 @@ static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t l
 {
 	const struct routine *r = &info->routines[r_idx];
 	double result_bps = 0.0;
-	u64 result_cycle = 0;
+	u64 result_cycles = 0;
 
 	printf("Routine %s (%s)\n", r->name, r->desc);
 
 	if (bench_format == BENCH_FORMAT_DEFAULT)
 		printf("# Copying %s Bytes ...\n\n", length_str);
 
-	if (use_cycle) {
-		result_cycle = info->do_cycle(r, len);
+	if (use_cycles) {
+		result_cycles = info->do_cycles(r, len);
 	} else {
 		result_bps = info->do_gettimeofday(r, len);
 	}
 
 	switch (bench_format) {
 	case BENCH_FORMAT_DEFAULT:
-		if (use_cycle) {
-			printf(" %14lf Cycle/Byte\n", (double)result_cycle/totallen);
+		if (use_cycles) {
+			printf(" %14lf cycles/Byte\n", (double)result_cycles/totallen);
 		} else {
 			print_bps(result_bps);
 		}
 		break;
 
 	case BENCH_FORMAT_SIMPLE:
-		if (use_cycle) {
-			printf("%lf\n", (double)result_cycle/totallen);
+		if (use_cycles) {
+			printf("%lf\n", (double)result_cycles/totallen);
 		} else {
 			printf("%lf\n", result_bps);
 		}
@@ -170,8 +170,8 @@ static int bench_mem_common(int argc, const char **argv, struct bench_mem_info *
 
 	argc = parse_options(argc, argv, options, info->usage, 0);
 
-	if (use_cycle)
-		init_cycle();
+	if (use_cycles)
+		init_cycles();
 
 	len = (size_t)perf_atoll((char *)length_str);
 	totallen = (double)len * iterations;
@@ -220,7 +220,7 @@ static void memcpy_alloc_mem(void **dst, void **src, size_t length)
 	memset(*src, 0, length);
 }
 
-static u64 do_memcpy_cycle(const struct routine *r, size_t len)
+static u64 do_memcpy_cycles(const struct routine *r, size_t len)
 {
 	u64 cycle_start = 0ULL, cycle_end = 0ULL;
 	void *src = NULL, *dst = NULL;
@@ -235,10 +235,10 @@ static u64 do_memcpy_cycle(const struct routine *r, size_t len)
 	 */
 	fn(dst, src, len);
 
-	cycle_start = get_cycle();
+	cycle_start = get_cycles();
 	for (i = 0; i < iterations; ++i)
 		fn(dst, src, len);
-	cycle_end = get_cycle();
+	cycle_end = get_cycles();
 
 	free(src);
 	free(dst);
@@ -277,7 +277,7 @@ int bench_mem_memcpy(int argc, const char **argv, const char *prefix __maybe_unu
 {
 	struct bench_mem_info info = {
 		.routines		= memcpy_routines,
-		.do_cycle		= do_memcpy_cycle,
+		.do_cycles		= do_memcpy_cycles,
 		.do_gettimeofday	= do_memcpy_gettimeofday,
 		.usage			= bench_mem_memcpy_usage,
 	};
@@ -292,7 +292,7 @@ static void memset_alloc_mem(void **dst, size_t length)
 		die("memory allocation failed - maybe length is too large?\n");
 }
 
-static u64 do_memset_cycle(const struct routine *r, size_t len)
+static u64 do_memset_cycles(const struct routine *r, size_t len)
 {
 	u64 cycle_start = 0ULL, cycle_end = 0ULL;
 	memset_t fn = r->fn.memset;
@@ -307,10 +307,10 @@ static u64 do_memset_cycle(const struct routine *r, size_t len)
 	 */
 	fn(dst, -1, len);
 
-	cycle_start = get_cycle();
+	cycle_start = get_cycles();
 	for (i = 0; i < iterations; ++i)
 		fn(dst, i, len);
-	cycle_end = get_cycle();
+	cycle_end = get_cycles();
 
 	free(dst);
 	return cycle_end - cycle_start;
@@ -365,7 +365,7 @@ int bench_mem_memset(int argc, const char **argv, const char *prefix __maybe_unu
 {
 	struct bench_mem_info info = {
 		.routines		= memset_routines,
-		.do_cycle		= do_memset_cycle,
+		.do_cycles		= do_memset_cycles,
 		.do_gettimeofday	= do_memset_gettimeofday,
 		.usage			= bench_mem_memset_usage,
 	};
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 10/23] perf bench mem: Rename 'routine' to 'routine_str'
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (8 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 09/23] perf bench mem: Change 'cycle' to 'cycles' Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 11/23] perf bench mem: Fix 'length' vs. 'size' naming confusion Arnaldo Carvalho de Melo
                   ` (13 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

So bench/mem-functions.c has a 'routine' name for the routines parameter
string, but a 'length_str' name for the length parameter string.

We also have another entity named 'routine': 'struct routine'.

This is inconsistent and confusing: rename 'routine' to 'routine_str'.

Also fix typos in the --routine help text.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-9-git-send-email-mingo@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/mem-functions.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index 6fe8667fbdf2..a76e57f3ab66 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -24,7 +24,7 @@
 #define K 1024
 
 static const char	*length_str	= "1MB";
-static const char	*routine	= "all";
+static const char	*routine_str	= "all";
 static int		iterations	= 1;
 static bool		use_cycles;
 static int		cycles_fd;
@@ -33,8 +33,8 @@ static const struct option options[] = {
 	OPT_STRING('l', "length", &length_str, "1MB",
 		    "Specify length of memory to copy. "
 		    "Available units: B, KB, MB, GB and TB (upper and lower)"),
-	OPT_STRING('r', "routine", &routine, "all",
-		    "Specify routine to copy, \"all\" runs all available routines"),
+	OPT_STRING('r', "routine", &routine_str, "all",
+		    "Specify the routine to run, \"all\" runs all available routines"),
 	OPT_INTEGER('i', "iterations", &iterations,
 		    "repeat memcpy() invocation this number of times"),
 	OPT_BOOLEAN('c', "cycles", &use_cycles,
@@ -181,18 +181,18 @@ static int bench_mem_common(int argc, const char **argv, struct bench_mem_info *
 		return 1;
 	}
 
-	if (!strncmp(routine, "all", 3)) {
+	if (!strncmp(routine_str, "all", 3)) {
 		for (i = 0; info->routines[i].name; i++)
 			__bench_mem_routine(info, i, len, totallen);
 		return 0;
 	}
 
 	for (i = 0; info->routines[i].name; i++) {
-		if (!strcmp(info->routines[i].name, routine))
+		if (!strcmp(info->routines[i].name, routine_str))
 			break;
 	}
 	if (!info->routines[i].name) {
-		printf("Unknown routine:%s\n", routine);
+		printf("Unknown routine: %s\n", routine_str);
 		printf("Available routines...\n");
 		for (i = 0; info->routines[i].name; i++) {
 			printf("\t%s ... %s\n",
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 11/23] perf bench mem: Fix 'length' vs. 'size' naming confusion
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (9 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 10/23] perf bench mem: Rename 'routine' to 'routine_str' Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 12/23] perf bench mem: Improve user visible strings Arnaldo Carvalho de Melo
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

So 'perf bench mem memcpy/memset' consistently uses 'len' and 'length'
for buffer sizes - while it's really a memory buffer size. (strings have
length.)

Rename all affected variables.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-10-git-send-email-mingo@kernel.org
[ Update perf-bench man page ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-bench.txt |  8 +--
 tools/perf/bench/mem-functions.c        | 92 ++++++++++++++++-----------------
 2 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/tools/perf/Documentation/perf-bench.txt b/tools/perf/Documentation/perf-bench.txt
index 17135ef92d70..bbd27d89b50a 100644
--- a/tools/perf/Documentation/perf-bench.txt
+++ b/tools/perf/Documentation/perf-bench.txt
@@ -139,8 +139,8 @@ Suite for evaluating performance of simple memory copy in various ways.
 Options of *memcpy*
 ^^^^^^^^^^^^^^^^^^^
 -l::
---length::
-Specify length of memory to copy (default: 1MB).
+--size::
+Specify size of memory to copy (default: 1MB).
 Available units are B, KB, MB, GB and TB (case insensitive).
 
 -r::
@@ -163,8 +163,8 @@ Suite for evaluating performance of simple memory set in various ways.
 Options of *memset*
 ^^^^^^^^^^^^^^^^^^^
 -l::
---length::
-Specify length of memory to set (default: 1MB).
+--size::
+Specify size of memory to set (default: 1MB).
 Available units are B, KB, MB, GB and TB (case insensitive).
 
 -r::
diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index a76e57f3ab66..1605249d2912 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -23,15 +23,15 @@
 
 #define K 1024
 
-static const char	*length_str	= "1MB";
+static const char	*size_str	= "1MB";
 static const char	*routine_str	= "all";
 static int		iterations	= 1;
 static bool		use_cycles;
 static int		cycles_fd;
 
 static const struct option options[] = {
-	OPT_STRING('l', "length", &length_str, "1MB",
-		    "Specify length of memory to copy. "
+	OPT_STRING('l', "size", &size_str, "1MB",
+		    "Specify the size of the memory buffers. "
 		    "Available units: B, KB, MB, GB and TB (upper and lower)"),
 	OPT_STRING('r', "routine", &routine_str, "all",
 		    "Specify the routine to run, \"all\" runs all available routines"),
@@ -117,12 +117,12 @@ static double timeval2double(struct timeval *ts)
 
 struct bench_mem_info {
 	const struct routine *routines;
-	u64 (*do_cycles)(const struct routine *r, size_t len);
-	double (*do_gettimeofday)(const struct routine *r, size_t len);
+	u64 (*do_cycles)(const struct routine *r, size_t size);
+	double (*do_gettimeofday)(const struct routine *r, size_t size);
 	const char *const *usage;
 };
 
-static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t len, double totallen)
+static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t size, double size_total)
 {
 	const struct routine *r = &info->routines[r_idx];
 	double result_bps = 0.0;
@@ -131,18 +131,18 @@ static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t l
 	printf("Routine %s (%s)\n", r->name, r->desc);
 
 	if (bench_format == BENCH_FORMAT_DEFAULT)
-		printf("# Copying %s Bytes ...\n\n", length_str);
+		printf("# Copying %s Bytes ...\n\n", size_str);
 
 	if (use_cycles) {
-		result_cycles = info->do_cycles(r, len);
+		result_cycles = info->do_cycles(r, size);
 	} else {
-		result_bps = info->do_gettimeofday(r, len);
+		result_bps = info->do_gettimeofday(r, size);
 	}
 
 	switch (bench_format) {
 	case BENCH_FORMAT_DEFAULT:
 		if (use_cycles) {
-			printf(" %14lf cycles/Byte\n", (double)result_cycles/totallen);
+			printf(" %14lf cycles/Byte\n", (double)result_cycles/size_total);
 		} else {
 			print_bps(result_bps);
 		}
@@ -150,7 +150,7 @@ static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t l
 
 	case BENCH_FORMAT_SIMPLE:
 		if (use_cycles) {
-			printf("%lf\n", (double)result_cycles/totallen);
+			printf("%lf\n", (double)result_cycles/size_total);
 		} else {
 			printf("%lf\n", result_bps);
 		}
@@ -165,25 +165,25 @@ static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t l
 static int bench_mem_common(int argc, const char **argv, struct bench_mem_info *info)
 {
 	int i;
-	size_t len;
-	double totallen;
+	size_t size;
+	double size_total;
 
 	argc = parse_options(argc, argv, options, info->usage, 0);
 
 	if (use_cycles)
 		init_cycles();
 
-	len = (size_t)perf_atoll((char *)length_str);
-	totallen = (double)len * iterations;
+	size = (size_t)perf_atoll((char *)size_str);
+	size_total = (double)size * iterations;
 
-	if ((s64)len <= 0) {
-		fprintf(stderr, "Invalid length:%s\n", length_str);
+	if ((s64)size <= 0) {
+		fprintf(stderr, "Invalid size:%s\n", size_str);
 		return 1;
 	}
 
 	if (!strncmp(routine_str, "all", 3)) {
 		for (i = 0; info->routines[i].name; i++)
-			__bench_mem_routine(info, i, len, totallen);
+			__bench_mem_routine(info, i, size, size_total);
 		return 0;
 	}
 
@@ -201,43 +201,43 @@ static int bench_mem_common(int argc, const char **argv, struct bench_mem_info *
 		return 1;
 	}
 
-	__bench_mem_routine(info, i, len, totallen);
+	__bench_mem_routine(info, i, size, size_total);
 
 	return 0;
 }
 
-static void memcpy_alloc_mem(void **dst, void **src, size_t length)
+static void memcpy_alloc_mem(void **dst, void **src, size_t size)
 {
-	*dst = zalloc(length);
+	*dst = zalloc(size);
 	if (!*dst)
-		die("memory allocation failed - maybe length is too large?\n");
+		die("memory allocation failed - maybe size is too large?\n");
 
-	*src = zalloc(length);
+	*src = zalloc(size);
 	if (!*src)
-		die("memory allocation failed - maybe length is too large?\n");
+		die("memory allocation failed - maybe size is too large?\n");
 
 	/* Make sure to always prefault zero pages even if MMAP_THRESH is crossed: */
-	memset(*src, 0, length);
+	memset(*src, 0, size);
 }
 
-static u64 do_memcpy_cycles(const struct routine *r, size_t len)
+static u64 do_memcpy_cycles(const struct routine *r, size_t size)
 {
 	u64 cycle_start = 0ULL, cycle_end = 0ULL;
 	void *src = NULL, *dst = NULL;
 	memcpy_t fn = r->fn.memcpy;
 	int i;
 
-	memcpy_alloc_mem(&dst, &src, len);
+	memcpy_alloc_mem(&dst, &src, size);
 
 	/*
 	 * We prefault the freshly allocated memory range here,
 	 * to not measure page fault overhead:
 	 */
-	fn(dst, src, len);
+	fn(dst, src, size);
 
 	cycle_start = get_cycles();
 	for (i = 0; i < iterations; ++i)
-		fn(dst, src, len);
+		fn(dst, src, size);
 	cycle_end = get_cycles();
 
 	free(src);
@@ -245,24 +245,24 @@ static u64 do_memcpy_cycles(const struct routine *r, size_t len)
 	return cycle_end - cycle_start;
 }
 
-static double do_memcpy_gettimeofday(const struct routine *r, size_t len)
+static double do_memcpy_gettimeofday(const struct routine *r, size_t size)
 {
 	struct timeval tv_start, tv_end, tv_diff;
 	memcpy_t fn = r->fn.memcpy;
 	void *src = NULL, *dst = NULL;
 	int i;
 
-	memcpy_alloc_mem(&dst, &src, len);
+	memcpy_alloc_mem(&dst, &src, size);
 
 	/*
 	 * We prefault the freshly allocated memory range here,
 	 * to not measure page fault overhead:
 	 */
-	fn(dst, src, len);
+	fn(dst, src, size);
 
 	BUG_ON(gettimeofday(&tv_start, NULL));
 	for (i = 0; i < iterations; ++i)
-		fn(dst, src, len);
+		fn(dst, src, size);
 	BUG_ON(gettimeofday(&tv_end, NULL));
 
 	timersub(&tv_end, &tv_start, &tv_diff);
@@ -270,7 +270,7 @@ static double do_memcpy_gettimeofday(const struct routine *r, size_t len)
 	free(src);
 	free(dst);
 
-	return (double)(((double)len * iterations) / timeval2double(&tv_diff));
+	return (double)(((double)size * iterations) / timeval2double(&tv_diff));
 }
 
 int bench_mem_memcpy(int argc, const char **argv, const char *prefix __maybe_unused)
@@ -285,61 +285,61 @@ int bench_mem_memcpy(int argc, const char **argv, const char *prefix __maybe_unu
 	return bench_mem_common(argc, argv, &info);
 }
 
-static void memset_alloc_mem(void **dst, size_t length)
+static void memset_alloc_mem(void **dst, size_t size)
 {
-	*dst = zalloc(length);
+	*dst = zalloc(size);
 	if (!*dst)
-		die("memory allocation failed - maybe length is too large?\n");
+		die("memory allocation failed - maybe size is too large?\n");
 }
 
-static u64 do_memset_cycles(const struct routine *r, size_t len)
+static u64 do_memset_cycles(const struct routine *r, size_t size)
 {
 	u64 cycle_start = 0ULL, cycle_end = 0ULL;
 	memset_t fn = r->fn.memset;
 	void *dst = NULL;
 	int i;
 
-	memset_alloc_mem(&dst, len);
+	memset_alloc_mem(&dst, size);
 
 	/*
 	 * We prefault the freshly allocated memory range here,
 	 * to not measure page fault overhead:
 	 */
-	fn(dst, -1, len);
+	fn(dst, -1, size);
 
 	cycle_start = get_cycles();
 	for (i = 0; i < iterations; ++i)
-		fn(dst, i, len);
+		fn(dst, i, size);
 	cycle_end = get_cycles();
 
 	free(dst);
 	return cycle_end - cycle_start;
 }
 
-static double do_memset_gettimeofday(const struct routine *r, size_t len)
+static double do_memset_gettimeofday(const struct routine *r, size_t size)
 {
 	struct timeval tv_start, tv_end, tv_diff;
 	memset_t fn = r->fn.memset;
 	void *dst = NULL;
 	int i;
 
-	memset_alloc_mem(&dst, len);
+	memset_alloc_mem(&dst, size);
 
 	/*
 	 * We prefault the freshly allocated memory range here,
 	 * to not measure page fault overhead:
 	 */
-	fn(dst, -1, len);
+	fn(dst, -1, size);
 
 	BUG_ON(gettimeofday(&tv_start, NULL));
 	for (i = 0; i < iterations; ++i)
-		fn(dst, i, len);
+		fn(dst, i, size);
 	BUG_ON(gettimeofday(&tv_end, NULL));
 
 	timersub(&tv_end, &tv_start, &tv_diff);
 
 	free(dst);
-	return (double)(((double)len * iterations) / timeval2double(&tv_diff));
+	return (double)(((double)size * iterations) / timeval2double(&tv_diff));
 }
 
 static const char * const bench_mem_memset_usage[] = {
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 12/23] perf bench mem: Improve user visible strings
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (10 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 11/23] perf bench mem: Fix 'length' vs. 'size' naming confusion Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 13/23] perf bench mem: Reorganize the code a bit Arnaldo Carvalho de Melo
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

 - fix various typos in user visible output strings
 - make the output consistent (wrt. capitalization and spelling)
 - offer the list of routines to benchmark on '-r help'.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-11-git-send-email-mingo@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/mem-functions.c | 29 +++++++++++++++++------------
 tools/perf/builtin-bench.c       |  6 +++---
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index 1605249d2912..318da3421e69 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -32,13 +32,17 @@ static int		cycles_fd;
 static const struct option options[] = {
 	OPT_STRING('l', "size", &size_str, "1MB",
 		    "Specify the size of the memory buffers. "
-		    "Available units: B, KB, MB, GB and TB (upper and lower)"),
+		    "Available units: B, KB, MB, GB and TB (case insensitive)"),
+
 	OPT_STRING('r', "routine", &routine_str, "all",
-		    "Specify the routine to run, \"all\" runs all available routines"),
+		    "Specify the routine to run, \"all\" runs all available routines, \"help\" lists them"),
+
 	OPT_INTEGER('i', "iterations", &iterations,
-		    "repeat memcpy() invocation this number of times"),
+		    "Repeat the function this number of times"),
+
 	OPT_BOOLEAN('c', "cycles", &use_cycles,
 		    "Use a cycles event instead of gettimeofday() to measure performance"),
+
 	OPT_END()
 };
 
@@ -106,13 +110,13 @@ static double timeval2double(struct timeval *ts)
 
 #define print_bps(x) do {						\
 		if (x < K)						\
-			printf(" %14lf B/Sec\n", x);			\
+			printf(" %14lf bytes/sec\n", x);		\
 		else if (x < K * K)					\
-			printf(" %14lfd KB/Sec\n", x / K);		\
+			printf(" %14lfd KB/sec\n", x / K);		\
 		else if (x < K * K * K)					\
-			printf(" %14lf MB/Sec\n", x / K / K);		\
+			printf(" %14lf MB/sec\n", x / K / K);		\
 		else							\
-			printf(" %14lf GB/Sec\n", x / K / K / K);	\
+			printf(" %14lf GB/sec\n", x / K / K / K);	\
 	} while (0)
 
 struct bench_mem_info {
@@ -128,10 +132,10 @@ static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t s
 	double result_bps = 0.0;
 	u64 result_cycles = 0;
 
-	printf("Routine %s (%s)\n", r->name, r->desc);
+	printf("# Routine '%s' (%s)\n", r->name, r->desc);
 
 	if (bench_format == BENCH_FORMAT_DEFAULT)
-		printf("# Copying %s Bytes ...\n\n", size_str);
+		printf("# Copying %s bytes ...\n\n", size_str);
 
 	if (use_cycles) {
 		result_cycles = info->do_cycles(r, size);
@@ -142,7 +146,7 @@ static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t s
 	switch (bench_format) {
 	case BENCH_FORMAT_DEFAULT:
 		if (use_cycles) {
-			printf(" %14lf cycles/Byte\n", (double)result_cycles/size_total);
+			printf(" %14lf cycles/byte\n", (double)result_cycles/size_total);
 		} else {
 			print_bps(result_bps);
 		}
@@ -192,8 +196,9 @@ static int bench_mem_common(int argc, const char **argv, struct bench_mem_info *
 			break;
 	}
 	if (!info->routines[i].name) {
-		printf("Unknown routine: %s\n", routine_str);
-		printf("Available routines...\n");
+		if (strcmp(routine_str, "help") && strcmp(routine_str, "h"))
+			printf("Unknown routine: %s\n", routine_str);
+		printf("Available routines:\n");
 		for (i = 0; info->routines[i].name; i++) {
 			printf("\t%s ... %s\n",
 			       info->routines[i].name, info->routines[i].desc);
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index 1b585213ba5a..a8fc948c8ace 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -49,9 +49,9 @@ static struct bench sched_benchmarks[] = {
 };
 
 static struct bench mem_benchmarks[] = {
-	{ "memcpy",	"Benchmark for memcpy()",			bench_mem_memcpy	},
-	{ "memset",	"Benchmark for memset() tests",			bench_mem_memset	},
-	{ "all",	"Test all memory benchmarks",			NULL			},
+	{ "memcpy",	"Benchmark for memcpy() functions",		bench_mem_memcpy	},
+	{ "memset",	"Benchmark for memset() functions",		bench_mem_memset	},
+	{ "all",	"Test all memory access benchmarks",		NULL			},
 	{ NULL,		NULL,						NULL			}
 };
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 13/23] perf bench mem: Reorganize the code a bit
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (11 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 12/23] perf bench mem: Improve user visible strings Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 14/23] perf bench: Harmonize all the -l/--nr_loops options Arnaldo Carvalho de Melo
                   ` (10 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

Reorder functions a bit, so that we synchronize the layout of the
memcpy() and memset() portions of the code.

This improves the code, especially after we'll add an strlcpy() variant
as well.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-12-git-send-email-mingo@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/mem-functions.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index 318da3421e69..8d980d4a64e5 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -58,25 +58,6 @@ struct routine {
 	} fn;
 };
 
-struct routine memcpy_routines[] = {
-	{ .name		= "default",
-	  .desc		= "Default memcpy() provided by glibc",
-	  .fn.memcpy	= memcpy },
-
-#ifdef HAVE_ARCH_X86_64_SUPPORT
-# define MEMCPY_FN(_fn, _name, _desc) {.name = _name, .desc = _desc, .fn.memcpy = _fn},
-# include "mem-memcpy-x86-64-asm-def.h"
-# undef MEMCPY_FN
-#endif
-
-	{ NULL, }
-};
-
-static const char * const bench_mem_memcpy_usage[] = {
-	"perf bench mem memcpy <options>",
-	NULL
-};
-
 static struct perf_event_attr cycle_attr = {
 	.type		= PERF_TYPE_HARDWARE,
 	.config		= PERF_COUNT_HW_CPU_CYCLES
@@ -278,6 +259,25 @@ static double do_memcpy_gettimeofday(const struct routine *r, size_t size)
 	return (double)(((double)size * iterations) / timeval2double(&tv_diff));
 }
 
+struct routine memcpy_routines[] = {
+	{ .name		= "default",
+	  .desc		= "Default memcpy() provided by glibc",
+	  .fn.memcpy	= memcpy },
+
+#ifdef HAVE_ARCH_X86_64_SUPPORT
+# define MEMCPY_FN(_fn, _name, _desc) {.name = _name, .desc = _desc, .fn.memcpy = _fn},
+# include "mem-memcpy-x86-64-asm-def.h"
+# undef MEMCPY_FN
+#endif
+
+	{ NULL, }
+};
+
+static const char * const bench_mem_memcpy_usage[] = {
+	"perf bench mem memcpy <options>",
+	NULL
+};
+
 int bench_mem_memcpy(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	struct bench_mem_info info = {
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 14/23] perf bench: Harmonize all the -l/--nr_loops options
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (12 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 13/23] perf bench mem: Reorganize the code a bit Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 15/23] perf bench mem: Rename 'routine' to 'function' Arnaldo Carvalho de Melo
                   ` (9 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

We have three benchmarking subsystems that specify some sort of 'number
of loops' parameter - but all of them do it inconsistently:

 numa:              -l/--nr_loops
 sched messaging:   -l/--loops
 mem memset/memcpy: -i/--iterations

Harmonize them to -l/--nr_loops by picking the numa variant - which is
also the most likely one to have existing scripting which we don't want
to break.

Plus improve the parameter help texts to indicate the default value for
the nr_loops variable to keep users from guessing ...

Also propagate the naming to internal variables.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-13-git-send-email-mingo@kernel.org
[ Let the harmonisation reach the perf-bench man page as well ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-bench.txt | 10 +++++-----
 tools/perf/bench/mem-functions.c        | 22 +++++++++++-----------
 tools/perf/bench/numa.c                 |  4 ++--
 tools/perf/bench/sched-messaging.c      | 10 +++++-----
 4 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/tools/perf/Documentation/perf-bench.txt b/tools/perf/Documentation/perf-bench.txt
index bbd27d89b50a..ddfb3e10e88c 100644
--- a/tools/perf/Documentation/perf-bench.txt
+++ b/tools/perf/Documentation/perf-bench.txt
@@ -82,7 +82,7 @@ Be multi thread instead of multi process
 Specify number of groups
 
 -l::
---loop=::
+--nr_loops=::
 Specify number of loops
 
 Example of *messaging*
@@ -149,8 +149,8 @@ Specify routine to copy (default: default).
 Available routines are depend on the architecture.
 On x86-64, x86-64-unrolled, x86-64-movsq and x86-64-movsb are supported.
 
--i::
---iterations::
+-l::
+--nr_loops::
 Repeat memcpy invocation this number of times.
 
 -c::
@@ -173,8 +173,8 @@ Specify routine to set (default: default).
 Available routines are depend on the architecture.
 On x86-64, x86-64-unrolled, x86-64-stosq and x86-64-stosb are supported.
 
--i::
---iterations::
+-l::
+--nr_loops::
 Repeat memset invocation this number of times.
 
 -c::
diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index 8d980d4a64e5..c5dfabdbd8d0 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -25,20 +25,20 @@
 
 static const char	*size_str	= "1MB";
 static const char	*routine_str	= "all";
-static int		iterations	= 1;
+static int		nr_loops	= 1;
 static bool		use_cycles;
 static int		cycles_fd;
 
 static const struct option options[] = {
-	OPT_STRING('l', "size", &size_str, "1MB",
+	OPT_STRING('s', "size", &size_str, "1MB",
 		    "Specify the size of the memory buffers. "
 		    "Available units: B, KB, MB, GB and TB (case insensitive)"),
 
 	OPT_STRING('r', "routine", &routine_str, "all",
 		    "Specify the routine to run, \"all\" runs all available routines, \"help\" lists them"),
 
-	OPT_INTEGER('i', "iterations", &iterations,
-		    "Repeat the function this number of times"),
+	OPT_INTEGER('l', "nr_loops", &nr_loops,
+		    "Specify the number of loops to run. (default: 1)"),
 
 	OPT_BOOLEAN('c', "cycles", &use_cycles,
 		    "Use a cycles event instead of gettimeofday() to measure performance"),
@@ -159,7 +159,7 @@ static int bench_mem_common(int argc, const char **argv, struct bench_mem_info *
 		init_cycles();
 
 	size = (size_t)perf_atoll((char *)size_str);
-	size_total = (double)size * iterations;
+	size_total = (double)size * nr_loops;
 
 	if ((s64)size <= 0) {
 		fprintf(stderr, "Invalid size:%s\n", size_str);
@@ -222,7 +222,7 @@ static u64 do_memcpy_cycles(const struct routine *r, size_t size)
 	fn(dst, src, size);
 
 	cycle_start = get_cycles();
-	for (i = 0; i < iterations; ++i)
+	for (i = 0; i < nr_loops; ++i)
 		fn(dst, src, size);
 	cycle_end = get_cycles();
 
@@ -247,7 +247,7 @@ static double do_memcpy_gettimeofday(const struct routine *r, size_t size)
 	fn(dst, src, size);
 
 	BUG_ON(gettimeofday(&tv_start, NULL));
-	for (i = 0; i < iterations; ++i)
+	for (i = 0; i < nr_loops; ++i)
 		fn(dst, src, size);
 	BUG_ON(gettimeofday(&tv_end, NULL));
 
@@ -256,7 +256,7 @@ static double do_memcpy_gettimeofday(const struct routine *r, size_t size)
 	free(src);
 	free(dst);
 
-	return (double)(((double)size * iterations) / timeval2double(&tv_diff));
+	return (double)(((double)size * nr_loops) / timeval2double(&tv_diff));
 }
 
 struct routine memcpy_routines[] = {
@@ -313,7 +313,7 @@ static u64 do_memset_cycles(const struct routine *r, size_t size)
 	fn(dst, -1, size);
 
 	cycle_start = get_cycles();
-	for (i = 0; i < iterations; ++i)
+	for (i = 0; i < nr_loops; ++i)
 		fn(dst, i, size);
 	cycle_end = get_cycles();
 
@@ -337,14 +337,14 @@ static double do_memset_gettimeofday(const struct routine *r, size_t size)
 	fn(dst, -1, size);
 
 	BUG_ON(gettimeofday(&tv_start, NULL));
-	for (i = 0; i < iterations; ++i)
+	for (i = 0; i < nr_loops; ++i)
 		fn(dst, i, size);
 	BUG_ON(gettimeofday(&tv_end, NULL));
 
 	timersub(&tv_end, &tv_start, &tv_diff);
 
 	free(dst);
-	return (double)(((double)size * iterations) / timeval2double(&tv_diff));
+	return (double)(((double)size * nr_loops) / timeval2double(&tv_diff));
 }
 
 static const char * const bench_mem_memset_usage[] = {
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index 870b7e665a20..492df2752a2d 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -164,8 +164,8 @@ static const struct option options[] = {
 	OPT_STRING('L', "mb_proc_locked", &p0.mb_proc_locked_str,"MB", "process serialized/locked memory access (MBs), <= process_memory"),
 	OPT_STRING('T', "mb_thread"	, &p0.mb_thread_str,	"MB", "thread  memory (MBs)"),
 
-	OPT_UINTEGER('l', "nr_loops"	, &p0.nr_loops,		"max number of loops to run"),
-	OPT_UINTEGER('s', "nr_secs"	, &p0.nr_secs,		"max number of seconds to run"),
+	OPT_UINTEGER('l', "nr_loops"	, &p0.nr_loops,		"max number of loops to run (default: unlimited)"),
+	OPT_UINTEGER('s', "nr_secs"	, &p0.nr_secs,		"max number of seconds to run (default: 5 secs)"),
 	OPT_UINTEGER('u', "usleep"	, &p0.sleep_usecs,	"usecs to sleep per loop iteration"),
 
 	OPT_BOOLEAN('R', "data_reads"	, &p0.data_reads,	"access the data via writes (can be mixed with -W)"),
diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
index d7f281c2828d..d4ff1b539cfd 100644
--- a/tools/perf/bench/sched-messaging.c
+++ b/tools/perf/bench/sched-messaging.c
@@ -33,7 +33,7 @@
 #define DATASIZE 100
 
 static bool use_pipes = false;
-static unsigned int loops = 100;
+static unsigned int nr_loops = 100;
 static bool thread_mode = false;
 static unsigned int num_groups = 10;
 
@@ -79,7 +79,7 @@ static void ready(int ready_out, int wakefd)
 		err(EXIT_FAILURE, "poll");
 }
 
-/* Sender sprays loops messages down each file descriptor */
+/* Sender sprays nr_loops messages down each file descriptor */
 static void *sender(struct sender_context *ctx)
 {
 	char data[DATASIZE];
@@ -88,7 +88,7 @@ static void *sender(struct sender_context *ctx)
 	ready(ctx->ready_out, ctx->wakefd);
 
 	/* Now pump to every receiver. */
-	for (i = 0; i < loops; i++) {
+	for (i = 0; i < nr_loops; i++) {
 		for (j = 0; j < ctx->num_fds; j++) {
 			int ret, done = 0;
 
@@ -213,7 +213,7 @@ static unsigned int group(pthread_t *pth,
 		/* Create the pipe between client and server */
 		fdpair(fds);
 
-		ctx->num_packets = num_fds * loops;
+		ctx->num_packets = num_fds * nr_loops;
 		ctx->in_fds[0] = fds[0];
 		ctx->in_fds[1] = fds[1];
 		ctx->ready_out = ready_out;
@@ -250,7 +250,7 @@ static const struct option options[] = {
 	OPT_BOOLEAN('t', "thread", &thread_mode,
 		    "Be multi thread instead of multi process"),
 	OPT_UINTEGER('g', "group", &num_groups, "Specify number of groups"),
-	OPT_UINTEGER('l', "loop", &loops, "Specify number of loops"),
+	OPT_UINTEGER('l', "nr_loops", &nr_loops, "Specify the number of loops to run (default: 100)"),
 	OPT_END()
 };
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 15/23] perf bench mem: Rename 'routine' to 'function'
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (13 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 14/23] perf bench: Harmonize all the -l/--nr_loops options Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 16/23] perf bench: Run benchmarks, don't test them Arnaldo Carvalho de Melo
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

So right now there's a somewhat inconsistent mess of the benchmarking
code and options sometimes calling benchmarked functions 'functions',
sometimes calling them 'routines'.

Name them 'functions' consistently.

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-14-git-send-email-mingo@kernel.org
[ Updated perf-bench man page, pointed out by David Ahern ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-bench.txt | 16 ++++-----
 tools/perf/bench/mem-functions.c        | 60 ++++++++++++++++-----------------
 2 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/tools/perf/Documentation/perf-bench.txt b/tools/perf/Documentation/perf-bench.txt
index ddfb3e10e88c..34750fc32714 100644
--- a/tools/perf/Documentation/perf-bench.txt
+++ b/tools/perf/Documentation/perf-bench.txt
@@ -143,10 +143,10 @@ Options of *memcpy*
 Specify size of memory to copy (default: 1MB).
 Available units are B, KB, MB, GB and TB (case insensitive).
 
--r::
---routine::
-Specify routine to copy (default: default).
-Available routines are depend on the architecture.
+-f::
+--function::
+Specify function to copy (default: default).
+Available functions are depend on the architecture.
 On x86-64, x86-64-unrolled, x86-64-movsq and x86-64-movsb are supported.
 
 -l::
@@ -167,10 +167,10 @@ Options of *memset*
 Specify size of memory to set (default: 1MB).
 Available units are B, KB, MB, GB and TB (case insensitive).
 
--r::
---routine::
-Specify routine to set (default: default).
-Available routines are depend on the architecture.
+-f::
+--function::
+Specify function to set (default: default).
+Available functions are depend on the architecture.
 On x86-64, x86-64-unrolled, x86-64-stosq and x86-64-stosb are supported.
 
 -l::
diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index c5dfabdbd8d0..d1de9c4a7ddf 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -24,7 +24,7 @@
 #define K 1024
 
 static const char	*size_str	= "1MB";
-static const char	*routine_str	= "all";
+static const char	*function_str	= "all";
 static int		nr_loops	= 1;
 static bool		use_cycles;
 static int		cycles_fd;
@@ -34,8 +34,8 @@ static const struct option options[] = {
 		    "Specify the size of the memory buffers. "
 		    "Available units: B, KB, MB, GB and TB (case insensitive)"),
 
-	OPT_STRING('r', "routine", &routine_str, "all",
-		    "Specify the routine to run, \"all\" runs all available routines, \"help\" lists them"),
+	OPT_STRING('f', "function", &function_str, "all",
+		    "Specify the function to run, \"all\" runs all available functions, \"help\" lists them"),
 
 	OPT_INTEGER('l', "nr_loops", &nr_loops,
 		    "Specify the number of loops to run. (default: 1)"),
@@ -49,7 +49,7 @@ static const struct option options[] = {
 typedef void *(*memcpy_t)(void *, const void *, size_t);
 typedef void *(*memset_t)(void *, int, size_t);
 
-struct routine {
+struct function {
 	const char *name;
 	const char *desc;
 	union {
@@ -101,19 +101,19 @@ static double timeval2double(struct timeval *ts)
 	} while (0)
 
 struct bench_mem_info {
-	const struct routine *routines;
-	u64 (*do_cycles)(const struct routine *r, size_t size);
-	double (*do_gettimeofday)(const struct routine *r, size_t size);
+	const struct function *functions;
+	u64 (*do_cycles)(const struct function *r, size_t size);
+	double (*do_gettimeofday)(const struct function *r, size_t size);
 	const char *const *usage;
 };
 
-static void __bench_mem_routine(struct bench_mem_info *info, int r_idx, size_t size, double size_total)
+static void __bench_mem_function(struct bench_mem_info *info, int r_idx, size_t size, double size_total)
 {
-	const struct routine *r = &info->routines[r_idx];
+	const struct function *r = &info->functions[r_idx];
 	double result_bps = 0.0;
 	u64 result_cycles = 0;
 
-	printf("# Routine '%s' (%s)\n", r->name, r->desc);
+	printf("# function '%s' (%s)\n", r->name, r->desc);
 
 	if (bench_format == BENCH_FORMAT_DEFAULT)
 		printf("# Copying %s bytes ...\n\n", size_str);
@@ -166,28 +166,28 @@ static int bench_mem_common(int argc, const char **argv, struct bench_mem_info *
 		return 1;
 	}
 
-	if (!strncmp(routine_str, "all", 3)) {
-		for (i = 0; info->routines[i].name; i++)
-			__bench_mem_routine(info, i, size, size_total);
+	if (!strncmp(function_str, "all", 3)) {
+		for (i = 0; info->functions[i].name; i++)
+			__bench_mem_function(info, i, size, size_total);
 		return 0;
 	}
 
-	for (i = 0; info->routines[i].name; i++) {
-		if (!strcmp(info->routines[i].name, routine_str))
+	for (i = 0; info->functions[i].name; i++) {
+		if (!strcmp(info->functions[i].name, function_str))
 			break;
 	}
-	if (!info->routines[i].name) {
-		if (strcmp(routine_str, "help") && strcmp(routine_str, "h"))
-			printf("Unknown routine: %s\n", routine_str);
-		printf("Available routines:\n");
-		for (i = 0; info->routines[i].name; i++) {
+	if (!info->functions[i].name) {
+		if (strcmp(function_str, "help") && strcmp(function_str, "h"))
+			printf("Unknown function: %s\n", function_str);
+		printf("Available functions:\n");
+		for (i = 0; info->functions[i].name; i++) {
 			printf("\t%s ... %s\n",
-			       info->routines[i].name, info->routines[i].desc);
+			       info->functions[i].name, info->functions[i].desc);
 		}
 		return 1;
 	}
 
-	__bench_mem_routine(info, i, size, size_total);
+	__bench_mem_function(info, i, size, size_total);
 
 	return 0;
 }
@@ -206,7 +206,7 @@ static void memcpy_alloc_mem(void **dst, void **src, size_t size)
 	memset(*src, 0, size);
 }
 
-static u64 do_memcpy_cycles(const struct routine *r, size_t size)
+static u64 do_memcpy_cycles(const struct function *r, size_t size)
 {
 	u64 cycle_start = 0ULL, cycle_end = 0ULL;
 	void *src = NULL, *dst = NULL;
@@ -231,7 +231,7 @@ static u64 do_memcpy_cycles(const struct routine *r, size_t size)
 	return cycle_end - cycle_start;
 }
 
-static double do_memcpy_gettimeofday(const struct routine *r, size_t size)
+static double do_memcpy_gettimeofday(const struct function *r, size_t size)
 {
 	struct timeval tv_start, tv_end, tv_diff;
 	memcpy_t fn = r->fn.memcpy;
@@ -259,7 +259,7 @@ static double do_memcpy_gettimeofday(const struct routine *r, size_t size)
 	return (double)(((double)size * nr_loops) / timeval2double(&tv_diff));
 }
 
-struct routine memcpy_routines[] = {
+struct function memcpy_functions[] = {
 	{ .name		= "default",
 	  .desc		= "Default memcpy() provided by glibc",
 	  .fn.memcpy	= memcpy },
@@ -281,7 +281,7 @@ static const char * const bench_mem_memcpy_usage[] = {
 int bench_mem_memcpy(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	struct bench_mem_info info = {
-		.routines		= memcpy_routines,
+		.functions		= memcpy_functions,
 		.do_cycles		= do_memcpy_cycles,
 		.do_gettimeofday	= do_memcpy_gettimeofday,
 		.usage			= bench_mem_memcpy_usage,
@@ -297,7 +297,7 @@ static void memset_alloc_mem(void **dst, size_t size)
 		die("memory allocation failed - maybe size is too large?\n");
 }
 
-static u64 do_memset_cycles(const struct routine *r, size_t size)
+static u64 do_memset_cycles(const struct function *r, size_t size)
 {
 	u64 cycle_start = 0ULL, cycle_end = 0ULL;
 	memset_t fn = r->fn.memset;
@@ -321,7 +321,7 @@ static u64 do_memset_cycles(const struct routine *r, size_t size)
 	return cycle_end - cycle_start;
 }
 
-static double do_memset_gettimeofday(const struct routine *r, size_t size)
+static double do_memset_gettimeofday(const struct function *r, size_t size)
 {
 	struct timeval tv_start, tv_end, tv_diff;
 	memset_t fn = r->fn.memset;
@@ -352,7 +352,7 @@ static const char * const bench_mem_memset_usage[] = {
 	NULL
 };
 
-static const struct routine memset_routines[] = {
+static const struct function memset_functions[] = {
 	{ .name		= "default",
 	  .desc		= "Default memset() provided by glibc",
 	  .fn.memset	= memset },
@@ -369,7 +369,7 @@ static const struct routine memset_routines[] = {
 int bench_mem_memset(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	struct bench_mem_info info = {
-		.routines		= memset_routines,
+		.functions		= memset_functions,
 		.do_cycles		= do_memset_cycles,
 		.do_gettimeofday	= do_memset_gettimeofday,
 		.usage			= bench_mem_memset_usage,
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 16/23] perf bench: Run benchmarks, don't test them
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (14 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 15/23] perf bench mem: Rename 'routine' to 'function' Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 17/23] perf help: Change 'usage' to 'Usage' for consistency Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Hitoshi Mitake, Jiri Olsa,
	Linus Torvalds, Namhyung Kim, Peter Zijlstra, Thomas Gleixner,
	Arnaldo Carvalho de Melo

From: Ingo Molnar <mingo@kernel.org>

So right now we output this text:

        memcpy: Benchmark for memcpy() functions
        memset: Benchmark for memset() functions
           all: Test all memory access benchmarks

But the right verb to use with benchmarks is to 'run' them, not 'test'
them.

So change this (and all similar texts) to:

        memcpy: Benchmark for memcpy() functions
        memset: Benchmark for memset() functions
           all: Run all memory access benchmarks

Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1445241870-24854-15-git-send-email-mingo@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-bench.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index a8fc948c8ace..b17aed36ca16 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -36,7 +36,7 @@ struct bench {
 #ifdef HAVE_LIBNUMA_SUPPORT
 static struct bench numa_benchmarks[] = {
 	{ "mem",	"Benchmark for NUMA workloads",			bench_numa		},
-	{ "all",	"Test all NUMA benchmarks",			NULL			},
+	{ "all",	"Run all NUMA benchmarks",			NULL			},
 	{ NULL,		NULL,						NULL			}
 };
 #endif
@@ -44,14 +44,14 @@ static struct bench numa_benchmarks[] = {
 static struct bench sched_benchmarks[] = {
 	{ "messaging",	"Benchmark for scheduling and IPC",		bench_sched_messaging	},
 	{ "pipe",	"Benchmark for pipe() between two processes",	bench_sched_pipe	},
-	{ "all",	"Test all scheduler benchmarks",		NULL			},
+	{ "all",	"Run all scheduler benchmarks",		NULL			},
 	{ NULL,		NULL,						NULL			}
 };
 
 static struct bench mem_benchmarks[] = {
 	{ "memcpy",	"Benchmark for memcpy() functions",		bench_mem_memcpy	},
 	{ "memset",	"Benchmark for memset() functions",		bench_mem_memset	},
-	{ "all",	"Test all memory access benchmarks",		NULL			},
+	{ "all",	"Run all memory access benchmarks",		NULL			},
 	{ NULL,		NULL,						NULL			}
 };
 
@@ -62,7 +62,7 @@ static struct bench futex_benchmarks[] = {
 	{ "requeue",	"Benchmark for futex requeue calls",            bench_futex_requeue	},
 	/* pi-futexes */
 	{ "lock-pi",	"Benchmark for futex lock_pi calls",            bench_futex_lock_pi	},
-	{ "all",	"Test all futex benchmarks",			NULL			},
+	{ "all",	"Run all futex benchmarks",			NULL			},
 	{ NULL,		NULL,						NULL			}
 };
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 17/23] perf help: Change 'usage' to 'Usage' for consistency
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (15 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 16/23] perf bench: Run benchmarks, don't test them Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 18/23] perf stat: Rename perf_stat struct into perf_stat_evsel Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Adrian Hunter, David Ahern, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Ramkumar Ramachandra,
	Sriram Raghunathan, Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

Capitalize 'usage' to make it consistent with all the other 'Usage' in
the codes, e.g., usage_builtin.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Sriram Raghunathan <sriram.r@nokia.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1444894792-2338-3-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-help.c       | 2 +-
 tools/perf/util/parse-options.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 36486eade1ef..a7d588bf3cdd 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -463,7 +463,7 @@ int cmd_help(int argc, const char **argv, const char *prefix __maybe_unused)
 			builtin_help_subcommands, builtin_help_usage, 0);
 
 	if (show_all) {
-		printf("\n usage: %s\n\n", perf_usage_string);
+		printf("\n Usage: %s\n\n", perf_usage_string);
 		list_commands("perf commands", &main_cmds, &other_cmds);
 		printf(" %s\n\n", perf_more_info_string);
 		return 0;
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
index 9a38b05f0273..8aa7922397a9 100644
--- a/tools/perf/util/parse-options.c
+++ b/tools/perf/util/parse-options.c
@@ -648,7 +648,7 @@ int usage_with_options_internal(const char * const *usagestr,
 	if (!usagestr)
 		return PARSE_OPT_HELP;
 
-	fprintf(stderr, "\n usage: %s\n", *usagestr++);
+	fprintf(stderr, "\n Usage: %s\n", *usagestr++);
 	while (*usagestr && **usagestr)
 		fprintf(stderr, "    or: %s\n", *usagestr++);
 	while (*usagestr) {
@@ -684,7 +684,7 @@ int parse_options_usage(const char * const *usagestr,
 	if (!usagestr)
 		goto opt;
 
-	fprintf(stderr, "\n usage: %s\n", *usagestr++);
+	fprintf(stderr, "\n Usage: %s\n", *usagestr++);
 	while (*usagestr && **usagestr)
 		fprintf(stderr, "    or: %s\n", *usagestr++);
 	while (*usagestr) {
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 18/23] perf stat: Rename perf_stat struct into perf_stat_evsel
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (16 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 17/23] perf help: Change 'usage' to 'Usage' for consistency Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 19/23] perf stat: Add AGGR_UNSET mode Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

It's used as the perf_evsel::priv data, so the name suits better. Also
we'll need the perf_stat name free for more generic struct.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Kan Liang <kan.liang@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444992092-17897-29-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c |  4 ++--
 tools/perf/util/stat.c    | 10 +++++-----
 tools/perf/util/stat.h    |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 5ef88f760b12..184057295970 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -434,7 +434,7 @@ static void print_noise_pct(double total, double avg)
 
 static void print_noise(struct perf_evsel *evsel, double avg)
 {
-	struct perf_stat *ps;
+	struct perf_stat_evsel *ps;
 
 	if (run_count == 1)
 		return;
@@ -671,7 +671,7 @@ static void print_aggr_thread(struct perf_evsel *counter, char *prefix)
 static void print_counter_aggr(struct perf_evsel *counter, char *prefix)
 {
 	FILE *output = stat_config.output;
-	struct perf_stat *ps = counter->priv;
+	struct perf_stat_evsel *ps = counter->priv;
 	double avg = avg_stats(&ps->res_stats[0]);
 	int scaled = counter->counts->scaled;
 	double uval;
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 2d065d065b67..93e6d697e574 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -67,7 +67,7 @@ double rel_stddev_stats(double stddev, double avg)
 bool __perf_evsel_stat__is(struct perf_evsel *evsel,
 			   enum perf_stat_evsel_id id)
 {
-	struct perf_stat *ps = evsel->priv;
+	struct perf_stat_evsel *ps = evsel->priv;
 
 	return ps->id == id;
 }
@@ -84,7 +84,7 @@ static const char *id_str[PERF_STAT_EVSEL_ID__MAX] = {
 
 void perf_stat_evsel_id_init(struct perf_evsel *evsel)
 {
-	struct perf_stat *ps = evsel->priv;
+	struct perf_stat_evsel *ps = evsel->priv;
 	int i;
 
 	/* ps->id is 0 hence PERF_STAT_EVSEL_ID__NONE by default */
@@ -100,7 +100,7 @@ void perf_stat_evsel_id_init(struct perf_evsel *evsel)
 void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
 {
 	int i;
-	struct perf_stat *ps = evsel->priv;
+	struct perf_stat_evsel *ps = evsel->priv;
 
 	for (i = 0; i < 3; i++)
 		init_stats(&ps->res_stats[i]);
@@ -110,7 +110,7 @@ void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
 
 int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
 {
-	evsel->priv = zalloc(sizeof(struct perf_stat));
+	evsel->priv = zalloc(sizeof(struct perf_stat_evsel));
 	if (evsel->priv == NULL)
 		return -ENOMEM;
 	perf_evsel__reset_stat_priv(evsel);
@@ -304,7 +304,7 @@ int perf_stat_process_counter(struct perf_stat_config *config,
 			      struct perf_evsel *counter)
 {
 	struct perf_counts_values *aggr = &counter->counts->aggr;
-	struct perf_stat *ps = counter->priv;
+	struct perf_stat_evsel *ps = counter->priv;
 	u64 *count = counter->counts->aggr.values;
 	int i, ret;
 
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
index 62448c8175d3..f8d9d5ce24a9 100644
--- a/tools/perf/util/stat.h
+++ b/tools/perf/util/stat.h
@@ -20,7 +20,7 @@ enum perf_stat_evsel_id {
 	PERF_STAT_EVSEL_ID__MAX,
 };
 
-struct perf_stat {
+struct perf_stat_evsel {
 	struct stats		res_stats[3];
 	enum perf_stat_evsel_id	id;
 };
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 19/23] perf stat: Add AGGR_UNSET mode
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (17 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 18/23] perf stat: Rename perf_stat struct into perf_stat_evsel Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 20/23] perf cpu_map: Make cpu_map__build_map global Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Adding AGGR_UNSET mode, so we could distinguish unset aggr_mode in
following patches.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Kan Liang <kan.liang@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444992092-17897-30-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c | 5 +++++
 tools/perf/util/stat.c    | 1 +
 tools/perf/util/stat.h    | 1 +
 3 files changed, 7 insertions(+)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 184057295970..abeb15aebd12 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -479,6 +479,7 @@ static void aggr_printout(struct perf_evsel *evsel, int id, int nr)
 			csv_sep);
 		break;
 	case AGGR_GLOBAL:
+	case AGGR_UNSET:
 	default:
 		break;
 	}
@@ -799,6 +800,8 @@ static void print_interval(char *prefix, struct timespec *ts)
 		case AGGR_GLOBAL:
 		default:
 			fprintf(output, "#           time             counts %*s events\n", unit_width, "unit");
+		case AGGR_UNSET:
+			break;
 		}
 	}
 
@@ -880,6 +883,7 @@ static void print_counters(struct timespec *ts, int argc, const char **argv)
 		evlist__for_each(evsel_list, counter)
 			print_counter(counter, prefix);
 		break;
+	case AGGR_UNSET:
 	default:
 		break;
 	}
@@ -960,6 +964,7 @@ static int perf_stat_init_aggr_mode(void)
 	case AGGR_NONE:
 	case AGGR_GLOBAL:
 	case AGGR_THREAD:
+	case AGGR_UNSET:
 	default:
 		break;
 	}
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 93e6d697e574..837374181ec7 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -272,6 +272,7 @@ process_counter_values(struct perf_stat_config *config, struct perf_evsel *evsel
 			aggr->ena += count->ena;
 			aggr->run += count->run;
 		}
+	case AGGR_UNSET:
 	default:
 		break;
 	}
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
index f8d9d5ce24a9..da1d11c4f8c1 100644
--- a/tools/perf/util/stat.h
+++ b/tools/perf/util/stat.h
@@ -31,6 +31,7 @@ enum aggr_mode {
 	AGGR_SOCKET,
 	AGGR_CORE,
 	AGGR_THREAD,
+	AGGR_UNSET,
 };
 
 struct perf_stat_config {
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 20/23] perf cpu_map: Make cpu_map__build_map global
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (18 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 19/23] perf stat: Add AGGR_UNSET mode Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 21/23] perf cpu_map: Add data arg to cpu_map__build_map callback Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

We'll need to call it from perf stat in the stat_script patchkit

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Kan Liang <kan.liang@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444992092-17897-40-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/cpumap.c | 4 ++--
 tools/perf/util/cpumap.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index c51c29fd0732..70ec8d031f9d 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -258,8 +258,8 @@ static int cmp_ids(const void *a, const void *b)
 	return *(int *)a - *(int *)b;
 }
 
-static int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res,
-			      int (*f)(struct cpu_map *map, int cpu))
+int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res,
+		       int (*f)(struct cpu_map *map, int cpu))
 {
 	struct cpu_map *c;
 	int nr = cpus->nr;
diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h
index 8982d538da83..6e36fc35eca6 100644
--- a/tools/perf/util/cpumap.h
+++ b/tools/perf/util/cpumap.h
@@ -87,4 +87,6 @@ static inline int cpu__get_node(int cpu)
 	return cpunode_map[cpu];
 }
 
+int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res,
+		       int (*f)(struct cpu_map *map, int cpu));
 #endif /* __PERF_CPUMAP_H */
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 21/23] perf cpu_map: Add data arg to cpu_map__build_map callback
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (19 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 20/23] perf cpu_map: Make cpu_map__build_map global Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 22/23] perf script: Check output fields only for samples Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Adding data arg to cpu_map__build_map callback, so we could pass data
along to the callback. It'll be needed in following patches to retrieve
topology info from perf.data.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Kan Liang <kan.liang@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444992092-17897-41-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c   | 14 ++++++++++++--
 tools/perf/tests/topology.c |  4 ++--
 tools/perf/util/cpumap.c    | 15 ++++++++-------
 tools/perf/util/cpumap.h    |  7 ++++---
 tools/perf/util/stat.c      |  2 +-
 5 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index abeb15aebd12..91e793a76929 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -944,6 +944,16 @@ static int stat__set_big_num(const struct option *opt __maybe_unused,
 	return 0;
 }
 
+static int perf_stat__get_socket(struct cpu_map *map, int cpu)
+{
+	return cpu_map__get_socket(map, cpu, NULL);
+}
+
+static int perf_stat__get_core(struct cpu_map *map, int cpu)
+{
+	return cpu_map__get_core(map, cpu, NULL);
+}
+
 static int perf_stat_init_aggr_mode(void)
 {
 	switch (stat_config.aggr_mode) {
@@ -952,14 +962,14 @@ static int perf_stat_init_aggr_mode(void)
 			perror("cannot build socket map");
 			return -1;
 		}
-		aggr_get_id = cpu_map__get_socket;
+		aggr_get_id = perf_stat__get_socket;
 		break;
 	case AGGR_CORE:
 		if (cpu_map__build_core_map(evsel_list->cpus, &aggr_map)) {
 			perror("cannot build core map");
 			return -1;
 		}
-		aggr_get_id = cpu_map__get_core;
+		aggr_get_id = perf_stat__get_core;
 		break;
 	case AGGR_NONE:
 	case AGGR_GLOBAL:
diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
index c3aff53a976a..f5bb096c3bd9 100644
--- a/tools/perf/tests/topology.c
+++ b/tools/perf/tests/topology.c
@@ -73,10 +73,10 @@ static int check_cpu_topology(char *path, struct cpu_map *map)
 
 	for (i = 0; i < map->nr; i++) {
 		TEST_ASSERT_VAL("Core ID doesn't match",
-			(session->header.env.cpu[map->map[i]].core_id == (cpu_map__get_core(map, i) & 0xffff)));
+			(session->header.env.cpu[map->map[i]].core_id == (cpu_map__get_core(map, i, NULL) & 0xffff)));
 
 		TEST_ASSERT_VAL("Socket ID doesn't match",
-			(session->header.env.cpu[map->map[i]].socket_id == cpu_map__get_socket(map, i)));
+			(session->header.env.cpu[map->map[i]].socket_id == cpu_map__get_socket(map, i, NULL)));
 	}
 
 	perf_session__delete(session);
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index 70ec8d031f9d..b36845347f01 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -241,7 +241,7 @@ int cpu_map__get_socket_id(int cpu)
 	return ret ?: value;
 }
 
-int cpu_map__get_socket(struct cpu_map *map, int idx)
+int cpu_map__get_socket(struct cpu_map *map, int idx, void *data __maybe_unused)
 {
 	int cpu;
 
@@ -259,7 +259,8 @@ static int cmp_ids(const void *a, const void *b)
 }
 
 int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res,
-		       int (*f)(struct cpu_map *map, int cpu))
+		       int (*f)(struct cpu_map *map, int cpu, void *data),
+		       void *data)
 {
 	struct cpu_map *c;
 	int nr = cpus->nr;
@@ -271,7 +272,7 @@ int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res,
 		return -1;
 
 	for (cpu = 0; cpu < nr; cpu++) {
-		s1 = f(cpus, cpu);
+		s1 = f(cpus, cpu, data);
 		for (s2 = 0; s2 < c->nr; s2++) {
 			if (s1 == c->map[s2])
 				break;
@@ -295,7 +296,7 @@ int cpu_map__get_core_id(int cpu)
 	return ret ?: value;
 }
 
-int cpu_map__get_core(struct cpu_map *map, int idx)
+int cpu_map__get_core(struct cpu_map *map, int idx, void *data)
 {
 	int cpu, s;
 
@@ -306,7 +307,7 @@ int cpu_map__get_core(struct cpu_map *map, int idx)
 
 	cpu = cpu_map__get_core_id(cpu);
 
-	s = cpu_map__get_socket(map, idx);
+	s = cpu_map__get_socket(map, idx, data);
 	if (s == -1)
 		return -1;
 
@@ -321,12 +322,12 @@ int cpu_map__get_core(struct cpu_map *map, int idx)
 
 int cpu_map__build_socket_map(struct cpu_map *cpus, struct cpu_map **sockp)
 {
-	return cpu_map__build_map(cpus, sockp, cpu_map__get_socket);
+	return cpu_map__build_map(cpus, sockp, cpu_map__get_socket, NULL);
 }
 
 int cpu_map__build_core_map(struct cpu_map *cpus, struct cpu_map **corep)
 {
-	return cpu_map__build_map(cpus, corep, cpu_map__get_core);
+	return cpu_map__build_map(cpus, corep, cpu_map__get_core, NULL);
 }
 
 /* setup simple routines to easily access node numbers given a cpu number */
diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h
index 6e36fc35eca6..f1bcd2cfa164 100644
--- a/tools/perf/util/cpumap.h
+++ b/tools/perf/util/cpumap.h
@@ -19,9 +19,9 @@ struct cpu_map *cpu_map__dummy_new(void);
 struct cpu_map *cpu_map__read(FILE *file);
 size_t cpu_map__fprintf(struct cpu_map *map, FILE *fp);
 int cpu_map__get_socket_id(int cpu);
-int cpu_map__get_socket(struct cpu_map *map, int idx);
+int cpu_map__get_socket(struct cpu_map *map, int idx, void *data);
 int cpu_map__get_core_id(int cpu);
-int cpu_map__get_core(struct cpu_map *map, int idx);
+int cpu_map__get_core(struct cpu_map *map, int idx, void *data);
 int cpu_map__build_socket_map(struct cpu_map *cpus, struct cpu_map **sockp);
 int cpu_map__build_core_map(struct cpu_map *cpus, struct cpu_map **corep);
 
@@ -88,5 +88,6 @@ static inline int cpu__get_node(int cpu)
 }
 
 int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res,
-		       int (*f)(struct cpu_map *map, int cpu));
+		       int (*f)(struct cpu_map *map, int cpu, void *data),
+		       void *data);
 #endif /* __PERF_CPUMAP_H */
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 837374181ec7..2d9d8306dbd3 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -230,7 +230,7 @@ static int check_per_pkg(struct perf_evsel *counter,
 	if (!(vals->run && vals->ena))
 		return 0;
 
-	s = cpu_map__get_socket(cpus, cpu);
+	s = cpu_map__get_socket(cpus, cpu, NULL);
 	if (s < 0)
 		return -1;
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 22/23] perf script: Check output fields only for samples
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (20 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 21/23] perf cpu_map: Add data arg to cpu_map__build_map callback Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-19 21:39 ` [PATCH 23/23] perf bench: Use named initializers in the trailer too Arnaldo Carvalho de Melo
  2015-10-20  7:32 ` [GIT PULL 00/23] perf/core improvements and fixes Ingo Molnar
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

There's no need to check sampling output fields for events without
perf_event_attr::sample_type field set.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Kan Liang <kan.liang@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444992092-17897-51-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 8ce1c6bbfa45..2653c0273b89 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -686,7 +686,10 @@ static int process_attr(struct perf_tool *tool, union perf_event *event,
 
 	set_print_ip_opts(&evsel->attr);
 
-	return perf_evsel__check_attr(evsel, scr->session);
+	if (evsel->attr.sample_type)
+		err = perf_evsel__check_attr(evsel, scr->session);
+
+	return err;
 }
 
 static int process_comm_event(struct perf_tool *tool,
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 23/23] perf bench: Use named initializers in the trailer too
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (21 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 22/23] perf script: Check output fields only for samples Arnaldo Carvalho de Melo
@ 2015-10-19 21:39 ` Arnaldo Carvalho de Melo
  2015-10-20  7:32 ` [GIT PULL 00/23] perf/core improvements and fixes Ingo Molnar
  23 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-19 21:39 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Hitoshi Mitake, Jiri Olsa, Linus Torvalds, Namhyung Kim,
	Peter Zijlstra, Thomas Gleixner

From: Arnaldo Carvalho de Melo <acme@redhat.com>

To avoid this splat with gcc 4.4.7:

  cc1: warnings being treated as errors
  bench/mem-functions.c:273: error: missing initializer
  bench/mem-functions.c:273: error: (near initialization for ‘memcpy_functions[4].desc’)
  bench/mem-functions.c:366: error: missing initializer
  bench/mem-functions.c:366: error: (near initialization for ‘memset_functions[4].desc’)

Cc: David Ahern <dsahern@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/n/tip-0s8o6tgw1pdwvdv02llb9tkd@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/mem-functions.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index d1de9c4a7ddf..9419b944220f 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -270,7 +270,7 @@ struct function memcpy_functions[] = {
 # undef MEMCPY_FN
 #endif
 
-	{ NULL, }
+	{ .name = NULL, }
 };
 
 static const char * const bench_mem_memcpy_usage[] = {
@@ -363,7 +363,7 @@ static const struct function memset_functions[] = {
 # undef MEMSET_FN
 #endif
 
-	{ NULL, }
+	{ .name = NULL, }
 };
 
 int bench_mem_memset(int argc, const char **argv, const char *prefix __maybe_unused)
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [GIT PULL 00/23] perf/core improvements and fixes
  2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (22 preceding siblings ...)
  2015-10-19 21:39 ` [PATCH 23/23] perf bench: Use named initializers in the trailer too Arnaldo Carvalho de Melo
@ 2015-10-20  7:32 ` Ingo Molnar
  23 siblings, 0 replies; 30+ messages in thread
From: Ingo Molnar @ 2015-10-20  7:32 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Andrew Morton, David Ahern,
	Hitoshi Mitake, Jiri Olsa, Kan Liang, Linus Torvalds,
	Namhyung Kim, Peter Zijlstra, Ramkumar Ramachandra,
	Sriram Raghunathan, Thomas Gleixner, Wang Nan, Yunlong Song,
	Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit e9363deeb286e916353f11b11d1f351c6ff54082:
> 
>   Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-10-14 15:06:33 +0200)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
> 
> for you to fetch changes up to a4c6a3e8bbb675a601f529881c51ff226f83c3f1:
> 
>   perf bench: Use named initializers in the trailer too (2015-10-19 18:17:25 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - 'perf bench mem' now prefaults unconditionally, no sense in
>   providing modes where page faults are measured (Ingo Molnar)
> 
> - Harmonize -l/--nr_loops accross 'perf bench' (Ingo Molnar)
> 
> - Various 'perf bench' consistency improvements (Ingo Molnar)
> 
> - Suppress libtraceevent warnings in non-verbose 'perf test' mode
>   (Namhyung Kim)
> 
> - Move some tracepoint event test error messages to the verbose mode
>   of 'perf test' (Namhyung Kim)
> 
> - Make 'perf help' usage message consistent with other tools (Yunlong Song)
> 
> Build fixes:
> 
> - Fix 'perf bench' build with gcc 4.4.7 (Arnaldo Carvalho de Melo)
> 
> Infrastructure:
> 
> - 'perf stat' prep work for the 'perf stat scripting' patchkit (Jiri Olsa)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (1):
>       perf bench: Use named initializers in the trailer too
> 
> Ingo Molnar (14):
>       perf bench: Improve the 'perf bench mem memcpy' code readability
>       perf bench: Default to all routines in 'perf bench mem'
>       perf bench: Eliminate unused argument from bench_mem_common()
>       perf bench: Rename 'mem-memcpy.c' => 'mem-functions.c'
>       perf bench: Remove the prefaulting complication from 'perf bench mem mem*'
>       perf bench: List output formatting options on 'perf bench -h'
>       perf bench mem: Change 'cycle' to 'cycles'
>       perf bench mem: Rename 'routine' to 'routine_str'
>       perf bench mem: Fix 'length' vs. 'size' naming confusion
>       perf bench mem: Improve user visible strings
>       perf bench mem: Reorganize the code a bit
>       perf bench: Harmonize all the -l/--nr_loops options
>       perf bench mem: Rename 'routine' to 'function'
>       perf bench: Run benchmarks, don't test them
> 
> Jiri Olsa (5):
>       perf stat: Rename perf_stat struct into perf_stat_evsel
>       perf stat: Add AGGR_UNSET mode
>       perf cpu_map: Make cpu_map__build_map global
>       perf cpu_map: Add data arg to cpu_map__build_map callback
>       perf script: Check output fields only for samples
> 
> Namhyung Kim (2):
>       perf test: Silence tracepoint event failures
>       perf test: Suppress libtraceevent warnings
> 
> Yunlong Song (1):
>       perf help: Change 'usage' to 'Usage' for consistency
> 
>  tools/perf/Documentation/perf-bench.txt     |  54 ++--
>  tools/perf/bench/Build                      |   2 +-
>  tools/perf/bench/mem-functions.c            | 379 ++++++++++++++++++++++++
>  tools/perf/bench/mem-memcpy.c               | 434 ----------------------------
>  tools/perf/bench/numa.c                     |   4 +-
>  tools/perf/bench/sched-messaging.c          |  10 +-
>  tools/perf/builtin-bench.c                  |  14 +-
>  tools/perf/builtin-help.c                   |   2 +-
>  tools/perf/builtin-script.c                 |   5 +-
>  tools/perf/builtin-stat.c                   |  23 +-
>  tools/perf/tests/openat-syscall-all-cpus.c  |   2 +-
>  tools/perf/tests/openat-syscall-tp-fields.c |   2 +-
>  tools/perf/tests/openat-syscall.c           |   2 +-
>  tools/perf/tests/parse-events.c             |  14 +
>  tools/perf/tests/topology.c                 |   4 +-
>  tools/perf/util/cpumap.c                    |  17 +-
>  tools/perf/util/cpumap.h                    |   7 +-
>  tools/perf/util/parse-options.c             |   4 +-
>  tools/perf/util/stat.c                      |  13 +-
>  tools/perf/util/stat.h                      |   3 +-
>  tools/perf/util/usage.c                     |   5 +
>  tools/perf/util/util.h                      |   1 +
>  22 files changed, 487 insertions(+), 514 deletions(-)
>  create mode 100644 tools/perf/bench/mem-functions.c
>  delete mode 100644 tools/perf/bench/mem-memcpy.c

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [GIT PULL 00/23] perf/core improvements and fixes
@ 2016-03-23 21:17 Arnaldo Carvalho de Melo
  2016-03-24  7:32 ` Ingo Molnar
  0 siblings, 1 reply; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-03-23 21:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Alexei Starovoitov, Andi Kleen,
	Cody P Schafer, David Ahern, He Kuang, Hemant Kumar, Jakub Jelen,
	Jan Stancek, Jiri Olsa, Josh Poimboeuf, Kan Liang, Kirill Smelkov,
	Li Zefan, Masami Hiramatsu, Namhyung Kim, Naveen N . Rao,
	Peter Zijlstra, pi3orama, Ravi Bangoria, Steven Rostedt,
	Sukadev Bhattiprolu, Wang Nan, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, test built on:

  [root@jouet ~]# dm
  alldeps-debian: Ok
  alldeps-mageia: Ok
  alldeps-rhel7: Ok
  alldeps-centos: Ok
  alldeps-opensuse: Ok
  alldeps-ubuntu: Ok
  [root@jouet ~]# 

	All the latest distro releases, updated (dnf/yum/apt-get/urpmi/zypper/etc
upgraded as of a few days ago) as available on docker.io/vendors.

- Arnaldo

The following changes since commit ced30bc9129777d715057d06fc8dbdfd3b81e94d:

  Merge tag 'perf-core-for-mingo-20160310' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-03-11 09:40:25 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-20160323

for you to fetch changes up to 76267147f233f347dbd8f4f8c05492e5ea0a7dce:

  perf llvm: Use strerror_r instead of the thread unsafe strerror one (2016-03-23 17:42:21 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

- Fix documentation of :ppp modifier in 'perf list' (Andi Kleen)

- Fix silly nodes bitfield bits/bytes length assertion in 'perf bench numa' (Jakub Jelen)

- Remove redundant CPU output in libtraceevent (Steven Rostedt)

- Remove 'core_id' check in topology 'perf test' (Sukadev Bhattiprolu)

Infrastructure:

- Record text offset in dso to calculate objdump address, to use with
  modules in addition to vDSO symbol address calculations (Wang Nan)

- Move utilities.mak from perf to tools/scripts/ (Arnaldo Carvalho de Melo)

- Add cpumode to the perf_sample struct, this way we don't need to pass
  the union event to the machine and thread resolving routines, shortening
  function signatures and allowing the future introduction of a way
  to use tracepoint events instead of the unavailable HW cycles counter on
  powerpc guests in perf kvm by just hooking on perf_evsel__parse_sample,
  at the end (Arnaldo Carvalho de Melo)

- Remove/unexport die() related infrastructure, that at some point will
  finally be removed (Arnaldo Carvalho de Melo)

- Adopt linux/stringify.h from the kernel sources, not to touch this
  kernel header from tools/ (Arnaldo Carvalho de Melo)

- Stop using strbuf for things we can instead trivially use libc's asprintf()
  (Arnaldo Carvalho de Melo)

- Ditch tools/lib/util/abspath.c, its only exported function was used at just
  one place and can be replaced by libc's realpath() (Arnaldo Carvalho de Melo)

- Use strerror_r() in the llvm infrastructure, tread safe, its what is used
  elsewhere in tools/perf/ (Arnaldo Carvalho de Melo)

Cleanups:

- Removed misplaced or needless __maybe_unused/export (Arnaldo Carvalho de Melo)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Andi Kleen (1):
      perf list: Fix documentation of :ppp

Arnaldo Carvalho de Melo (18):
      tools: Move utilities.mak from perf to tools/scripts/
      perf tools: Remove misplaced __maybe_unused
      perf tests: Forward the perf_sample in the dwarf unwind test
      perf tools: Add cpumode to struct perf_sample
      perf machine: Rename perf_event__preprocess_sample to machine__resolve
      perf thread: Rename perf_event__preprocess_sample_addr to thread__resolve
      perf script: Remove lots of unused arguments
      perf tools: Remove unused DIE_IF macro
      perf tools: Simplify die() mechanism
      perf tools: Remove needless 'extern' from function prototypes
      tools include: Copy linux/stringify.h from the kernel
      perf tools: Do not include stringify.h from the kernel sources
      perf tools: Remove unused perf_pathdup, xstrdup functions
      perf help: Use asprintf instead of adhoc equivalents
      perf probe: No need to use formatting strbuf method
      perf tools: Unexport some methods unused outside strbuf.c
      perf llvm: Use realpath to canonicalize paths
      perf llvm: Use strerror_r instead of the thread unsafe strerror one

Jakub Jelen (1):
      perf bench numa: Fix assertion for nodes bitfield

Steven Rostedt (1):
      tools lib traceevent: Remove redundant CPU output

Sukadev Bhattiprolu (1):
      perf test: Remove 'core_id' check in topo test

Wang Nan (1):
      perf symbols: Record text offset in dso to calculate objdump address

 tools/include/linux/stringify.h              | 12 +++++
 tools/lib/api/Makefile                       |  2 +-
 tools/lib/subcmd/Makefile                    |  2 +-
 tools/lib/traceevent/event-parse.c           |  4 +-
 tools/perf/Documentation/Makefile            |  2 +-
 tools/perf/Documentation/perf-list.txt       |  6 ++-
 tools/perf/Makefile.perf                     |  2 +-
 tools/perf/arch/powerpc/util/header.c        |  4 +-
 tools/perf/bench/bench.h                     | 22 ++++-----
 tools/perf/bench/mem-memcpy-arch.h           |  2 +-
 tools/perf/bench/mem-memset-arch.h           |  2 +-
 tools/perf/bench/numa.c                      |  2 +-
 tools/perf/builtin-annotate.c                |  2 +-
 tools/perf/builtin-diff.c                    |  2 +-
 tools/perf/builtin-help.c                    | 69 ++++++++++++--------------
 tools/perf/builtin-inject.c                  |  8 +---
 tools/perf/builtin-mem.c                     |  2 +-
 tools/perf/builtin-report.c                  |  3 +-
 tools/perf/builtin-script.c                  | 46 +++++++-----------
 tools/perf/builtin-timechart.c               |  2 +-
 tools/perf/builtin-top.c                     |  8 ++--
 tools/perf/builtin-trace.c                   |  9 ++--
 tools/perf/builtin.h                         | 64 ++++++++++++-------------
 tools/perf/config/Makefile                   |  2 +-
 tools/perf/tests/code-reading.c              |  5 +-
 tools/perf/tests/dwarf-unwind.c              |  4 +-
 tools/perf/tests/hists_common.c              |  6 ++-
 tools/perf/tests/hists_cumulate.c            |  9 +---
 tools/perf/tests/hists_filter.c              |  9 +---
 tools/perf/tests/hists_link.c                | 20 ++------
 tools/perf/tests/hists_output.c              |  9 +---
 tools/perf/ui/gtk/hists.c                    |  2 +-
 tools/perf/util/Build                        |  1 -
 tools/perf/util/abspath.c                    | 37 --------------
 tools/perf/util/annotate.h                   |  2 +-
 tools/perf/util/auxtrace.h                   |  2 +-
 tools/perf/util/build-id.c                   |  3 +-
 tools/perf/util/cache.h                      | 24 ++++------
 tools/perf/util/callchain.h                  |  4 +-
 tools/perf/util/cgroup.h                     |  4 +-
 tools/perf/util/cloexec.h                    |  2 +-
 tools/perf/util/data-convert-bt.c            |  2 +-
 tools/perf/util/db-export.c                  |  2 +-
 tools/perf/util/dso.h                        |  3 +-
 tools/perf/util/dwarf-aux.c                  | 10 ++--
 tools/perf/util/dwarf-aux.h                  | 72 ++++++++++++++--------------
 tools/perf/util/event.c                      | 23 ++++-----
 tools/perf/util/event.h                      | 13 ++---
 tools/perf/util/evsel.c                      |  1 +
 tools/perf/util/genelf.h                     |  8 ++--
 tools/perf/util/header.c                     |  5 --
 tools/perf/util/header.h                     |  2 +-
 tools/perf/util/hist.c                       |  2 +-
 tools/perf/util/hist.h                       |  3 +-
 tools/perf/util/intel-bts.c                  |  2 +-
 tools/perf/util/jit.h                        | 12 ++---
 tools/perf/util/llvm-utils.c                 | 24 ++++++----
 tools/perf/util/llvm-utils.h                 |  7 ++-
 tools/perf/util/machine.c                    | 14 +++---
 tools/perf/util/machine.h                    |  2 +-
 tools/perf/util/parse-events.h               | 21 ++++----
 tools/perf/util/path.c                       | 30 ------------
 tools/perf/util/probe-event.c                |  2 +-
 tools/perf/util/probe-event.h                | 57 ++++++++++------------
 tools/perf/util/probe-finder.c               |  8 ++--
 tools/perf/util/probe-finder.h               | 24 +++++-----
 tools/perf/util/quote.h                      |  2 +-
 tools/perf/util/session.c                    |  5 +-
 tools/perf/util/sort.c                       |  2 +-
 tools/perf/util/stat-shadow.c                | 18 ++++---
 tools/perf/util/strbuf.c                     |  9 +++-
 tools/perf/util/strbuf.h                     | 21 ++++----
 tools/perf/util/svghelper.h                  | 51 ++++++++++----------
 tools/perf/util/symbol-elf.c                 | 12 ++---
 tools/perf/util/symbol.h                     |  4 +-
 tools/perf/util/usage.c                      |  8 +---
 tools/perf/util/util.h                       | 27 ++++-------
 tools/perf/util/wrapper.c                    | 12 -----
 tools/{perf/config => scripts}/utilities.mak |  0
 79 files changed, 385 insertions(+), 557 deletions(-)
 create mode 100644 tools/include/linux/stringify.h
 delete mode 100644 tools/perf/util/abspath.c
 rename tools/{perf/config => scripts}/utilities.mak (100%)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [GIT PULL 00/23] perf/core improvements and fixes
  2016-03-23 21:17 Arnaldo Carvalho de Melo
@ 2016-03-24  7:32 ` Ingo Molnar
  0 siblings, 0 replies; 30+ messages in thread
From: Ingo Molnar @ 2016-03-24  7:32 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexander Shishkin,
	Alexei Starovoitov, Andi Kleen, Cody P Schafer, David Ahern,
	He Kuang, Hemant Kumar, Jakub Jelen, Jan Stancek, Jiri Olsa,
	Josh Poimboeuf, Kan Liang, Kirill Smelkov, Li Zefan,
	Masami Hiramatsu, Namhyung Kim, Naveen N . Rao, Peter Zijlstra,
	pi3orama, Ravi Bangoria, Steven Rostedt, Sukadev Bhattiprolu,
	Wang Nan, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling, test built on:
> 
>   [root@jouet ~]# dm
>   alldeps-debian: Ok
>   alldeps-mageia: Ok
>   alldeps-rhel7: Ok
>   alldeps-centos: Ok
>   alldeps-opensuse: Ok
>   alldeps-ubuntu: Ok
>   [root@jouet ~]# 
> 
> 	All the latest distro releases, updated (dnf/yum/apt-get/urpmi/zypper/etc
> upgraded as of a few days ago) as available on docker.io/vendors.
> 
> - Arnaldo
> 
> The following changes since commit ced30bc9129777d715057d06fc8dbdfd3b81e94d:
> 
>   Merge tag 'perf-core-for-mingo-20160310' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-03-11 09:40:25 +0100)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-20160323
> 
> for you to fetch changes up to 76267147f233f347dbd8f4f8c05492e5ea0a7dce:
> 
>   perf llvm: Use strerror_r instead of the thread unsafe strerror one (2016-03-23 17:42:21 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Fix documentation of :ppp modifier in 'perf list' (Andi Kleen)
> 
> - Fix silly nodes bitfield bits/bytes length assertion in 'perf bench numa' (Jakub Jelen)
> 
> - Remove redundant CPU output in libtraceevent (Steven Rostedt)
> 
> - Remove 'core_id' check in topology 'perf test' (Sukadev Bhattiprolu)
> 
> Infrastructure:
> 
> - Record text offset in dso to calculate objdump address, to use with
>   modules in addition to vDSO symbol address calculations (Wang Nan)
> 
> - Move utilities.mak from perf to tools/scripts/ (Arnaldo Carvalho de Melo)
> 
> - Add cpumode to the perf_sample struct, this way we don't need to pass
>   the union event to the machine and thread resolving routines, shortening
>   function signatures and allowing the future introduction of a way
>   to use tracepoint events instead of the unavailable HW cycles counter on
>   powerpc guests in perf kvm by just hooking on perf_evsel__parse_sample,
>   at the end (Arnaldo Carvalho de Melo)
> 
> - Remove/unexport die() related infrastructure, that at some point will
>   finally be removed (Arnaldo Carvalho de Melo)
> 
> - Adopt linux/stringify.h from the kernel sources, not to touch this
>   kernel header from tools/ (Arnaldo Carvalho de Melo)
> 
> - Stop using strbuf for things we can instead trivially use libc's asprintf()
>   (Arnaldo Carvalho de Melo)
> 
> - Ditch tools/lib/util/abspath.c, its only exported function was used at just
>   one place and can be replaced by libc's realpath() (Arnaldo Carvalho de Melo)
> 
> - Use strerror_r() in the llvm infrastructure, tread safe, its what is used
>   elsewhere in tools/perf/ (Arnaldo Carvalho de Melo)
> 
> Cleanups:
> 
> - Removed misplaced or needless __maybe_unused/export (Arnaldo Carvalho de Melo)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Andi Kleen (1):
>       perf list: Fix documentation of :ppp
> 
> Arnaldo Carvalho de Melo (18):
>       tools: Move utilities.mak from perf to tools/scripts/
>       perf tools: Remove misplaced __maybe_unused
>       perf tests: Forward the perf_sample in the dwarf unwind test
>       perf tools: Add cpumode to struct perf_sample
>       perf machine: Rename perf_event__preprocess_sample to machine__resolve
>       perf thread: Rename perf_event__preprocess_sample_addr to thread__resolve
>       perf script: Remove lots of unused arguments
>       perf tools: Remove unused DIE_IF macro
>       perf tools: Simplify die() mechanism
>       perf tools: Remove needless 'extern' from function prototypes
>       tools include: Copy linux/stringify.h from the kernel
>       perf tools: Do not include stringify.h from the kernel sources
>       perf tools: Remove unused perf_pathdup, xstrdup functions
>       perf help: Use asprintf instead of adhoc equivalents
>       perf probe: No need to use formatting strbuf method
>       perf tools: Unexport some methods unused outside strbuf.c
>       perf llvm: Use realpath to canonicalize paths
>       perf llvm: Use strerror_r instead of the thread unsafe strerror one
> 
> Jakub Jelen (1):
>       perf bench numa: Fix assertion for nodes bitfield
> 
> Steven Rostedt (1):
>       tools lib traceevent: Remove redundant CPU output
> 
> Sukadev Bhattiprolu (1):
>       perf test: Remove 'core_id' check in topo test
> 
> Wang Nan (1):
>       perf symbols: Record text offset in dso to calculate objdump address
> 
>  tools/include/linux/stringify.h              | 12 +++++
>  tools/lib/api/Makefile                       |  2 +-
>  tools/lib/subcmd/Makefile                    |  2 +-
>  tools/lib/traceevent/event-parse.c           |  4 +-
>  tools/perf/Documentation/Makefile            |  2 +-
>  tools/perf/Documentation/perf-list.txt       |  6 ++-
>  tools/perf/Makefile.perf                     |  2 +-
>  tools/perf/arch/powerpc/util/header.c        |  4 +-
>  tools/perf/bench/bench.h                     | 22 ++++-----
>  tools/perf/bench/mem-memcpy-arch.h           |  2 +-
>  tools/perf/bench/mem-memset-arch.h           |  2 +-
>  tools/perf/bench/numa.c                      |  2 +-
>  tools/perf/builtin-annotate.c                |  2 +-
>  tools/perf/builtin-diff.c                    |  2 +-
>  tools/perf/builtin-help.c                    | 69 ++++++++++++--------------
>  tools/perf/builtin-inject.c                  |  8 +---
>  tools/perf/builtin-mem.c                     |  2 +-
>  tools/perf/builtin-report.c                  |  3 +-
>  tools/perf/builtin-script.c                  | 46 +++++++-----------
>  tools/perf/builtin-timechart.c               |  2 +-
>  tools/perf/builtin-top.c                     |  8 ++--
>  tools/perf/builtin-trace.c                   |  9 ++--
>  tools/perf/builtin.h                         | 64 ++++++++++++-------------
>  tools/perf/config/Makefile                   |  2 +-
>  tools/perf/tests/code-reading.c              |  5 +-
>  tools/perf/tests/dwarf-unwind.c              |  4 +-
>  tools/perf/tests/hists_common.c              |  6 ++-
>  tools/perf/tests/hists_cumulate.c            |  9 +---
>  tools/perf/tests/hists_filter.c              |  9 +---
>  tools/perf/tests/hists_link.c                | 20 ++------
>  tools/perf/tests/hists_output.c              |  9 +---
>  tools/perf/ui/gtk/hists.c                    |  2 +-
>  tools/perf/util/Build                        |  1 -
>  tools/perf/util/abspath.c                    | 37 --------------
>  tools/perf/util/annotate.h                   |  2 +-
>  tools/perf/util/auxtrace.h                   |  2 +-
>  tools/perf/util/build-id.c                   |  3 +-
>  tools/perf/util/cache.h                      | 24 ++++------
>  tools/perf/util/callchain.h                  |  4 +-
>  tools/perf/util/cgroup.h                     |  4 +-
>  tools/perf/util/cloexec.h                    |  2 +-
>  tools/perf/util/data-convert-bt.c            |  2 +-
>  tools/perf/util/db-export.c                  |  2 +-
>  tools/perf/util/dso.h                        |  3 +-
>  tools/perf/util/dwarf-aux.c                  | 10 ++--
>  tools/perf/util/dwarf-aux.h                  | 72 ++++++++++++++--------------
>  tools/perf/util/event.c                      | 23 ++++-----
>  tools/perf/util/event.h                      | 13 ++---
>  tools/perf/util/evsel.c                      |  1 +
>  tools/perf/util/genelf.h                     |  8 ++--
>  tools/perf/util/header.c                     |  5 --
>  tools/perf/util/header.h                     |  2 +-
>  tools/perf/util/hist.c                       |  2 +-
>  tools/perf/util/hist.h                       |  3 +-
>  tools/perf/util/intel-bts.c                  |  2 +-
>  tools/perf/util/jit.h                        | 12 ++---
>  tools/perf/util/llvm-utils.c                 | 24 ++++++----
>  tools/perf/util/llvm-utils.h                 |  7 ++-
>  tools/perf/util/machine.c                    | 14 +++---
>  tools/perf/util/machine.h                    |  2 +-
>  tools/perf/util/parse-events.h               | 21 ++++----
>  tools/perf/util/path.c                       | 30 ------------
>  tools/perf/util/probe-event.c                |  2 +-
>  tools/perf/util/probe-event.h                | 57 ++++++++++------------
>  tools/perf/util/probe-finder.c               |  8 ++--
>  tools/perf/util/probe-finder.h               | 24 +++++-----
>  tools/perf/util/quote.h                      |  2 +-
>  tools/perf/util/session.c                    |  5 +-
>  tools/perf/util/sort.c                       |  2 +-
>  tools/perf/util/stat-shadow.c                | 18 ++++---
>  tools/perf/util/strbuf.c                     |  9 +++-
>  tools/perf/util/strbuf.h                     | 21 ++++----
>  tools/perf/util/svghelper.h                  | 51 ++++++++++----------
>  tools/perf/util/symbol-elf.c                 | 12 ++---
>  tools/perf/util/symbol.h                     |  4 +-
>  tools/perf/util/usage.c                      |  8 +---
>  tools/perf/util/util.h                       | 27 ++++-------
>  tools/perf/util/wrapper.c                    | 12 -----
>  tools/{perf/config => scripts}/utilities.mak |  0
>  79 files changed, 385 insertions(+), 557 deletions(-)
>  create mode 100644 tools/include/linux/stringify.h
>  delete mode 100644 tools/perf/util/abspath.c
>  rename tools/{perf/config => scripts}/utilities.mak (100%)

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [GIT PULL 00/23] perf/core improvements and fixes
@ 2017-01-25 13:53 Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-01-25 13:53 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Alexander Sverdlin, Alexei Starovoitov,
	Andi Kleen, Bintian Wang, Daniel Borkmann, David Ahern,
	Don Zickus, Frederic Weisbecker, He Kuang, Jeremy Eder, Jiri Olsa,
	Joe Mario, Joe Stringer, Markus Elfring, Masami Hiramatsu,
	Matija Glavinic Pecotic, Milian Wolff, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Ravi Bangoria, Stephane Eranian,
	Steven Rostedt, Wang Nan, Will Deacon, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

Test results at the end of this message, as usual.

The following changes since commit 9f6f941e25bad8fcffc24d10762962d62edba767:

  Merge tag 'perf-core-for-mingo-4.11-20170117' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-01-18 10:06:20 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.11-20170125

for you to fetch changes up to bb6457b8af267b92ba3e752d9ccb3a4d4965a912:

  perf ftrace: Make 'function_graph' be the default tracer (2017-01-25 10:37:27 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

New features:

- Disassemble x86 branch stacks using "-F brstackasm" and Intel PT
  traces with "-F asm" in 'perf script' using Intel's XED library.

  Since this is not widely available in pre-packaged forms in distros,
  it will not be automatically feature probed, needing to be explicitly
  enabled at perf build time using the XED=1 and optionally the XED_DIR
  make command line variables.

  See the changeset log messages and committer notes to see it in action
  (Andi Kleen)

- Introduce 'perf ftrace' a perf front end to the kernel's ftrace
  function and function_graph tracer, defaulting to the "function_graph"
  tracer, more work will be done in reviving this effort, forward porting
  it from its initial patch submission (Namhyung Kim)

- Add 'e' and 'c' hotkeys to expand/collapse call chains for a single
  hist entry in the 'perf report' and 'perf top' TUI (Jiri Olsa)

Fixes:

- Fix wrong register name for arm64, used in 'perf probe' (He Kuang)

- Fix map offsets in relocation in libbpf (Joe Stringer)

- Fix looking up dwarf unwind stack info (Matija Glavinic Pecotic)

Infrastructure:

- libbpf prog functions sync with what is exported via uapi (Joe Stringer)

Trivial:

- Remove unnecessary checks and assignments in 'perf probe's
  try_to_find_absolute_address() (Markus Elfring)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Andi Kleen (5):
      perf tools: Add probing for the XED disassembler library
      perf tools: Add one liner warning for disabled features
      perf tools: Add disassembler for x86 using the XED library
      perf script: Add support for printing assembler
      perf script: Add "brstackasm" output for branch stacks

Arnaldo Carvalho de Melo (3):
      perf scripting perl: Do not die() when not founding event for a type
      perf tools: Propagate perf_config() errors
      perf ftrace: Make 'function_graph' be the default tracer

He Kuang (1):
      perf probe: Fix wrong register name for arm64

Jiri Olsa (4):
      perf hists browser: Put hist_entry folding logic into single function
      perf hists browser: Add e/c hotkeys to expand/collapse callchain for current entry
      perf c2c report: Display Total records column in offset view
      perf c2c report: Coalesce by default only by pid,iaddr

Joe Stringer (4):
      tools lib bpf: Fix map offsets in relocation
      tools lib bpf: Define prog_type fns with macro
      tools lib bpf: Add set/is helpers for all prog types
      tools lib bpf: Add libbpf_get_error()

Markus Elfring (2):
      perf probe: Delete an unnecessary check in try_to_find_absolute_address()
      perf probe: Delete an unnecessary assignment in try_to_find_absolute_address()

Matija Glavinic Pecotic (1):
      perf unwind: Fix looking up dwarf unwind stack info

Namhyung Kim (3):
      perf util: Save pid-cmdline mapping into tracing header
      perf util: Add more debug message on failure path
      perf ftrace: Introduce new 'ftrace' tool

 tools/build/Makefile.feature                       |   4 +-
 tools/build/feature/Makefile                       |   6 +-
 tools/build/feature/test-all.c                     |  14 +
 tools/build/feature/test-xed.c                     |   9 +
 tools/lib/bpf/libbpf.c                             |  69 +++--
 tools/lib/bpf/libbpf.h                             |  14 +-
 tools/perf/Build                                   |   1 +
 tools/perf/Documentation/perf-c2c.txt              |   2 +-
 tools/perf/Documentation/perf-ftrace.txt           |  36 +++
 tools/perf/Documentation/perf-script.txt           |  15 +-
 tools/perf/Makefile.config                         |  29 ++
 tools/perf/Makefile.perf                           |   3 +
 tools/perf/arch/arm64/include/dwarf-regs-table.h   |  12 +-
 tools/perf/arch/x86/util/Build                     |   3 +
 tools/perf/arch/x86/util/dis.c                     |  86 ++++++
 tools/perf/builtin-c2c.c                           |   3 +-
 tools/perf/builtin-ftrace.c                        | 243 +++++++++++++++
 tools/perf/builtin-help.c                          |   6 +-
 tools/perf/builtin-kmem.c                          |   8 +-
 tools/perf/builtin-record.c                        |   4 +-
 tools/perf/builtin-report.c                        |   4 +-
 tools/perf/builtin-script.c                        | 338 ++++++++++++++++++++-
 tools/perf/builtin-top.c                           |   4 +-
 tools/perf/builtin.h                               |   1 +
 tools/perf/command-list.txt                        |   1 +
 tools/perf/perf.c                                  |  16 +-
 tools/perf/tests/llvm.c                            |   2 +-
 tools/perf/ui/browsers/hists.c                     |  60 ++--
 tools/perf/util/Build                              |   1 +
 tools/perf/util/callchain.c                        |  14 +-
 tools/perf/util/config.c                           |   9 +-
 tools/perf/util/data-convert-bt.c                  |   7 +-
 tools/perf/util/dis.c                              |  15 +
 tools/perf/util/dis.h                              |  23 ++
 tools/perf/util/dso.c                              |  48 ++-
 tools/perf/util/header.c                           |   4 +-
 tools/perf/util/hist.c                             |   4 +-
 tools/perf/util/intel-pt.c                         |   4 +-
 tools/perf/util/llvm-utils.c                       |   4 +-
 tools/perf/util/probe-event.c                      |  11 +-
 .../perf/util/scripting-engines/trace-event-perl.c |   6 +-
 tools/perf/util/trace-event-info.c                 |  33 +-
 tools/perf/util/trace-event-parse.c                |  17 ++
 tools/perf/util/trace-event-read.c                 |  77 ++++-
 tools/perf/util/trace-event.h                      |   1 +
 tools/perf/util/unwind-libunwind-local.c           |  54 +++-
 46 files changed, 1192 insertions(+), 133 deletions(-)
 create mode 100644 tools/build/feature/test-xed.c
 create mode 100644 tools/perf/Documentation/perf-ftrace.txt
 create mode 100644 tools/perf/arch/x86/util/dis.c
 create mode 100644 tools/perf/builtin-ftrace.c
 create mode 100644 tools/perf/util/dis.c
 create mode 100644 tools/perf/util/dis.h

Test results:

The first ones are container (docker) based builds of tools/perf with and
without libelf support, objtool where it is supported and samples/bpf/, ditto.

Several are cross builds, the ones with -x-ARCH, and the android one, and those
may not have all the features built, due to lack of multi-arch devel packages,
available and being used so far on just a few, like
debian:experimental-x-{arm64,mipsel}.

The 'perf test' one will perform a variety of tests exercising
tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands
with a variety of command line event specifications to then intercept the
sys_perf_event syscall to check that the perf_event_attr fields are set up as
expected, among a variety of other unit tests.

Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/
with a variety of feature sets, exercising the build with an incomplete set of
features as well as with a complete one. It is planned to have it run on each
of the containers mentioned above, using some container orchestration
infrastructure. Get in contact if interested in helping having this in place.

  # dm
   1 alpine:3.4: Ok
   2 android-ndk:r12b-arm: Ok
   3 archlinux:latest: Ok
   4 centos:5: Ok
   5 centos:6: Ok
   6 centos:7: Ok
   7 debian:7: Ok
   8 debian:8: Ok
   9 debian:experimental: Ok
  10 debian:experimental-x-arm64: Ok
  11 debian:experimental-x-mips: Ok
  12 debian:experimental-x-mips64: Ok
  13 debian:experimental-x-mipsel: Ok
  14 fedora:20: Ok
  15 fedora:21: Ok
  16 fedora:22: Ok
  17 fedora:23: Ok
  18 fedora:24: Ok
  19 fedora:24-x-ARC-uClibc: Ok
  20 fedora:25: Ok
  21 fedora:rawhide: Ok
  22 mageia:5: Ok
  23 opensuse:13.2: Ok
  24 opensuse:42.1: Ok
  25 opensuse:tumbleweed: Ok
  26 ubuntu:12.04.5: Ok
  27 ubuntu:14.04.4-x-linaro-arm64: Ok
  28 ubuntu:15.10: Ok
  29 ubuntu:16.04: Ok
  30 ubuntu:16.04-x-arm: Ok
  31 ubuntu:16.04-x-arm64: Ok
  32 ubuntu:16.04-x-powerpc: Ok
  33 ubuntu:16.04-x-powerpc64: Ok
  34 ubuntu:16.04-x-powerpc64el: Ok
  35 ubuntu:16.04-x-s390: Ok
  36 ubuntu:16.10: Ok
  # 

  # uname -a
  Linux jouet 4.9.0+ #2 SMP Wed Dec 21 11:54:44 BRT 2016 x86_64 x86_64 x86_64 GNU/Linux
  # perf test
   1: vmlinux symtab matches kallsyms            : Ok
   2: Detect openat syscall event                : Ok
   3: Detect openat syscall event on all cpus    : Ok
   4: Read samples using the mmap interface      : Ok
   5: Parse event definition strings             : Ok
   6: PERF_RECORD_* events & perf_sample fields  : Ok
   7: Parse perf pmu format                      : Ok
   8: DSO data read                              : Ok
   9: DSO data cache                             : Ok
  10: DSO data reopen                            : Ok
  11: Roundtrip evsel->name                      : Ok
  12: Parse sched tracepoints fields             : Ok
  13: syscalls:sys_enter_openat event fields     : Ok
  14: Setup struct perf_event_attr               : Ok
  15: Match and link multiple hists              : Ok
  16: 'import perf' in python                    : Ok
  17: Breakpoint overflow signal handler         : Ok
  18: Breakpoint overflow sampling               : Ok
  19: Number of exit events of a simple workload : Ok
  20: Software clock events period values        : Ok
  21: Object code reading                        : Ok
  22: Sample parsing                             : Ok
  23: Use a dummy software event to keep tracking: Ok
  24: Parse with no sample_id_all bit set        : Ok
  25: Filter hist entries                        : Ok
  26: Lookup mmap thread                         : Ok
  27: Share thread mg                            : Ok
  28: Sort output of hist entries                : Ok
  29: Cumulate child hist entries                : Ok
  30: Track with sched_switch                    : Ok
  31: Filter fds with revents mask in a fdarray  : Ok
  32: Add fd to a fdarray, making it autogrow    : Ok
  33: kmod_path__parse                           : Ok
  34: Thread map                                 : Ok
  35: LLVM search and compile                    :
  35.1: Basic BPF llvm compile                    : Ok
  35.2: kbuild searching                          : Ok
  35.3: Compile source for BPF prologue generation: Ok
  35.4: Compile source for BPF relocation         : Ok
  36: Session topology                           : Ok
  37: BPF filter                                 :
  37.1: Basic BPF filtering                      : Ok
  37.2: BPF prologue generation                  : Ok
  37.3: BPF relocation checker                   : Ok
  38: Synthesize thread map                      : Ok
  39: Remove thread map                          : Ok
  40: Synthesize cpu map                         : Ok
  41: Synthesize stat config                     : Ok
  42: Synthesize stat                            : Ok
  43: Synthesize stat round                      : Ok
  44: Synthesize attr update                     : Ok
  45: Event times                                : Ok
  46: Read backward ring buffer                  : Ok
  47: Print cpu map                              : Ok
  48: Probe SDT events                           : Ok
  49: is_printable_array                         : Ok
  50: Print bitmap                               : Ok
  51: perf hooks                                 : Ok
  52: builtin clang support                      : Skip (not compiled in)
  53: unit_number__scnprintf                     : Ok
  54: x86 rdpmc                                  : Ok
  55: Convert perf time to TSC                   : Ok
  56: DWARF unwind                               : Ok
  57: x86 instruction decoder - new instructions : Ok
  58: Intel cqm nmi context read                 : Skip
  #

  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/linux/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
              make_no_libbpf_O: make NO_LIBBPF=1
            make_no_demangle_O: make NO_DEMANGLE=1
                   make_tags_O: make tags
           make_no_libbionic_O: make NO_LIBBIONIC=1
                   make_help_O: make help
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
             make_no_libnuma_O: make NO_LIBNUMA=1
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
           make_no_libunwind_O: make NO_LIBUNWIND=1
                make_no_newt_O: make NO_NEWT=1
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
            make_no_auxtrace_O: make NO_AUXTRACE=1
         make_install_prefix_O: make install prefix=/tmp/krava
         make_with_clangllvm_O: make LIBCLANGLLVM=1
                  make_debug_O: make DEBUG=1
             make_util_map_o_O: make util/map.o
              make_no_libelf_O: make NO_LIBELF=1
            make_install_bin_O: make install-bin
           make_no_libpython_O: make NO_LIBPYTHON=1
                make_install_O: make install
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
                make_no_gtk2_O: make NO_GTK2=1
                   make_pure_O: make
             make_no_libperl_O: make NO_LIBPERL=1
               make_no_slang_O: make NO_SLANG=1
           make_no_backtrace_O: make NO_BACKTRACE=1
        make_with_babeltrace_O: make LIBBABELTRACE=1
       make_util_pmu_bison_o_O: make util/pmu-bison.o
            make_no_libaudit_O: make NO_LIBAUDIT=1
              make_clean_all_O: make clean all
                 make_perf_o_O: make perf.o
                 make_static_O: make LDFLAGS=-static
                    make_doc_O: make doc
                make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
  OK
  make: Leaving directory '/home/acme/git/linux/tools/perf'
  $ 

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [GIT PULL 00/23] perf/core improvements and fixes
@ 2017-06-20  1:54 Arnaldo Carvalho de Melo
  2017-06-20  8:50 ` Ingo Molnar
  0 siblings, 1 reply; 30+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-20  1:54 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Alexei Starovoitov, Andi Kleen, David Ahern,
	Frederic Weisbecker, Hendrik Brueckner, Jiri Olsa, Kan Liang,
	kernel-team, Kim Phillips, linux-arm-kernel, Mark Santaniello,
	Masami Hiramatsu, Mathieu Poirier, Milian Wolff, Namhyung Kim,
	Peter Zijlstra, Steven Rostedt, Taeung Song, Wang Nan, Yao Jin,
	Zefan Li, Arnaldo Carvalho de Melo

Hi Ingo,

	I merged tip/perf/urgent into tip/perf/core before rebasing with these
patches, please consider pulling, 

- Arnaldo

Test results at the end of this message, as usual.

The following changes since commit 8052bd8243e823a0954bcbafda8f91072598f13d:

  Merge remote-tracking branch 'tip/perf/urgent' into perf/core (2017-06-19 15:14:35 -0300)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.13-20170719

for you to fetch changes up to dfe1c6d7efa8ead6878b73216d4c891a28207528:

  perf config: Refactor the code using 'ret' variable in cmd_config() (2017-06-19 22:05:55 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

- Allow adding and removing fields to the default 'perf script' columns,
  using + or - as field prefixes to do so (Andi Kleen)

- Display titles in left frame in the annotate browser (Jin Yao)

- Allow resolving the DSO name with 'perf script -F brstack{sym,off},dso'
  (Mark Santaniello)

- Support function filtering in 'perf ftrace' (Namhyung Kim)

- Allow specifying function call depth in 'perf ftrace' (Namhyumg Kim)

Infrastructure:

- Adopt __noreturn, __printf, __scanf, noinline, __packed and __aligned
  __alignment__(()) markers, to make the tools/ source code base to be
  more compact and look more like kernel code (Arnaldo Carvalho de Melo)

- Remove unnecessary check in annotate_browser_write() (Jin Yao)

- Return arch from symbol__disassemble() so that callers, such as
  the annotate TUI browser to use arch specific formattings, such
  as the upcoming instruction micro-op fusion on Intel Core (Jin Yao)

- Remove superfluous check before use in the coresight code base (Kim
  Phillips)

- Remove unused SAMPLE_SIZE defines and BTS priv array (Kim Phillips)

- Error handling fix/tidy ups in 'perf config' (Taeung Song)

- Avoid error in the BPF proggie built with clang in 'perf test llvm'
  when PROFILE_ALL_BRANCHES is set (Wang Nan)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Andi Kleen (1):
      perf script: Allow adding and removing fields

Arnaldo Carvalho de Melo (7):
      tools: Adopt __noreturn from kernel sources
      tools: Adopt __printf from kernel sources
      tools: Adopt __scanf from kernel sources
      perf tools: Use __maybe_unused consistently
      tools: Adopt noinline from kernel sources
      tools: Adopt __packed from kernel sources
      tools: Adopt __aligned from kernel sources

Jin Yao (3):
      perf report: Remove unnecessary check in annotate_browser_write()
      perf annotate browser: Display titles in left frame
      perf annotate: Return arch from symbol__disassemble() and save it in browser

Kim Phillips (2):
      perf coresight: Remove superfluous check before use
      perf intel-pt/bts: Remove unused SAMPLE_SIZE defines and bts priv array

Mark Santaniello (2):
      perf script: Support -F brstack,dso and brstacksym,dso
      perf script: Support -F brstackoff,dso

Namhyung Kim (4):
      perf ftrace: Show error message when fails to set ftrace files
      perf ftrace: Move setup_pager before opening trace_pipe
      perf ftrace: Add option for function filtering
      perf ftrace: Add -D option for depth filter

Taeung Song (3):
      perf config: Invert an if statement to reduce nesting in cmd_config()
      perf config: Check error cases of {show_spec, set}_config()
      perf config: Refactor the code using 'ret' variable in cmd_config()

Wang Nan (1):
      perf test llvm: Avoid error when PROFILE_ALL_BRANCHES is set

 tools/include/linux/compiler-gcc.h                 |  10 ++
 tools/include/linux/compiler.h                     |   4 +
 tools/perf/Documentation/perf-ftrace.txt           |  33 +++++
 tools/perf/Documentation/perf-script.txt           |  12 +-
 tools/perf/arch/arm/util/cs-etm.c                  |  29 ++--
 tools/perf/arch/x86/util/intel-bts.c               |   4 -
 tools/perf/arch/x86/util/intel-pt.c                |   4 -
 tools/perf/bench/numa.c                            |   2 +-
 tools/perf/builtin-config.c                        |  67 +++++----
 tools/perf/builtin-ftrace.c                        | 159 +++++++++++++++++++--
 tools/perf/builtin-script.c                        | 146 +++++++++++++++++--
 tools/perf/builtin-top.c                           |   2 +-
 tools/perf/jvmti/jvmti_agent.h                     |   2 -
 tools/perf/jvmti/libjvmti.c                        |   5 +-
 tools/perf/pmu-events/jevents.c                    |   4 -
 tools/perf/tests/bp_signal.c                       |   3 +-
 tools/perf/tests/bp_signal_overflow.c              |   3 +-
 tools/perf/tests/bpf-script-test-prologue.c        |   9 ++
 tools/perf/tests/dwarf-unwind.c                    |  15 +-
 tools/perf/ui/browsers/annotate.c                  |  54 ++++---
 tools/perf/ui/gtk/annotate.c                       |   3 +-
 tools/perf/util/annotate.c                         |  10 +-
 tools/perf/util/annotate.h                         |   4 +-
 tools/perf/util/cache.h                            |   3 +-
 tools/perf/util/debug.h                            |  11 +-
 tools/perf/util/evlist.h                           |   3 +-
 tools/perf/util/evsel.c                            |   3 +-
 tools/perf/util/genelf_debug.c                     |   5 +-
 tools/perf/util/header.c                           |   3 +-
 tools/perf/util/intel-bts.c                        |   2 -
 tools/perf/util/intel-pt-decoder/intel-pt-log.h    |   4 +-
 tools/perf/util/pmu.h                              |   4 +-
 tools/perf/util/probe-event.h                      |   4 +-
 .../util/scripting-engines/trace-event-python.c    |   3 +-
 tools/perf/util/strbuf.h                           |   4 +-
 tools/perf/util/usage.c                            |   6 +-
 tools/perf/util/util.h                             |  18 +--
 37 files changed, 496 insertions(+), 161 deletions(-)

Test results:

The first ones are container (docker) based builds of tools/perf with and
without libelf support, objtool where it is supported and samples/bpf/, ditto.
Where clang is available, it is also used to build perf with/without libelf.

Several are cross builds, the ones with -x-ARCH, and the android one, and those
may not have all the features built, due to lack of multi-arch devel packages,
available and being used so far on just a few, like
debian:experimental-x-{arm64,mipsel}.

The 'perf test' one will perform a variety of tests exercising
tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands
with a variety of command line event specifications to then intercept the
sys_perf_event syscall to check that the perf_event_attr fields are set up as
expected, among a variety of other unit tests.

Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/
with a variety of feature sets, exercising the build with an incomplete set of
features as well as with a complete one. It is planned to have it run on each
of the containers mentioned above, using some container orchestration
infrastructure. Get in contact if interested in helping having this in place.

  # dm
   1 alpine:3.4: Ok
   2 alpine:3.5: Ok
   3 alpine:3.6: Ok
   4 alpine:edge: Ok
   5 android-ndk:r12b-arm: Ok
   6 archlinux:latest: Ok
   7 centos:5: Ok
   8 centos:6: Ok
   9 centos:7: Ok
  10 debian:7: Ok
  11 debian:8: Ok
  12 debian:9: Ok
  13 debian:experimental: Ok
  14 debian:experimental-x-arm64: Ok
  15 debian:experimental-x-mips: Ok
  16 debian:experimental-x-mips64: Ok
  17 debian:experimental-x-mipsel: Ok
  18 fedora:20: Ok
  19 fedora:21: Ok
  20 fedora:22: Ok
  21 fedora:23: Ok
  22 fedora:24: Ok
  23 fedora:24-x-ARC-uClibc: Ok
  24 fedora:25: Ok
  25 fedora:rawhide: Ok
  26 mageia:5: Ok
  27 opensuse:13.2: Ok
  28 opensuse:42.1: Ok
  29 opensuse:tumbleweed: Ok
  30 ubuntu:12.04.5: Ok
  31 ubuntu:14.04.4: Ok
  32 ubuntu:14.04.4-x-linaro-arm64: Ok
  33 ubuntu:15.10: Ok
  34 ubuntu:16.04: Ok
  35 ubuntu:16.04-x-arm: Ok
  36 ubuntu:16.04-x-arm64: Ok
  37 ubuntu:16.04-x-powerpc: Ok
  38 ubuntu:16.04-x-powerpc64: Ok
  39 ubuntu:16.04-x-powerpc64el: Ok
  40 ubuntu:16.04-x-s390: Ok
  41 ubuntu:16.10: Ok
  42 ubuntu:17.04: Ok
  #

  # uname -a
  Linux jouet 4.12.0-rc4+ #1 SMP Fri Jun 9 12:59:23 -03 2017 x86_64 x86_64 x86_64 GNU/Linux
  # perf test
   1: vmlinux symtab matches kallsyms            : Ok
   2: Detect openat syscall event                : Ok
   3: Detect openat syscall event on all cpus    : Ok
   4: Read samples using the mmap interface      : Ok
   5: Parse event definition strings             : Ok
   6: Simple expression parser                   : Ok
   7: PERF_RECORD_* events & perf_sample fields  : Ok
   8: Parse perf pmu format                      : Ok
   9: DSO data read                              : Ok
  10: DSO data cache                             : Ok
  11: DSO data reopen                            : Ok
  12: Roundtrip evsel->name                      : Ok
  13: Parse sched tracepoints fields             : Ok
  14: syscalls:sys_enter_openat event fields     : Ok
  15: Setup struct perf_event_attr               : Ok
  16: Match and link multiple hists              : Ok
  17: 'import perf' in python                    : Ok
  18: Breakpoint overflow signal handler         : Ok
  19: Breakpoint overflow sampling               : Ok
  20: Number of exit events of a simple workload : Ok
  21: Software clock events period values        : Ok
  22: Object code reading                        : Ok
  23: Sample parsing                             : Ok
  24: Use a dummy software event to keep tracking: Ok
  25: Parse with no sample_id_all bit set        : Ok
  26: Filter hist entries                        : Ok
  27: Lookup mmap thread                         : Ok
  28: Share thread mg                            : Ok
  29: Sort output of hist entries                : Ok
  30: Cumulate child hist entries                : Ok
  31: Track with sched_switch                    : Ok
  32: Filter fds with revents mask in a fdarray  : Ok
  33: Add fd to a fdarray, making it autogrow    : Ok
  34: kmod_path__parse                           : Ok
  35: Thread map                                 : Ok
  36: LLVM search and compile                    :
  36.1: Basic BPF llvm compile                    : Ok
  36.2: kbuild searching                          : Ok
  36.3: Compile source for BPF prologue generation: Ok
  36.4: Compile source for BPF relocation         : Ok
  37: Session topology                           : Ok
  38: BPF filter                                 :
  38.1: Basic BPF filtering                      : Ok
  38.2: BPF pinning                              : Ok
  38.3: BPF prologue generation                  : Ok
  38.4: BPF relocation checker                   : Ok
  39: Synthesize thread map                      : Ok
  40: Remove thread map                          : Ok
  41: Synthesize cpu map                         : Ok
  42: Synthesize stat config                     : Ok
  43: Synthesize stat                            : Ok
  44: Synthesize stat round                      : Ok
  45: Synthesize attr update                     : Ok
  46: Event times                                : Ok
  47: Read backward ring buffer                  : Ok
  48: Print cpu map                              : Ok
  49: Probe SDT events                           : Ok
  50: is_printable_array                         : Ok
  51: Print bitmap                               : Ok
  52: perf hooks                                 : Ok
  53: builtin clang support                      : Skip (not compiled in)
  54: unit_number__scnprintf                     : Ok
  55: x86 rdpmc                                  : Ok
  56: Convert perf time to TSC                   : Ok
  57: DWARF unwind                               : Ok
  58: x86 instruction decoder - new instructions : Ok
  59: Intel cqm nmi context read                 : Skip
  #
  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/linux/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
                   make_tags_O: make tags
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
        make_with_babeltrace_O: make LIBBABELTRACE=1
                 make_static_O: make LDFLAGS=-static
                make_no_gtk2_O: make NO_GTK2=1
       make_util_pmu_bison_o_O: make util/pmu-bison.o
              make_no_libbpf_O: make NO_LIBBPF=1
                   make_help_O: make help
                make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
         make_install_prefix_O: make install prefix=/tmp/krava
            make_no_auxtrace_O: make NO_AUXTRACE=1
                    make_doc_O: make doc
                   make_pure_O: make
           make_no_libbionic_O: make NO_LIBBIONIC=1
                 make_perf_o_O: make perf.o
              make_clean_all_O: make clean all
            make_no_libaudit_O: make NO_LIBAUDIT=1
             make_no_libperl_O: make NO_LIBPERL=1
            make_install_bin_O: make install-bin
            make_no_demangle_O: make NO_DEMANGLE=1
                make_install_O: make install
                  make_debug_O: make DEBUG=1
           make_no_backtrace_O: make NO_BACKTRACE=1
               make_no_slang_O: make NO_SLANG=1
             make_no_libnuma_O: make NO_LIBNUMA=1
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
                make_no_newt_O: make NO_NEWT=1
         make_with_clangllvm_O: make LIBCLANGLLVM=1
              make_no_libelf_O: make NO_LIBELF=1
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
             make_util_map_o_O: make util/map.o
           make_no_libunwind_O: make NO_LIBUNWIND=1
           make_no_libpython_O: make NO_LIBPYTHON=1
  OK
  make: Leaving directory '/home/acme/git/linux/tools/perf'
  $

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [GIT PULL 00/23] perf/core improvements and fixes
  2017-06-20  1:54 Arnaldo Carvalho de Melo
@ 2017-06-20  8:50 ` Ingo Molnar
  0 siblings, 0 replies; 30+ messages in thread
From: Ingo Molnar @ 2017-06-20  8:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexander Shishkin,
	Alexei Starovoitov, Andi Kleen, David Ahern, Frederic Weisbecker,
	Hendrik Brueckner, Jiri Olsa, Kan Liang, kernel-team,
	Kim Phillips, linux-arm-kernel, Mark Santaniello,
	Masami Hiramatsu, Mathieu Poirier, Milian Wolff, Namhyung Kim,
	Peter Zijlstra, Steven Rostedt, Taeung Song, Wang Nan, Yao Jin,
	Zefan Li, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	I merged tip/perf/urgent into tip/perf/core before rebasing with these
> patches, please consider pulling, 
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit 8052bd8243e823a0954bcbafda8f91072598f13d:
> 
>   Merge remote-tracking branch 'tip/perf/urgent' into perf/core (2017-06-19 15:14:35 -0300)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.13-20170719
> 
> for you to fetch changes up to dfe1c6d7efa8ead6878b73216d4c891a28207528:
> 
>   perf config: Refactor the code using 'ret' variable in cmd_config() (2017-06-19 22:05:55 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Allow adding and removing fields to the default 'perf script' columns,
>   using + or - as field prefixes to do so (Andi Kleen)
> 
> - Display titles in left frame in the annotate browser (Jin Yao)
> 
> - Allow resolving the DSO name with 'perf script -F brstack{sym,off},dso'
>   (Mark Santaniello)
> 
> - Support function filtering in 'perf ftrace' (Namhyung Kim)
> 
> - Allow specifying function call depth in 'perf ftrace' (Namhyumg Kim)
> 
> Infrastructure:
> 
> - Adopt __noreturn, __printf, __scanf, noinline, __packed and __aligned
>   __alignment__(()) markers, to make the tools/ source code base to be
>   more compact and look more like kernel code (Arnaldo Carvalho de Melo)
> 
> - Remove unnecessary check in annotate_browser_write() (Jin Yao)
> 
> - Return arch from symbol__disassemble() so that callers, such as
>   the annotate TUI browser to use arch specific formattings, such
>   as the upcoming instruction micro-op fusion on Intel Core (Jin Yao)
> 
> - Remove superfluous check before use in the coresight code base (Kim
>   Phillips)
> 
> - Remove unused SAMPLE_SIZE defines and BTS priv array (Kim Phillips)
> 
> - Error handling fix/tidy ups in 'perf config' (Taeung Song)
> 
> - Avoid error in the BPF proggie built with clang in 'perf test llvm'
>   when PROFILE_ALL_BRANCHES is set (Wang Nan)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Andi Kleen (1):
>       perf script: Allow adding and removing fields
> 
> Arnaldo Carvalho de Melo (7):
>       tools: Adopt __noreturn from kernel sources
>       tools: Adopt __printf from kernel sources
>       tools: Adopt __scanf from kernel sources
>       perf tools: Use __maybe_unused consistently
>       tools: Adopt noinline from kernel sources
>       tools: Adopt __packed from kernel sources
>       tools: Adopt __aligned from kernel sources
> 
> Jin Yao (3):
>       perf report: Remove unnecessary check in annotate_browser_write()
>       perf annotate browser: Display titles in left frame
>       perf annotate: Return arch from symbol__disassemble() and save it in browser
> 
> Kim Phillips (2):
>       perf coresight: Remove superfluous check before use
>       perf intel-pt/bts: Remove unused SAMPLE_SIZE defines and bts priv array
> 
> Mark Santaniello (2):
>       perf script: Support -F brstack,dso and brstacksym,dso
>       perf script: Support -F brstackoff,dso
> 
> Namhyung Kim (4):
>       perf ftrace: Show error message when fails to set ftrace files
>       perf ftrace: Move setup_pager before opening trace_pipe
>       perf ftrace: Add option for function filtering
>       perf ftrace: Add -D option for depth filter
> 
> Taeung Song (3):
>       perf config: Invert an if statement to reduce nesting in cmd_config()
>       perf config: Check error cases of {show_spec, set}_config()
>       perf config: Refactor the code using 'ret' variable in cmd_config()
> 
> Wang Nan (1):
>       perf test llvm: Avoid error when PROFILE_ALL_BRANCHES is set
> 
>  tools/include/linux/compiler-gcc.h                 |  10 ++
>  tools/include/linux/compiler.h                     |   4 +
>  tools/perf/Documentation/perf-ftrace.txt           |  33 +++++
>  tools/perf/Documentation/perf-script.txt           |  12 +-
>  tools/perf/arch/arm/util/cs-etm.c                  |  29 ++--
>  tools/perf/arch/x86/util/intel-bts.c               |   4 -
>  tools/perf/arch/x86/util/intel-pt.c                |   4 -
>  tools/perf/bench/numa.c                            |   2 +-
>  tools/perf/builtin-config.c                        |  67 +++++----
>  tools/perf/builtin-ftrace.c                        | 159 +++++++++++++++++++--
>  tools/perf/builtin-script.c                        | 146 +++++++++++++++++--
>  tools/perf/builtin-top.c                           |   2 +-
>  tools/perf/jvmti/jvmti_agent.h                     |   2 -
>  tools/perf/jvmti/libjvmti.c                        |   5 +-
>  tools/perf/pmu-events/jevents.c                    |   4 -
>  tools/perf/tests/bp_signal.c                       |   3 +-
>  tools/perf/tests/bp_signal_overflow.c              |   3 +-
>  tools/perf/tests/bpf-script-test-prologue.c        |   9 ++
>  tools/perf/tests/dwarf-unwind.c                    |  15 +-
>  tools/perf/ui/browsers/annotate.c                  |  54 ++++---
>  tools/perf/ui/gtk/annotate.c                       |   3 +-
>  tools/perf/util/annotate.c                         |  10 +-
>  tools/perf/util/annotate.h                         |   4 +-
>  tools/perf/util/cache.h                            |   3 +-
>  tools/perf/util/debug.h                            |  11 +-
>  tools/perf/util/evlist.h                           |   3 +-
>  tools/perf/util/evsel.c                            |   3 +-
>  tools/perf/util/genelf_debug.c                     |   5 +-
>  tools/perf/util/header.c                           |   3 +-
>  tools/perf/util/intel-bts.c                        |   2 -
>  tools/perf/util/intel-pt-decoder/intel-pt-log.h    |   4 +-
>  tools/perf/util/pmu.h                              |   4 +-
>  tools/perf/util/probe-event.h                      |   4 +-
>  .../util/scripting-engines/trace-event-python.c    |   3 +-
>  tools/perf/util/strbuf.h                           |   4 +-
>  tools/perf/util/usage.c                            |   6 +-
>  tools/perf/util/util.h                             |  18 +--
>  37 files changed, 496 insertions(+), 161 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2017-06-20  8:50 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-19 21:39 [GIT PULL 00/23] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 01/23] perf test: Silence tracepoint event failures Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 02/23] perf test: Suppress libtraceevent warnings Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 03/23] perf bench: Improve the 'perf bench mem memcpy' code readability Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 04/23] perf bench: Default to all routines in 'perf bench mem' Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 05/23] perf bench: Eliminate unused argument from bench_mem_common() Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 06/23] perf bench: Rename 'mem-memcpy.c' => 'mem-functions.c' Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 07/23] perf bench: Remove the prefaulting complication from 'perf bench mem mem*' Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 08/23] perf bench: List output formatting options on 'perf bench -h' Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 09/23] perf bench mem: Change 'cycle' to 'cycles' Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 10/23] perf bench mem: Rename 'routine' to 'routine_str' Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 11/23] perf bench mem: Fix 'length' vs. 'size' naming confusion Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 12/23] perf bench mem: Improve user visible strings Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 13/23] perf bench mem: Reorganize the code a bit Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 14/23] perf bench: Harmonize all the -l/--nr_loops options Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 15/23] perf bench mem: Rename 'routine' to 'function' Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 16/23] perf bench: Run benchmarks, don't test them Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 17/23] perf help: Change 'usage' to 'Usage' for consistency Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 18/23] perf stat: Rename perf_stat struct into perf_stat_evsel Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 19/23] perf stat: Add AGGR_UNSET mode Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 20/23] perf cpu_map: Make cpu_map__build_map global Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 21/23] perf cpu_map: Add data arg to cpu_map__build_map callback Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 22/23] perf script: Check output fields only for samples Arnaldo Carvalho de Melo
2015-10-19 21:39 ` [PATCH 23/23] perf bench: Use named initializers in the trailer too Arnaldo Carvalho de Melo
2015-10-20  7:32 ` [GIT PULL 00/23] perf/core improvements and fixes Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2016-03-23 21:17 Arnaldo Carvalho de Melo
2016-03-24  7:32 ` Ingo Molnar
2017-01-25 13:53 Arnaldo Carvalho de Melo
2017-06-20  1:54 Arnaldo Carvalho de Melo
2017-06-20  8:50 ` Ingo Molnar

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).