linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 00/25] perf/core improvements and fixes
@ 2012-10-08 22:32 Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 01/25] perf trace: Validate target task/user/cpu argument Arnaldo Carvalho de Melo
                   ` (25 more replies)
  0 siblings, 26 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Arnaldo Carvalho de Melo,
	Andi Kleen, Bernhard Rosenkraenzer, Corey Ashford, David Ahern,
	Dong Hao, Frederic Weisbecker, Irina Tirdea, Jiri Olsa,
	Mike Galbraith, Namhyung Kim, Namhyung Kim, Paul Mackerras,
	Pekka Enberg, Peter Zijlstra, Stephane Eranian, Steven Rostedt,
	Wei Yongjun, Xiao Guangrong, arnaldo.melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit 139c0815903de1a7865fe1d6beac5e995fefdf46:

  perf hists: Add more helpers for hist entry stat (2012-10-04 13:36:18 -0300)

are available in the git repository at:

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

for you to fetch changes up to 7747e2f4fb5fb840994613dd1474c17cddb7836b:

  Documentation: add documentation on compiling for Android (2012-10-08 17:44:39 -0300)

----------------------------------------------------------------

perf/core improvements and fixes

. Handle PERF_RECORD_EXIT events in sched and annotate.

. struct machine refactorings to help in top and trace.

. Add on_exit implementation for systems without one, e.g. Android, from
  Bernhard Rosenkraenzer.

. Only process events for vcpus of interest, helps handling large number
  of events, from David Ahern.

. Cross compiling fixes for Android, from Irina Tirdea.

. Add documentation on compiling for Android, from Irina Tirdea.

. perf diff improvements from Jiri Olsa.

. Target (task/user/cpu/syswide) handling improvements, from Namhyung Kim.

. Add support in 'trace' for tracing workload given by command line, from
  Namhyung Kim.

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

----------------------------------------------------------------

Arnaldo Carvalho de Melo (6):
      perf tools: Have the page size value available for all tools
      perf machine: Introduce find_thread method
      perf event: No need to create a thread when handling PERF_RECORD_EXIT
      perf annotate: Handle PERF_RECORD_EXIT events
      perf sched: Handle PERF_RECORD_EXIT events
      perf machine: Carve up event processing specific from perf_tool

Bernhard Rosenkraenzer (1):
      perf tools: Add on_exit implementation

David Ahern (4):
      perf kvm: Only process events for vcpus of interest
      perf kvm: Remove typecast in init_kvm_event_record
      perf kvm: Total count is a u64, print as so
      perf kvm: Add braces around multi-line statements

Irina Tirdea (2):
      perf tools: Update Makefile for Android
      Documentation: add documentation on compiling for Android

Jiri Olsa (8):
      perf diff: Add -b option for perf diff to display paired entries only
      perf diff: Add ratio computation way to compare hist entries
      perf diff: Add option to sort entries based on diff computation
      perf diff: Add weighted diff computation way to compare hist entries
      perf diff: Add -p option to display period values for hist entries
      perf diff: Add -F option to display formula for computation
      perf diff: Include samples without symbol in overall stats
      perf diff: Display empty space for non paired samples

Namhyung Kim (3):
      perf trace: Validate target task/user/cpu argument
      perf trace: Explicitly enable system-wide mode if no option is given
      perf trace: Add support for tracing workload given by command line

Wei Yongjun (1):
      perf tools: Remove duplicated include from trace-event-python.c

 tools/perf/Documentation/android.txt               |   75 ++++
 tools/perf/Documentation/perf-diff.txt             |   60 +++
 tools/perf/Makefile                                |   33 +-
 tools/perf/builtin-annotate.c                      |    3 +-
 tools/perf/builtin-diff.c                          |  405 +++++++++++++++++++-
 tools/perf/builtin-inject.c                        |    6 +-
 tools/perf/builtin-kvm.c                           |   35 +-
 tools/perf/builtin-record.c                        |   32 ++
 tools/perf/builtin-report.c                        |    4 +-
 tools/perf/builtin-sched.c                         |    3 +-
 tools/perf/builtin-script.c                        |    4 +-
 tools/perf/builtin-test.c                          |    2 -
 tools/perf/builtin-top.c                           |    3 +-
 tools/perf/builtin-trace.c                         |   53 ++-
 tools/perf/config/feature-tests.mak                |   20 +-
 tools/perf/perf.c                                  |    2 +
 tools/perf/ui/hist.c                               |  134 ++++++-
 tools/perf/ui/stdio/hist.c                         |    2 +-
 tools/perf/util/build-id.c                         |    2 +-
 tools/perf/util/event.c                            |  215 +----------
 tools/perf/util/event.h                            |    6 +-
 tools/perf/util/evlist.c                           |    3 -
 tools/perf/util/hist.h                             |    8 +
 tools/perf/util/machine.c                          |  277 +++++++++++++
 tools/perf/util/machine.h                          |   19 +
 .../util/scripting-engines/trace-event-python.c    |    1 -
 tools/perf/util/session.c                          |    4 +-
 tools/perf/util/sort.h                             |   18 +
 tools/perf/util/thread.c                           |   41 +-
 tools/perf/util/thread.h                           |    2 +
 tools/perf/util/trace-event-read.c                 |    2 -
 tools/perf/util/util.c                             |    2 +
 tools/perf/util/util.h                             |    2 +
 33 files changed, 1173 insertions(+), 305 deletions(-)
 create mode 100644 tools/perf/Documentation/android.txt
 create mode 100644 tools/perf/util/machine.c
 create mode 100644 tools/perf/util/machine.h

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

* [PATCH 01/25] perf trace: Validate target task/user/cpu argument
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 02/25] perf trace: Explicitly enable system-wide mode if no option is given Arnaldo Carvalho de Melo
                   ` (24 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung.kim@lge.com>

Those target options are mutually exclusive so check it before setting
up target thread/cpu maps.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1349413336-26936-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-trace.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index dec8ced..f01fa6f 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -323,14 +323,21 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_END()
 	};
 	int err;
+	char bf[BUFSIZ];
 
 	argc = parse_options(argc, argv, trace_options, trace_usage, 0);
 	if (argc)
 		usage_with_options(trace_usage, trace_options);
 
+	err = perf_target__validate(&trace.opts.target);
+	if (err) {
+		perf_target__strerror(&trace.opts.target, err, bf, sizeof(bf));
+		printf("%s", bf);
+		return err;
+	}
+
 	err = perf_target__parse_uid(&trace.opts.target);
 	if (err) {
-		char bf[BUFSIZ];
 		perf_target__strerror(&trace.opts.target, err, bf, sizeof(bf));
 		printf("%s", bf);
 		return err;
-- 
1.7.9.2.358.g22243


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

* [PATCH 02/25] perf trace: Explicitly enable system-wide mode if no option is given
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 01/25] perf trace: Validate target task/user/cpu argument Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 03/25] perf trace: Add support for tracing workload given by command line Arnaldo Carvalho de Melo
                   ` (23 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung.kim@lge.com>

When no target cpu/user/task option is given, perf trace will do its job
system wide for all online cpus.  Make it explicit to reduce possible
confusion when reading code.

No functional changes intended.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1349413336-26936-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-trace.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index f01fa6f..da1183f 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -343,5 +343,8 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 		return err;
 	}
 
+	if (perf_target__none(&trace.opts.target))
+		trace.opts.target.system_wide = true;
+
 	return trace__run(&trace);
 }
-- 
1.7.9.2.358.g22243


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

* [PATCH 03/25] perf trace: Add support for tracing workload given by command line
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 01/25] perf trace: Validate target task/user/cpu argument Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 02/25] perf trace: Explicitly enable system-wide mode if no option is given Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 04/25] perf diff: Add -b option for perf diff to display paired entries only Arnaldo Carvalho de Melo
                   ` (22 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung.kim@lge.com>

Now perf trace is able to trace specified workload by forking it like
perf record does.  And also finish the tracing if the workload quits or
gets SIGINT.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1349413336-26936-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-trace.c |   43 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index da1183f..4e9320b 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -52,6 +52,13 @@ struct trace {
 	struct perf_record_opts opts;
 };
 
+static bool done = false;
+
+static void sig_handler(int sig __maybe_unused)
+{
+	done = true;
+}
+
 static int trace__read_syscall_info(struct trace *trace, int id)
 {
 	char tp_name[128];
@@ -189,11 +196,12 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
 	return 0;
 }
 
-static int trace__run(struct trace *trace)
+static int trace__run(struct trace *trace, int argc, const char **argv)
 {
 	struct perf_evlist *evlist = perf_evlist__new(NULL, NULL);
 	struct perf_evsel *evsel;
 	int err = -1, i, nr_events = 0, before;
+	const bool forks = argc > 0;
 
 	if (evlist == NULL) {
 		printf("Not enough memory to run!\n");
@@ -214,6 +222,17 @@ static int trace__run(struct trace *trace)
 
 	perf_evlist__config_attrs(evlist, &trace->opts);
 
+	signal(SIGCHLD, sig_handler);
+	signal(SIGINT, sig_handler);
+
+	if (forks) {
+		err = perf_evlist__prepare_workload(evlist, &trace->opts, argv);
+		if (err < 0) {
+			printf("Couldn't run the workload!\n");
+			goto out_delete_evlist;
+		}
+	}
+
 	err = perf_evlist__open(evlist);
 	if (err < 0) {
 		printf("Couldn't create the events: %s\n", strerror(errno));
@@ -227,6 +246,10 @@ static int trace__run(struct trace *trace)
 	}
 
 	perf_evlist__enable(evlist);
+
+	if (forks)
+		perf_evlist__start_workload(evlist);
+
 again:
 	before = nr_events;
 
@@ -272,8 +295,15 @@ again:
 		}
 	}
 
-	if (nr_events == before)
+	if (nr_events == before) {
+		if (done)
+			goto out_delete_evlist;
+
 		poll(evlist->pollfd, evlist->nr_fds, -1);
+	}
+
+	if (done)
+		perf_evlist__disable(evlist);
 
 	goto again;
 
@@ -286,7 +316,8 @@ out:
 int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	const char * const trace_usage[] = {
-		"perf trace [<options>]",
+		"perf trace [<options>] [<command>]",
+		"perf trace [<options>] -- <command> [<options>]",
 		NULL
 	};
 	struct trace trace = {
@@ -326,8 +357,6 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 	char bf[BUFSIZ];
 
 	argc = parse_options(argc, argv, trace_options, trace_usage, 0);
-	if (argc)
-		usage_with_options(trace_usage, trace_options);
 
 	err = perf_target__validate(&trace.opts.target);
 	if (err) {
@@ -343,8 +372,8 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 		return err;
 	}
 
-	if (perf_target__none(&trace.opts.target))
+	if (!argc && perf_target__none(&trace.opts.target))
 		trace.opts.target.system_wide = true;
 
-	return trace__run(&trace);
+	return trace__run(&trace, argc, argv);
 }
-- 
1.7.9.2.358.g22243


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

* [PATCH 04/25] perf diff: Add -b option for perf diff to display paired entries only
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 03/25] perf trace: Add support for tracing workload given by command line Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 05/25] perf diff: Add ratio computation way to compare hist entries Arnaldo Carvalho de Melo
                   ` (21 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Andi Kleen, Corey Ashford,
	Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Adding -b option to perf diff command to display only entries with match
in the baseline.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1349448287-18919-2-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-diff.txt |    4 ++++
 tools/perf/builtin-diff.c              |   31 +++++++++++++++++++++++++++++--
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index ab7f667..6ce9585 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -72,6 +72,10 @@ OPTIONS
 --symfs=<directory>::
         Look for files with symbols relative to this directory.
 
+-b::
+--baseline-only::
+        Show only items with match in baseline.
+
 SEE ALSO
 --------
 linkperf:perf-record[1]
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index a0b531c..1063c31 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -24,6 +24,7 @@ static char const *input_old = "perf.data.old",
 static char	  diff__default_sort_order[] = "dso,symbol";
 static bool  force;
 static bool show_displacement;
+static bool show_baseline_only;
 
 static int hists__add_entry(struct hists *self,
 			    struct addr_location *al, u64 period)
@@ -172,6 +173,31 @@ static void perf_evlist__resort_hists(struct perf_evlist *evlist, bool name)
 	}
 }
 
+static void hists__baseline_only(struct hists *hists)
+{
+	struct rb_node *next = rb_first(&hists->entries);
+
+	while (next != NULL) {
+		struct hist_entry *he = rb_entry(next, struct hist_entry, rb_node);
+
+		next = rb_next(&he->rb_node);
+		if (!he->pair) {
+			rb_erase(&he->rb_node, &hists->entries);
+			hist_entry__free(he);
+		}
+	}
+}
+
+static void hists__process(struct hists *old, struct hists *new)
+{
+	hists__match(old, new);
+
+	if (show_baseline_only)
+		hists__baseline_only(new);
+
+	hists__fprintf(new, true, 0, 0, stdout);
+}
+
 static int __cmd_diff(void)
 {
 	int ret, i;
@@ -213,8 +239,7 @@ static int __cmd_diff(void)
 
 		first = false;
 
-		hists__match(&evsel_old->hists, &evsel->hists);
-		hists__fprintf(&evsel->hists, true, 0, 0, stdout);
+		hists__process(&evsel_old->hists, &evsel->hists);
 	}
 
 out_delete:
@@ -235,6 +260,8 @@ static const struct option options[] = {
 		    "be more verbose (show symbol address, etc)"),
 	OPT_BOOLEAN('M', "displacement", &show_displacement,
 		    "Show position displacement relative to baseline"),
+	OPT_BOOLEAN('b', "baseline-only", &show_baseline_only,
+		    "Show only items with match in baseline"),
 	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
 		    "dump raw trace in ASCII"),
 	OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
-- 
1.7.9.2.358.g22243


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

* [PATCH 05/25] perf diff: Add ratio computation way to compare hist entries
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 04/25] perf diff: Add -b option for perf diff to display paired entries only Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 06/25] perf diff: Add option to sort entries based on diff computation Arnaldo Carvalho de Melo
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Andi Kleen, Corey Ashford,
	Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Adding -c option to select computation method with the current 'Delta'
computation as default. Current possible values are of this option are:
'delta' and 'ratio'.

Adding 'ratio' as new computation way to compare hist entries.  If
specified the 'Ratio' column is displayed with value 'r' computed as:

  r = A->period / B->period

with:
  - A/B being matching hist entry from first/second file specified
    (or perf.data/perf.data.old) respectively.
  - period being the hist entry period value

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1349448287-18919-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-diff.txt |   33 ++++++++++++++++++++
 tools/perf/builtin-diff.c              |   52 ++++++++++++++++++++++++++++++--
 tools/perf/ui/hist.c                   |   28 +++++++++++++++++
 tools/perf/util/hist.h                 |    1 +
 4 files changed, 112 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index 6ce9585..8fff061 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -76,6 +76,39 @@ OPTIONS
 --baseline-only::
         Show only items with match in baseline.
 
+-c::
+--compute::
+        Differential computation selection - delta,ratio (default is delta).
+        See COMPARISON METHODS section for more info.
+
+COMPARISON METHODS
+------------------
+delta
+~~~~~
+If specified the 'Delta' column is displayed with value 'd' computed as:
+
+  d = A->period_percent - B->period_percent
+
+with:
+  - A/B being matching hist entry from first/second file specified
+    (or perf.data/perf.data.old) respectively.
+
+  - period_percent being the % of the hist entry period value within
+    single data file
+
+ratio
+~~~~~
+If specified the 'Ratio' column is displayed with value 'r' computed as:
+
+  r = A->period / B->period
+
+with:
+  - A/B being matching hist entry from first/second file specified
+    (or perf.data/perf.data.old) respectively.
+
+  - period being the hist entry period value
+
+
 SEE ALSO
 --------
 linkperf:perf-record[1]
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 1063c31..e90c06a 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -26,6 +26,41 @@ static bool  force;
 static bool show_displacement;
 static bool show_baseline_only;
 
+enum {
+	COMPUTE_DELTA,
+	COMPUTE_RATIO,
+	COMPUTE_MAX,
+};
+
+const char *compute_names[COMPUTE_MAX] = {
+	[COMPUTE_DELTA] = "delta",
+	[COMPUTE_RATIO] = "ratio",
+};
+
+static int compute;
+
+static int setup_compute(const struct option *opt, const char *str,
+			 int unset __maybe_unused)
+{
+	int *cp = (int *) opt->value;
+	unsigned i;
+
+	if (!str) {
+		*cp = COMPUTE_DELTA;
+		return 0;
+	}
+
+	for (i = 0; i < COMPUTE_MAX; i++)
+		if (!strcmp(str, compute_names[i])) {
+			*cp = i;
+			return 0;
+		}
+
+	pr_err("Failed: '%s' is not computation method "
+	       "(use 'delta' or 'ratio').\n", str);
+	return -EINVAL;
+}
+
 static int hists__add_entry(struct hists *self,
 			    struct addr_location *al, u64 period)
 {
@@ -262,6 +297,9 @@ static const struct option options[] = {
 		    "Show position displacement relative to baseline"),
 	OPT_BOOLEAN('b', "baseline-only", &show_baseline_only,
 		    "Show only items with match in baseline"),
+	OPT_CALLBACK('c', "compute", &compute, "delta,ratio (default delta)",
+		     "Entries differential computation selection",
+		     setup_compute),
 	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
 		    "dump raw trace in ASCII"),
 	OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
@@ -290,9 +328,19 @@ static void ui_init(void)
 	/* No overhead column. */
 	perf_hpp__column_enable(PERF_HPP__OVERHEAD, false);
 
-	/* Display baseline/delta/displacement columns. */
+	/* Display baseline/delta/ratio/displacement columns. */
 	perf_hpp__column_enable(PERF_HPP__BASELINE, true);
-	perf_hpp__column_enable(PERF_HPP__DELTA, true);
+
+	switch (compute) {
+	case COMPUTE_DELTA:
+		perf_hpp__column_enable(PERF_HPP__DELTA, true);
+		break;
+	case COMPUTE_RATIO:
+		perf_hpp__column_enable(PERF_HPP__RATIO, true);
+		break;
+	default:
+		BUG_ON(1);
+	};
 
 	if (show_displacement)
 		perf_hpp__column_enable(PERF_HPP__DISPL, true);
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index f5a1e4f..1b633a4 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -266,6 +266,33 @@ static int hpp__entry_delta(struct perf_hpp *hpp, struct hist_entry *he)
 	return scnprintf(hpp->buf, hpp->size, fmt, buf);
 }
 
+static int hpp__header_ratio(struct perf_hpp *hpp)
+{
+	const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
+
+	return scnprintf(hpp->buf, hpp->size, fmt, "Ratio");
+}
+
+static int hpp__width_ratio(struct perf_hpp *hpp __maybe_unused)
+{
+	return 14;
+}
+
+static int hpp__entry_ratio(struct perf_hpp *hpp, struct hist_entry *he)
+{
+	struct hist_entry *pair = he->pair;
+	double new_period = he->stat.period;
+	double old_period = pair ? pair->stat.period : 0;
+	double ratio = pair ? new_period / old_period : 0;
+	const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
+	char buf[32] = " ";
+
+	if (ratio > 0.0)
+		scnprintf(buf, sizeof(buf), "%+14.6F", ratio);
+
+	return scnprintf(hpp->buf, hpp->size, fmt, buf);
+}
+
 static int hpp__header_displ(struct perf_hpp *hpp)
 {
 	return scnprintf(hpp->buf, hpp->size, "Displ.");
@@ -311,6 +338,7 @@ struct perf_hpp_fmt perf_hpp__format[] = {
 	{ .cond = false, HPP__PRINT_FNS(samples) },
 	{ .cond = false, HPP__PRINT_FNS(period) },
 	{ .cond = false, HPP__PRINT_FNS(delta) },
+	{ .cond = false, HPP__PRINT_FNS(ratio) },
 	{ .cond = false, HPP__PRINT_FNS(displ) }
 };
 
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 66cb31f..7e4d4c2 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -141,6 +141,7 @@ enum {
 	PERF_HPP__SAMPLES,
 	PERF_HPP__PERIOD,
 	PERF_HPP__DELTA,
+	PERF_HPP__RATIO,
 	PERF_HPP__DISPL,
 
 	PERF_HPP__MAX_INDEX
-- 
1.7.9.2.358.g22243


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

* [PATCH 06/25] perf diff: Add option to sort entries based on diff computation
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 05/25] perf diff: Add ratio computation way to compare hist entries Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 07/25] perf diff: Add weighted diff computation way to compare hist entries Arnaldo Carvalho de Melo
                   ` (19 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Andi Kleen, Corey Ashford,
	Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Adding support to sort hist entries based on the outcome of selected
computation. It's now possible to specify '+' as a first character of
'-c' option value to make such sort.

Example:

  $ perf diff -c ratio -b
  # Event 'cache-misses'
  #
  #   Baseline           Ratio      Shared Object                            Symbol
  #   ........  ..............  .................  ................................
  #
        19.64%            0.69  [kernel.kallsyms]  [k] clear_page
         0.30%            0.17  [kernel.kallsyms]  [k] mm_alloc
         0.04%            0.20  [kernel.kallsyms]  [k] kmem_cache_alloc

  $ perf diff -c +ratio -b
  # Event 'cache-misses'
  #
  #   Baseline           Ratio      Shared Object                            Symbol
  #   ........  ..............  .................  ................................
  #
        19.64%            0.69  [kernel.kallsyms]  [k] clear_page
         0.04%            0.20  [kernel.kallsyms]  [k] kmem_cache_alloc
         0.30%            0.17  [kernel.kallsyms]  [k] mm_alloc

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1349448287-18919-4-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-diff.txt |    2 +
 tools/perf/builtin-diff.c              |  137 ++++++++++++++++++++++++++++++++
 tools/perf/ui/hist.c                   |   29 +++----
 tools/perf/util/hist.h                 |    2 +
 tools/perf/util/sort.h                 |   15 ++++
 5 files changed, 167 insertions(+), 18 deletions(-)

diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index 8fff061..cff3d9b 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -79,6 +79,8 @@ OPTIONS
 -c::
 --compute::
         Differential computation selection - delta,ratio (default is delta).
+        If '+' is specified as a first character, the output is sorted based
+        on the computation results.
         See COMPARISON METHODS section for more info.
 
 COMPARISON METHODS
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index e90c06a..e13cfac 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -25,6 +25,7 @@ static char	  diff__default_sort_order[] = "dso,symbol";
 static bool  force;
 static bool show_displacement;
 static bool show_baseline_only;
+static bool sort_compute;
 
 enum {
 	COMPUTE_DELTA,
@@ -50,6 +51,13 @@ static int setup_compute(const struct option *opt, const char *str,
 		return 0;
 	}
 
+	if (*str == '+') {
+		sort_compute = true;
+		str++;
+		if (!*str)
+			return 0;
+	}
+
 	for (i = 0; i < COMPUTE_MAX; i++)
 		if (!strcmp(str, compute_names[i])) {
 			*cp = i;
@@ -61,6 +69,34 @@ static int setup_compute(const struct option *opt, const char *str,
 	return -EINVAL;
 }
 
+static double get_period_percent(struct hist_entry *he, u64 period)
+{
+	u64 total = he->hists->stats.total_period;
+	return (period * 100.0) / total;
+}
+
+double perf_diff__compute_delta(struct hist_entry *he)
+{
+	struct hist_entry *pair = he->pair;
+	double new_percent = get_period_percent(he, he->stat.period);
+	double old_percent = pair ? get_period_percent(pair, pair->stat.period) : 0.0;
+
+	he->diff.period_ratio_delta = new_percent - old_percent;
+	he->diff.computed = true;
+	return he->diff.period_ratio_delta;
+}
+
+double perf_diff__compute_ratio(struct hist_entry *he)
+{
+	struct hist_entry *pair = he->pair;
+	double new_period = he->stat.period;
+	double old_period = pair ? pair->stat.period : 0;
+
+	he->diff.computed = true;
+	he->diff.period_ratio = pair ? (new_period / old_period) : 0;
+	return he->diff.period_ratio;
+}
+
 static int hists__add_entry(struct hists *self,
 			    struct addr_location *al, u64 period)
 {
@@ -223,6 +259,102 @@ static void hists__baseline_only(struct hists *hists)
 	}
 }
 
+static void hists__precompute(struct hists *hists)
+{
+	struct rb_node *next = rb_first(&hists->entries);
+
+	while (next != NULL) {
+		struct hist_entry *he = rb_entry(next, struct hist_entry, rb_node);
+
+		next = rb_next(&he->rb_node);
+
+		switch (compute) {
+		case COMPUTE_DELTA:
+			perf_diff__compute_delta(he);
+			break;
+		case COMPUTE_RATIO:
+			perf_diff__compute_ratio(he);
+			break;
+		default:
+			BUG_ON(1);
+		}
+	}
+}
+
+static int64_t cmp_doubles(double l, double r)
+{
+	if (l > r)
+		return -1;
+	else if (l < r)
+		return 1;
+	else
+		return 0;
+}
+
+static int64_t
+hist_entry__cmp_compute(struct hist_entry *left, struct hist_entry *right,
+			int c)
+{
+	switch (c) {
+	case COMPUTE_DELTA:
+	{
+		double l = left->diff.period_ratio_delta;
+		double r = right->diff.period_ratio_delta;
+
+		return cmp_doubles(l, r);
+	}
+	case COMPUTE_RATIO:
+	{
+		double l = left->diff.period_ratio;
+		double r = right->diff.period_ratio;
+
+		return cmp_doubles(l, r);
+	}
+	default:
+		BUG_ON(1);
+	}
+
+	return 0;
+}
+
+static void insert_hist_entry_by_compute(struct rb_root *root,
+					 struct hist_entry *he,
+					 int c)
+{
+	struct rb_node **p = &root->rb_node;
+	struct rb_node *parent = NULL;
+	struct hist_entry *iter;
+
+	while (*p != NULL) {
+		parent = *p;
+		iter = rb_entry(parent, struct hist_entry, rb_node);
+		if (hist_entry__cmp_compute(he, iter, c) < 0)
+			p = &(*p)->rb_left;
+		else
+			p = &(*p)->rb_right;
+	}
+
+	rb_link_node(&he->rb_node, parent, p);
+	rb_insert_color(&he->rb_node, root);
+}
+
+static void hists__compute_resort(struct hists *hists)
+{
+	struct rb_root tmp = RB_ROOT;
+	struct rb_node *next = rb_first(&hists->entries);
+
+	while (next != NULL) {
+		struct hist_entry *he = rb_entry(next, struct hist_entry, rb_node);
+
+		next = rb_next(&he->rb_node);
+
+		rb_erase(&he->rb_node, &hists->entries);
+		insert_hist_entry_by_compute(&tmp, he, compute);
+	}
+
+	hists->entries = tmp;
+}
+
 static void hists__process(struct hists *old, struct hists *new)
 {
 	hists__match(old, new);
@@ -230,6 +362,11 @@ static void hists__process(struct hists *old, struct hists *new)
 	if (show_baseline_only)
 		hists__baseline_only(new);
 
+	if (sort_compute) {
+		hists__precompute(new);
+		hists__compute_resort(new);
+	}
+
 	hists__fprintf(new, true, 0, 0, stdout);
 }
 
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 1b633a4..659f2a2 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -242,24 +242,15 @@ static int hpp__width_delta(struct perf_hpp *hpp __maybe_unused)
 
 static int hpp__entry_delta(struct perf_hpp *hpp, struct hist_entry *he)
 {
-	struct hist_entry *pair = he->pair;
-	struct hists *pair_hists = pair ? pair->hists : NULL;
-	struct hists *hists = he->hists;
-	u64 old_total, new_total;
-	double old_percent = 0, new_percent = 0;
-	double diff;
 	const char *fmt = symbol_conf.field_sep ? "%s" : "%7.7s";
 	char buf[32] = " ";
+	double diff;
 
-	old_total = pair_hists ? pair_hists->stats.total_period : 0;
-	if (old_total > 0 && pair)
-		old_percent = 100.0 * pair->stat.period / old_total;
-
-	new_total = hists->stats.total_period;
-	if (new_total > 0)
-		new_percent = 100.0 * he->stat.period / new_total;
+	if (he->diff.computed)
+		diff = he->diff.period_ratio_delta;
+	else
+		diff = perf_diff__compute_delta(he);
 
-	diff = new_percent - old_percent;
 	if (fabs(diff) >= 0.01)
 		scnprintf(buf, sizeof(buf), "%+4.2F%%", diff);
 
@@ -280,12 +271,14 @@ static int hpp__width_ratio(struct perf_hpp *hpp __maybe_unused)
 
 static int hpp__entry_ratio(struct perf_hpp *hpp, struct hist_entry *he)
 {
-	struct hist_entry *pair = he->pair;
-	double new_period = he->stat.period;
-	double old_period = pair ? pair->stat.period : 0;
-	double ratio = pair ? new_period / old_period : 0;
 	const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
 	char buf[32] = " ";
+	double ratio;
+
+	if (he->diff.computed)
+		ratio = he->diff.period_ratio;
+	else
+		ratio = perf_diff__compute_ratio(he);
 
 	if (ratio > 0.0)
 		scnprintf(buf, sizeof(buf), "%+14.6F", ratio);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 7e4d4c2..a7ea28a 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -205,4 +205,6 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist __maybe_unused,
 
 unsigned int hists__sort_list_width(struct hists *self);
 
+double perf_diff__compute_delta(struct hist_entry *he);
+double perf_diff__compute_ratio(struct hist_entry *he);
 #endif	/* __PERF_HIST_H */
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 5786f32..337aeef 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -52,6 +52,19 @@ struct he_stat {
 	u32			nr_events;
 };
 
+struct hist_entry_diff {
+	bool	computed;
+
+	/* PERF_HPP__DISPL */
+	int	displacement;
+
+	/* PERF_HPP__DELTA */
+	double	period_ratio_delta;
+
+	/* PERF_HPP__RATIO */
+	double	period_ratio;
+};
+
 /**
  * struct hist_entry - histogram entry
  *
@@ -67,6 +80,8 @@ struct hist_entry {
 	u64			ip;
 	s32			cpu;
 
+	struct hist_entry_diff	diff;
+
 	/* XXX These two should move to some tree widget lib */
 	u16			row_offset;
 	u16			nr_rows;
-- 
1.7.9.2.358.g22243


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

* [PATCH 07/25] perf diff: Add weighted diff computation way to compare hist entries
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 06/25] perf diff: Add option to sort entries based on diff computation Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 08/25] perf diff: Add -p option to display period values for " Arnaldo Carvalho de Melo
                   ` (18 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Andi Kleen, Corey Ashford,
	Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Adding 'wdiff' as new computation way to compare hist entries.

If specified the 'Weighted diff' column is displayed with value 'd'
computed as:

   d = B->period * WEIGHT-A - A->period * WEIGHT-B

  - A/B being matching hist entry from first/second file specified
    (or perf.data/perf.data.old) respectively.
  - period being the hist entry period value
  - WEIGHT-A/WEIGHT-B being user suplied weights in the the '-c' option
    behind ':' separator like '-c wdiff:1,2'.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1349448287-18919-5-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-diff.txt |   15 ++++-
 tools/perf/builtin-diff.c              |  116 ++++++++++++++++++++++++++++++--
 tools/perf/ui/hist.c                   |   30 +++++++++
 tools/perf/util/hist.h                 |    2 +
 tools/perf/util/sort.h                 |    3 +
 5 files changed, 160 insertions(+), 6 deletions(-)

diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index cff3d9b..fa413ac 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -78,7 +78,7 @@ OPTIONS
 
 -c::
 --compute::
-        Differential computation selection - delta,ratio (default is delta).
+        Differential computation selection - delta,ratio,wdiff (default is delta).
         If '+' is specified as a first character, the output is sorted based
         on the computation results.
         See COMPARISON METHODS section for more info.
@@ -110,6 +110,19 @@ with:
 
   - period being the hist entry period value
 
+wdiff
+~~~~~
+If specified the 'Weighted diff' column is displayed with value 'd' computed as:
+
+   d = B->period * WEIGHT-A - A->period * WEIGHT-B
+
+  - A/B being matching hist entry from first/second file specified
+    (or perf.data/perf.data.old) respectively.
+
+  - period being the hist entry period value
+
+  - WEIGHT-A/WEIGHT-B being user suplied weights in the the '-c' option
+    behind ':' separator like '-c wdiff:1,2'.
 
 SEE ALSO
 --------
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index e13cfac..d78e838 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -27,24 +27,81 @@ static bool show_displacement;
 static bool show_baseline_only;
 static bool sort_compute;
 
+static s64 compute_wdiff_w1;
+static s64 compute_wdiff_w2;
+
 enum {
 	COMPUTE_DELTA,
 	COMPUTE_RATIO,
+	COMPUTE_WEIGHTED_DIFF,
 	COMPUTE_MAX,
 };
 
 const char *compute_names[COMPUTE_MAX] = {
 	[COMPUTE_DELTA] = "delta",
 	[COMPUTE_RATIO] = "ratio",
+	[COMPUTE_WEIGHTED_DIFF] = "wdiff",
 };
 
 static int compute;
 
+static int setup_compute_opt_wdiff(char *opt)
+{
+	char *w1_str = opt;
+	char *w2_str;
+
+	int ret = -EINVAL;
+
+	if (!opt)
+		goto out;
+
+	w2_str = strchr(opt, ',');
+	if (!w2_str)
+		goto out;
+
+	*w2_str++ = 0x0;
+	if (!*w2_str)
+		goto out;
+
+	compute_wdiff_w1 = strtol(w1_str, NULL, 10);
+	compute_wdiff_w2 = strtol(w2_str, NULL, 10);
+
+	if (!compute_wdiff_w1 || !compute_wdiff_w2)
+		goto out;
+
+	pr_debug("compute wdiff w1(%" PRId64 ") w2(%" PRId64 ")\n",
+		  compute_wdiff_w1, compute_wdiff_w2);
+
+	ret = 0;
+
+ out:
+	if (ret)
+		pr_err("Failed: wrong weight data, use 'wdiff:w1,w2'\n");
+
+	return ret;
+}
+
+static int setup_compute_opt(char *opt)
+{
+	if (compute == COMPUTE_WEIGHTED_DIFF)
+		return setup_compute_opt_wdiff(opt);
+
+	if (opt) {
+		pr_err("Failed: extra option specified '%s'", opt);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 static int setup_compute(const struct option *opt, const char *str,
 			 int unset __maybe_unused)
 {
 	int *cp = (int *) opt->value;
+	char *cstr = (char *) str;
+	char buf[50];
 	unsigned i;
+	char *option;
 
 	if (!str) {
 		*cp = COMPUTE_DELTA;
@@ -53,19 +110,37 @@ static int setup_compute(const struct option *opt, const char *str,
 
 	if (*str == '+') {
 		sort_compute = true;
-		str++;
+		cstr = (char *) ++str;
 		if (!*str)
 			return 0;
 	}
 
+	option = strchr(str, ':');
+	if (option) {
+		unsigned len = option++ - str;
+
+		/*
+		 * The str data are not writeable, so we need
+		 * to use another buffer.
+		 */
+
+		/* No option value is longer. */
+		if (len >= sizeof(buf))
+			return -EINVAL;
+
+		strncpy(buf, str, len);
+		buf[len] = 0x0;
+		cstr = buf;
+	}
+
 	for (i = 0; i < COMPUTE_MAX; i++)
-		if (!strcmp(str, compute_names[i])) {
+		if (!strcmp(cstr, compute_names[i])) {
 			*cp = i;
-			return 0;
+			return setup_compute_opt(option);
 		}
 
 	pr_err("Failed: '%s' is not computation method "
-	       "(use 'delta' or 'ratio').\n", str);
+	       "(use 'delta','ratio' or 'wdiff')\n", str);
 	return -EINVAL;
 }
 
@@ -97,6 +172,23 @@ double perf_diff__compute_ratio(struct hist_entry *he)
 	return he->diff.period_ratio;
 }
 
+s64 perf_diff__compute_wdiff(struct hist_entry *he)
+{
+	struct hist_entry *pair = he->pair;
+	u64 new_period = he->stat.period;
+	u64 old_period = pair ? pair->stat.period : 0;
+
+	he->diff.computed = true;
+
+	if (!pair)
+		he->diff.wdiff = 0;
+	else
+		he->diff.wdiff = new_period * compute_wdiff_w2 -
+				 old_period * compute_wdiff_w1;
+
+	return he->diff.wdiff;
+}
+
 static int hists__add_entry(struct hists *self,
 			    struct addr_location *al, u64 period)
 {
@@ -275,6 +367,9 @@ static void hists__precompute(struct hists *hists)
 		case COMPUTE_RATIO:
 			perf_diff__compute_ratio(he);
 			break;
+		case COMPUTE_WEIGHTED_DIFF:
+			perf_diff__compute_wdiff(he);
+			break;
 		default:
 			BUG_ON(1);
 		}
@@ -310,6 +405,13 @@ hist_entry__cmp_compute(struct hist_entry *left, struct hist_entry *right,
 
 		return cmp_doubles(l, r);
 	}
+	case COMPUTE_WEIGHTED_DIFF:
+	{
+		s64 l = left->diff.wdiff;
+		s64 r = right->diff.wdiff;
+
+		return r - l;
+	}
 	default:
 		BUG_ON(1);
 	}
@@ -434,7 +536,8 @@ static const struct option options[] = {
 		    "Show position displacement relative to baseline"),
 	OPT_BOOLEAN('b', "baseline-only", &show_baseline_only,
 		    "Show only items with match in baseline"),
-	OPT_CALLBACK('c', "compute", &compute, "delta,ratio (default delta)",
+	OPT_CALLBACK('c', "compute", &compute,
+		     "delta,ratio,wdiff:w1,w2 (default delta)",
 		     "Entries differential computation selection",
 		     setup_compute),
 	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
@@ -475,6 +578,9 @@ static void ui_init(void)
 	case COMPUTE_RATIO:
 		perf_hpp__column_enable(PERF_HPP__RATIO, true);
 		break;
+	case COMPUTE_WEIGHTED_DIFF:
+		perf_hpp__column_enable(PERF_HPP__WEIGHTED_DIFF, true);
+		break;
 	default:
 		BUG_ON(1);
 	};
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 659f2a2..522b4ec 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -286,6 +286,35 @@ static int hpp__entry_ratio(struct perf_hpp *hpp, struct hist_entry *he)
 	return scnprintf(hpp->buf, hpp->size, fmt, buf);
 }
 
+static int hpp__header_wdiff(struct perf_hpp *hpp)
+{
+	const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
+
+	return scnprintf(hpp->buf, hpp->size, fmt, "Weighted diff");
+}
+
+static int hpp__width_wdiff(struct perf_hpp *hpp __maybe_unused)
+{
+	return 14;
+}
+
+static int hpp__entry_wdiff(struct perf_hpp *hpp, struct hist_entry *he)
+{
+	const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
+	char buf[32] = " ";
+	s64 wdiff;
+
+	if (he->diff.computed)
+		wdiff = he->diff.wdiff;
+	else
+		wdiff = perf_diff__compute_wdiff(he);
+
+	if (wdiff != 0)
+		scnprintf(buf, sizeof(buf), "%14ld", wdiff);
+
+	return scnprintf(hpp->buf, hpp->size, fmt, buf);
+}
+
 static int hpp__header_displ(struct perf_hpp *hpp)
 {
 	return scnprintf(hpp->buf, hpp->size, "Displ.");
@@ -332,6 +361,7 @@ struct perf_hpp_fmt perf_hpp__format[] = {
 	{ .cond = false, HPP__PRINT_FNS(period) },
 	{ .cond = false, HPP__PRINT_FNS(delta) },
 	{ .cond = false, HPP__PRINT_FNS(ratio) },
+	{ .cond = false, HPP__PRINT_FNS(wdiff) },
 	{ .cond = false, HPP__PRINT_FNS(displ) }
 };
 
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index a7ea28a..ce76f36 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -142,6 +142,7 @@ enum {
 	PERF_HPP__PERIOD,
 	PERF_HPP__DELTA,
 	PERF_HPP__RATIO,
+	PERF_HPP__WEIGHTED_DIFF,
 	PERF_HPP__DISPL,
 
 	PERF_HPP__MAX_INDEX
@@ -207,4 +208,5 @@ unsigned int hists__sort_list_width(struct hists *self);
 
 double perf_diff__compute_delta(struct hist_entry *he);
 double perf_diff__compute_ratio(struct hist_entry *he);
+s64 perf_diff__compute_wdiff(struct hist_entry *he);
 #endif	/* __PERF_HIST_H */
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 337aeef..13761d8 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -63,6 +63,9 @@ struct hist_entry_diff {
 
 	/* PERF_HPP__RATIO */
 	double	period_ratio;
+
+	/* HISTC_WEIGHTED_DIFF */
+	s64	wdiff;
 };
 
 /**
-- 
1.7.9.2.358.g22243


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

* [PATCH 08/25] perf diff: Add -p option to display period values for hist entries
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 07/25] perf diff: Add weighted diff computation way to compare hist entries Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 09/25] perf diff: Add -F option to display formula for computation Arnaldo Carvalho de Melo
                   ` (17 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Andi Kleen, Corey Ashford,
	Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Adding -p option to show period values for both compared hist entries.
Showing hist column PERF_HPP__PERIOD and newly added hist column
PERF_HPP__PERIOD_BASELINE.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1349448287-18919-6-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-diff.txt |    4 ++++
 tools/perf/builtin-diff.c              |   10 +++++++++-
 tools/perf/ui/hist.c                   |   21 +++++++++++++++++++++
 tools/perf/util/hist.h                 |    1 +
 4 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index fa413ac..21cc2ef 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -83,6 +83,10 @@ OPTIONS
         on the computation results.
         See COMPARISON METHODS section for more info.
 
+-p::
+--period::
+        Show period values for both compared hist entries.
+
 COMPARISON METHODS
 ------------------
 delta
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index d78e838..2411dd1 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -24,6 +24,7 @@ static char const *input_old = "perf.data.old",
 static char	  diff__default_sort_order[] = "dso,symbol";
 static bool  force;
 static bool show_displacement;
+static bool show_period;
 static bool show_baseline_only;
 static bool sort_compute;
 
@@ -540,6 +541,8 @@ static const struct option options[] = {
 		     "delta,ratio,wdiff:w1,w2 (default delta)",
 		     "Entries differential computation selection",
 		     setup_compute),
+	OPT_BOOLEAN('p', "period", &show_period,
+		    "Show period values."),
 	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
 		    "dump raw trace in ASCII"),
 	OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
@@ -568,7 +571,7 @@ static void ui_init(void)
 	/* No overhead column. */
 	perf_hpp__column_enable(PERF_HPP__OVERHEAD, false);
 
-	/* Display baseline/delta/ratio/displacement columns. */
+	/* Display baseline/delta/ratio/displacement/periods columns. */
 	perf_hpp__column_enable(PERF_HPP__BASELINE, true);
 
 	switch (compute) {
@@ -587,6 +590,11 @@ static void ui_init(void)
 
 	if (show_displacement)
 		perf_hpp__column_enable(PERF_HPP__DISPL, true);
+
+	if (show_period) {
+		perf_hpp__column_enable(PERF_HPP__PERIOD, true);
+		perf_hpp__column_enable(PERF_HPP__PERIOD_BASELINE, true);
+	}
 }
 
 int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 522b4ec..2fadaff 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -228,6 +228,26 @@ static int hpp__entry_period(struct perf_hpp *hpp, struct hist_entry *he)
 	return scnprintf(hpp->buf, hpp->size, fmt, he->stat.period);
 }
 
+static int hpp__header_period_baseline(struct perf_hpp *hpp)
+{
+	const char *fmt = symbol_conf.field_sep ? "%s" : "%12s";
+
+	return scnprintf(hpp->buf, hpp->size, fmt, "Period Base");
+}
+
+static int hpp__width_period_baseline(struct perf_hpp *hpp __maybe_unused)
+{
+	return 12;
+}
+
+static int hpp__entry_period_baseline(struct perf_hpp *hpp, struct hist_entry *he)
+{
+	struct hist_entry *pair = he->pair;
+	u64 period = pair ? pair->stat.period : 0;
+	const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%12" PRIu64;
+
+	return scnprintf(hpp->buf, hpp->size, fmt, period);
+}
 static int hpp__header_delta(struct perf_hpp *hpp)
 {
 	const char *fmt = symbol_conf.field_sep ? "%s" : "%7s";
@@ -359,6 +379,7 @@ struct perf_hpp_fmt perf_hpp__format[] = {
 	{ .cond = false, HPP__COLOR_PRINT_FNS(overhead_guest_us) },
 	{ .cond = false, HPP__PRINT_FNS(samples) },
 	{ .cond = false, HPP__PRINT_FNS(period) },
+	{ .cond = false, HPP__PRINT_FNS(period_baseline) },
 	{ .cond = false, HPP__PRINT_FNS(delta) },
 	{ .cond = false, HPP__PRINT_FNS(ratio) },
 	{ .cond = false, HPP__PRINT_FNS(wdiff) },
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index ce76f36..5604791 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -140,6 +140,7 @@ enum {
 	PERF_HPP__OVERHEAD_GUEST_US,
 	PERF_HPP__SAMPLES,
 	PERF_HPP__PERIOD,
+	PERF_HPP__PERIOD_BASELINE,
 	PERF_HPP__DELTA,
 	PERF_HPP__RATIO,
 	PERF_HPP__WEIGHTED_DIFF,
-- 
1.7.9.2.358.g22243


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

* [PATCH 09/25] perf diff: Add -F option to display formula for computation
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 08/25] perf diff: Add -p option to display period values for " Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 10/25] perf diff: Include samples without symbol in overall stats Arnaldo Carvalho de Melo
                   ` (16 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Andi Kleen, Corey Ashford,
	Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Adding -F option to display the formula for specified computation.

This is mainly to facilitate debugging, but can be useful anyway.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1349448287-18919-7-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-diff.txt |    4 ++
 tools/perf/builtin-diff.c              |   67 +++++++++++++++++++++++++++++++-
 tools/perf/ui/hist.c                   |   24 +++++++++++-
 tools/perf/ui/stdio/hist.c             |    2 +-
 tools/perf/util/hist.h                 |    2 +
 5 files changed, 96 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index 21cc2ef..194f37d 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -87,6 +87,10 @@ OPTIONS
 --period::
         Show period values for both compared hist entries.
 
+-F::
+--formula::
+        Show formula for given computation.
+
 COMPARISON METHODS
 ------------------
 delta
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 2411dd1..dd9c064 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -25,6 +25,7 @@ static char	  diff__default_sort_order[] = "dso,symbol";
 static bool  force;
 static bool show_displacement;
 static bool show_period;
+static bool show_formula;
 static bool show_baseline_only;
 static bool sort_compute;
 
@@ -190,6 +191,62 @@ s64 perf_diff__compute_wdiff(struct hist_entry *he)
 	return he->diff.wdiff;
 }
 
+static int formula_delta(struct hist_entry *he, char *buf, size_t size)
+{
+	struct hist_entry *pair = he->pair;
+
+	if (!pair)
+		return -1;
+
+	return scnprintf(buf, size,
+			 "(%" PRIu64 " * 100 / %" PRIu64 ") - "
+			 "(%" PRIu64 " * 100 / %" PRIu64 ")",
+			  he->stat.period, he->hists->stats.total_period,
+			  pair->stat.period, pair->hists->stats.total_period);
+}
+
+static int formula_ratio(struct hist_entry *he, char *buf, size_t size)
+{
+	struct hist_entry *pair = he->pair;
+	double new_period = he->stat.period;
+	double old_period = pair ? pair->stat.period : 0;
+
+	if (!pair)
+		return -1;
+
+	return scnprintf(buf, size, "%.0F / %.0F", new_period, old_period);
+}
+
+static int formula_wdiff(struct hist_entry *he, char *buf, size_t size)
+{
+	struct hist_entry *pair = he->pair;
+	u64 new_period = he->stat.period;
+	u64 old_period = pair ? pair->stat.period : 0;
+
+	if (!pair)
+		return -1;
+
+	return scnprintf(buf, size,
+		  "(%" PRIu64 " * " "%" PRId64 ") - (%" PRIu64 " * " "%" PRId64 ")",
+		  new_period, compute_wdiff_w2, old_period, compute_wdiff_w1);
+}
+
+int perf_diff__formula(char *buf, size_t size, struct hist_entry *he)
+{
+	switch (compute) {
+	case COMPUTE_DELTA:
+		return formula_delta(he, buf, size);
+	case COMPUTE_RATIO:
+		return formula_ratio(he, buf, size);
+	case COMPUTE_WEIGHTED_DIFF:
+		return formula_wdiff(he, buf, size);
+	default:
+		BUG_ON(1);
+	}
+
+	return -1;
+}
+
 static int hists__add_entry(struct hists *self,
 			    struct addr_location *al, u64 period)
 {
@@ -543,6 +600,8 @@ static const struct option options[] = {
 		     setup_compute),
 	OPT_BOOLEAN('p', "period", &show_period,
 		    "Show period values."),
+	OPT_BOOLEAN('F', "formula", &show_formula,
+		    "Show formula."),
 	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
 		    "dump raw trace in ASCII"),
 	OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
@@ -571,7 +630,10 @@ static void ui_init(void)
 	/* No overhead column. */
 	perf_hpp__column_enable(PERF_HPP__OVERHEAD, false);
 
-	/* Display baseline/delta/ratio/displacement/periods columns. */
+	/*
+	 * Display baseline/delta/ratio/displacement/
+	 * formula/periods columns.
+	 */
 	perf_hpp__column_enable(PERF_HPP__BASELINE, true);
 
 	switch (compute) {
@@ -591,6 +653,9 @@ static void ui_init(void)
 	if (show_displacement)
 		perf_hpp__column_enable(PERF_HPP__DISPL, true);
 
+	if (show_formula)
+		perf_hpp__column_enable(PERF_HPP__FORMULA, true);
+
 	if (show_period) {
 		perf_hpp__column_enable(PERF_HPP__PERIOD, true);
 		perf_hpp__column_enable(PERF_HPP__PERIOD_BASELINE, true);
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 2fadaff..305eb79 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -359,6 +359,27 @@ static int hpp__entry_displ(struct perf_hpp *hpp,
 	return scnprintf(hpp->buf, hpp->size, fmt, buf);
 }
 
+static int hpp__header_formula(struct perf_hpp *hpp)
+{
+	const char *fmt = symbol_conf.field_sep ? "%s" : "%70s";
+
+	return scnprintf(hpp->buf, hpp->size, fmt, "Formula");
+}
+
+static int hpp__width_formula(struct perf_hpp *hpp __maybe_unused)
+{
+	return 70;
+}
+
+static int hpp__entry_formula(struct perf_hpp *hpp, struct hist_entry *he)
+{
+	const char *fmt = symbol_conf.field_sep ? "%s" : "%-70s";
+	char buf[96] = " ";
+
+	perf_diff__formula(buf, sizeof(buf), he);
+	return scnprintf(hpp->buf, hpp->size, fmt, buf);
+}
+
 #define HPP__COLOR_PRINT_FNS(_name)		\
 	.header	= hpp__header_ ## _name,		\
 	.width	= hpp__width_ ## _name,		\
@@ -383,7 +404,8 @@ struct perf_hpp_fmt perf_hpp__format[] = {
 	{ .cond = false, HPP__PRINT_FNS(delta) },
 	{ .cond = false, HPP__PRINT_FNS(ratio) },
 	{ .cond = false, HPP__PRINT_FNS(wdiff) },
-	{ .cond = false, HPP__PRINT_FNS(displ) }
+	{ .cond = false, HPP__PRINT_FNS(displ) },
+	{ .cond = false, HPP__PRINT_FNS(formula) }
 };
 
 #undef HPP__COLOR_PRINT_FNS
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index fbd4e32..f0ee204 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -342,7 +342,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
 	const char *sep = symbol_conf.field_sep;
 	const char *col_width = symbol_conf.col_width_list_str;
 	int idx, nr_rows = 0;
-	char bf[64];
+	char bf[96];
 	struct perf_hpp dummy_hpp = {
 		.buf	= bf,
 		.size	= sizeof(bf),
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 5604791..c751624 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -145,6 +145,7 @@ enum {
 	PERF_HPP__RATIO,
 	PERF_HPP__WEIGHTED_DIFF,
 	PERF_HPP__DISPL,
+	PERF_HPP__FORMULA,
 
 	PERF_HPP__MAX_INDEX
 };
@@ -210,4 +211,5 @@ unsigned int hists__sort_list_width(struct hists *self);
 double perf_diff__compute_delta(struct hist_entry *he);
 double perf_diff__compute_ratio(struct hist_entry *he);
 s64 perf_diff__compute_wdiff(struct hist_entry *he);
+int perf_diff__formula(char *buf, size_t size, struct hist_entry *he);
 #endif	/* __PERF_HIST_H */
-- 
1.7.9.2.358.g22243


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

* [PATCH 10/25] perf diff: Include samples without symbol in overall stats
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (8 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 09/25] perf diff: Add -F option to display formula for computation Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 11/25] perf diff: Display empty space for non paired samples Arnaldo Carvalho de Melo
                   ` (15 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Andi Kleen, Corey Ashford,
	Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Currently we omit samples without symbols. This way we get different and
confusing numbers for samples than from report command.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1349448287-18919-8-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-diff.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index dd9c064..b4db513 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -269,7 +269,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
 		return -1;
 	}
 
-	if (al.filtered || al.sym == NULL)
+	if (al.filtered)
 		return 0;
 
 	if (hists__add_entry(&evsel->hists, &al, sample->period)) {
-- 
1.7.9.2.358.g22243


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

* [PATCH 11/25] perf diff: Display empty space for non paired samples
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (9 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 10/25] perf diff: Include samples without symbol in overall stats Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 12/25] perf tools: Have the page size value available for all tools Arnaldo Carvalho de Melo
                   ` (14 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Andi Kleen, Corey Ashford,
	Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Currently in 'Baseline' and 'Period Base' columns zero values are
displayed in case no pair is found for the sample. This might be
confusing, using empty space instead.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1349448287-18919-9-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/hist.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 305eb79..4f5f475 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -179,7 +179,10 @@ static int hpp__color_baseline(struct perf_hpp *hpp, struct hist_entry *he)
 {
 	double percent = baseline_percent(he);
 
-	return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent);
+	if (he->pair)
+		return percent_color_snprintf(hpp->buf, hpp->size, " %6.2f%%", percent);
+	else
+		return scnprintf(hpp->buf, hpp->size, "        ");
 }
 
 static int hpp__entry_baseline(struct perf_hpp *hpp, struct hist_entry *he)
@@ -187,7 +190,10 @@ static int hpp__entry_baseline(struct perf_hpp *hpp, struct hist_entry *he)
 	double percent = baseline_percent(he);
 	const char *fmt = symbol_conf.field_sep ? "%.2f" : " %6.2f%%";
 
-	return scnprintf(hpp->buf, hpp->size, fmt, percent);
+	if (he->pair || symbol_conf.field_sep)
+		return scnprintf(hpp->buf, hpp->size, fmt, percent);
+	else
+		return scnprintf(hpp->buf, hpp->size, "            ");
 }
 
 static int hpp__header_samples(struct perf_hpp *hpp)
-- 
1.7.9.2.358.g22243


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

* [PATCH 12/25] perf tools: Have the page size value available for all tools
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (10 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 11/25] perf diff: Display empty space for non paired samples Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 13/25] perf machine: Introduce find_thread method Arnaldo Carvalho de Melo
                   ` (13 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Jiri Olsa, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian

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

Its such a common need that we might as well have a global with that
value.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-mwfqji9f17k5j81l1404dk3q@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-test.c          |    2 --
 tools/perf/perf.c                  |    2 ++
 tools/perf/util/evlist.c           |    3 ---
 tools/perf/util/session.c          |    4 +---
 tools/perf/util/trace-event-read.c |    2 --
 tools/perf/util/util.c             |    2 ++
 tools/perf/util/util.h             |    2 ++
 7 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 484f26c..e2d9872d 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -35,7 +35,6 @@ static int test__vmlinux_matches_kallsyms(void)
 	struct map *kallsyms_map, *vmlinux_map;
 	struct machine kallsyms, vmlinux;
 	enum map_type type = MAP__FUNCTION;
-	long page_size = sysconf(_SC_PAGE_SIZE);
 	struct ref_reloc_sym ref_reloc_sym = { .name = "_stext", };
 
 	/*
@@ -1007,7 +1006,6 @@ static void segfault_handler(int sig __maybe_unused,
 
 static int __test__rdpmc(void)
 {
-	long page_size = sysconf(_SC_PAGE_SIZE);
 	volatile int tmp = 0;
 	u64 i, loops = 1000;
 	int n;
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 6d50eb0..d480d8a 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -440,6 +440,8 @@ int main(int argc, const char **argv)
 {
 	const char *cmd;
 
+	page_size = sysconf(_SC_PAGE_SIZE);
+
 	cmd = perf_extract_argv0_path(argv[0]);
 	if (!cmd)
 		cmd = "perf-help";
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 186b877..a41dc4a 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -325,8 +325,6 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
 
 union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
 {
-	/* XXX Move this to perf.c, making it generally available */
-	unsigned int page_size = sysconf(_SC_PAGE_SIZE);
 	struct perf_mmap *md = &evlist->mmap[idx];
 	unsigned int head = perf_mmap__read_head(md);
 	unsigned int old = md->prev;
@@ -528,7 +526,6 @@ out_unmap:
 int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
 		      bool overwrite)
 {
-	unsigned int page_size = sysconf(_SC_PAGE_SIZE);
 	struct perf_evsel *evsel;
 	const struct cpu_map *cpus = evlist->cpus;
 	const struct thread_map *threads = evlist->threads;
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 8cdd232..15abe40 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1375,15 +1375,13 @@ int __perf_session__process_events(struct perf_session *session,
 {
 	u64 head, page_offset, file_offset, file_pos, progress_next;
 	int err, mmap_prot, mmap_flags, map_idx = 0;
-	size_t	page_size, mmap_size;
+	size_t	mmap_size;
 	char *buf, *mmaps[8];
 	union perf_event *event;
 	uint32_t size;
 
 	perf_tool__fill_defaults(tool);
 
-	page_size = sysconf(_SC_PAGESIZE);
-
 	page_offset = page_size * (data_offset / page_size);
 	file_offset = page_offset;
 	head = data_offset - page_offset;
diff --git a/tools/perf/util/trace-event-read.c b/tools/perf/util/trace-event-read.c
index 719ed74..3741572 100644
--- a/tools/perf/util/trace-event-read.c
+++ b/tools/perf/util/trace-event-read.c
@@ -47,8 +47,6 @@ int file_bigendian;
 int host_bigendian;
 static int long_size;
 
-static unsigned long	page_size;
-
 static ssize_t calc_data_size;
 static bool repipe;
 
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 9966459..637b5cc 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -10,6 +10,8 @@
 /*
  * XXX We need to find a better place for these things...
  */
+unsigned int page_size;
+
 bool perf_host  = true;
 bool perf_guest = false;
 
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 70fa70b..a6b83f8 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -263,4 +263,6 @@ char *rtrim(char *s);
 
 void dump_stack(void);
 
+extern unsigned int page_size;
+
 #endif
-- 
1.7.9.2.358.g22243


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

* [PATCH 13/25] perf machine: Introduce find_thread method
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (11 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 12/25] perf tools: Have the page size value available for all tools Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 14/25] perf event: No need to create a thread when handling PERF_RECORD_EXIT Arnaldo Carvalho de Melo
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Jiri Olsa, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian

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

There are cases where we want just to find a thread if it exists
already, so provide a method for that.

While doing that start moving 'machine' methods to a separate file.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-8wpzqs9kfupng6xq8hx6lnxa@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile       |    2 ++
 tools/perf/util/machine.c |   57 +++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/machine.h |   11 +++++++++
 tools/perf/util/thread.c  |   41 +-------------------------------
 tools/perf/util/thread.h  |    2 ++
 5 files changed, 73 insertions(+), 40 deletions(-)
 create mode 100644 tools/perf/util/machine.c
 create mode 100644 tools/perf/util/machine.h

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index f9126f8..d80a333 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -300,6 +300,7 @@ LIB_H += util/evlist.h
 LIB_H += util/exec_cmd.h
 LIB_H += util/types.h
 LIB_H += util/levenshtein.h
+LIB_H += util/machine.h
 LIB_H += util/map.h
 LIB_H += util/parse-options.h
 LIB_H += util/parse-events.h
@@ -383,6 +384,7 @@ LIB_OBJS += $(OUTPUT)util/header.o
 LIB_OBJS += $(OUTPUT)util/callchain.o
 LIB_OBJS += $(OUTPUT)util/values.o
 LIB_OBJS += $(OUTPUT)util/debug.o
+LIB_OBJS += $(OUTPUT)util/machine.o
 LIB_OBJS += $(OUTPUT)util/map.o
 LIB_OBJS += $(OUTPUT)util/pstack.o
 LIB_OBJS += $(OUTPUT)util/session.o
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
new file mode 100644
index 0000000..9d36d7e
--- /dev/null
+++ b/tools/perf/util/machine.c
@@ -0,0 +1,57 @@
+#include "machine.h"
+#include "map.h"
+#include "thread.h"
+#include <stdbool.h>
+
+static struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid,
+						bool create)
+{
+	struct rb_node **p = &machine->threads.rb_node;
+	struct rb_node *parent = NULL;
+	struct thread *th;
+
+	/*
+	 * Font-end cache - PID lookups come in blocks,
+	 * so most of the time we dont have to look up
+	 * the full rbtree:
+	 */
+	if (machine->last_match && machine->last_match->pid == pid)
+		return machine->last_match;
+
+	while (*p != NULL) {
+		parent = *p;
+		th = rb_entry(parent, struct thread, rb_node);
+
+		if (th->pid == pid) {
+			machine->last_match = th;
+			return th;
+		}
+
+		if (pid < th->pid)
+			p = &(*p)->rb_left;
+		else
+			p = &(*p)->rb_right;
+	}
+
+	if (!create)
+		return NULL;
+
+	th = thread__new(pid);
+	if (th != NULL) {
+		rb_link_node(&th->rb_node, parent, p);
+		rb_insert_color(&th->rb_node, &machine->threads);
+		machine->last_match = th;
+	}
+
+	return th;
+}
+
+struct thread *machine__findnew_thread(struct machine *machine, pid_t pid)
+{
+	return __machine__findnew_thread(machine, pid, true);
+}
+
+struct thread *machine__find_thread(struct machine *machine, pid_t pid)
+{
+	return __machine__findnew_thread(machine, pid, false);
+}
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
new file mode 100644
index 0000000..54df0cd
--- /dev/null
+++ b/tools/perf/util/machine.h
@@ -0,0 +1,11 @@
+#ifndef __PERF_MACHINE_H
+#define __PERF_MACHINE_H
+
+#include <sys/types.h>
+
+struct thread;
+struct machine;
+
+struct thread *machine__find_thread(struct machine *machine, pid_t pid);
+
+#endif /* __PERF_MACHINE_H */
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index fb4b7ea..fe3bb1e 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -7,7 +7,7 @@
 #include "util.h"
 #include "debug.h"
 
-static struct thread *thread__new(pid_t pid)
+struct thread *thread__new(pid_t pid)
 {
 	struct thread *self = zalloc(sizeof(*self));
 
@@ -61,45 +61,6 @@ static size_t thread__fprintf(struct thread *self, FILE *fp)
 	       map_groups__fprintf(&self->mg, verbose, fp);
 }
 
-struct thread *machine__findnew_thread(struct machine *self, pid_t pid)
-{
-	struct rb_node **p = &self->threads.rb_node;
-	struct rb_node *parent = NULL;
-	struct thread *th;
-
-	/*
-	 * Font-end cache - PID lookups come in blocks,
-	 * so most of the time we dont have to look up
-	 * the full rbtree:
-	 */
-	if (self->last_match && self->last_match->pid == pid)
-		return self->last_match;
-
-	while (*p != NULL) {
-		parent = *p;
-		th = rb_entry(parent, struct thread, rb_node);
-
-		if (th->pid == pid) {
-			self->last_match = th;
-			return th;
-		}
-
-		if (pid < th->pid)
-			p = &(*p)->rb_left;
-		else
-			p = &(*p)->rb_right;
-	}
-
-	th = thread__new(pid);
-	if (th != NULL) {
-		rb_link_node(&th->rb_node, parent, p);
-		rb_insert_color(&th->rb_node, &self->threads);
-		self->last_match = th;
-	}
-
-	return th;
-}
-
 void thread__insert_map(struct thread *self, struct map *map)
 {
 	map_groups__fixup_overlappings(&self->mg, map, verbose, stderr);
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index f66610b..f2fa17c 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -3,6 +3,7 @@
 
 #include <linux/rbtree.h>
 #include <unistd.h>
+#include <sys/types.h>
 #include "symbol.h"
 
 struct thread {
@@ -22,6 +23,7 @@ struct thread {
 
 struct machine;
 
+struct thread *thread__new(pid_t pid);
 void thread__delete(struct thread *self);
 
 int thread__set_comm(struct thread *self, const char *comm);
-- 
1.7.9.2.358.g22243


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

* [PATCH 14/25] perf event: No need to create a thread when handling PERF_RECORD_EXIT
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (12 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 13/25] perf machine: Introduce find_thread method Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 15/25] perf annotate: Handle PERF_RECORD_EXIT events Arnaldo Carvalho de Melo
                   ` (11 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Jiri Olsa, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian

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

When we were processing a PERF_RECORD_EXIT event we first used
machine__findnew_thread for both the thread exiting and for its parent,
only to use just the thread struct associated with the one exiting, and
to just delete it.

If it existed, i.e. not created at this very moment in
machine__findnew_thread, it will be moved to the machine->dead_threads
linked list, because we may have hist_entries pointing to it, but if it
was created just do be deleted, it will just sit there with no
references at all.

Use the new machine__find_thread() method so that if it is not there, we
don't create it.

As a bonus the parent thread will also not be created at this point.

Create process_fork() and process_exit() helpers to use this and make
the builtins use it instead of the generic process_task(), ditched by
this patch.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-z7n2y98ebjyrvmytaope4vdl@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-annotate.c |    2 +-
 tools/perf/builtin-diff.c     |    4 ++--
 tools/perf/builtin-inject.c   |    6 +++---
 tools/perf/builtin-report.c   |    4 ++--
 tools/perf/builtin-sched.c    |    2 +-
 tools/perf/builtin-script.c   |    4 ++--
 tools/perf/util/build-id.c    |    2 +-
 tools/perf/util/event.c       |   30 ++++++++++++++++++++++--------
 tools/perf/util/event.h       |    6 +++++-
 9 files changed, 39 insertions(+), 21 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 9ea3854..cca2fb5 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -246,7 +246,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
 			.sample	= process_sample_event,
 			.mmap	= perf_event__process_mmap,
 			.comm	= perf_event__process_comm,
-			.fork	= perf_event__process_task,
+			.fork	= perf_event__process_fork,
 			.ordered_samples = true,
 			.ordering_requires_timestamps = true,
 		},
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index b4db513..380683d 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -285,8 +285,8 @@ static struct perf_tool tool = {
 	.sample	= diff__process_sample_event,
 	.mmap	= perf_event__process_mmap,
 	.comm	= perf_event__process_comm,
-	.exit	= perf_event__process_task,
-	.fork	= perf_event__process_task,
+	.exit	= perf_event__process_exit,
+	.fork	= perf_event__process_fork,
 	.lost	= perf_event__process_lost,
 	.ordered_samples = true,
 	.ordering_requires_timestamps = true,
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 4688bea..386a5c0 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -102,14 +102,14 @@ static int perf_event__repipe_mmap(struct perf_tool *tool,
 	return err;
 }
 
-static int perf_event__repipe_task(struct perf_tool *tool,
+static int perf_event__repipe_fork(struct perf_tool *tool,
 				   union perf_event *event,
 				   struct perf_sample *sample,
 				   struct machine *machine)
 {
 	int err;
 
-	err = perf_event__process_task(tool, event, sample, machine);
+	err = perf_event__process_fork(tool, event, sample, machine);
 	perf_event__repipe(tool, event, sample, machine);
 
 	return err;
@@ -227,7 +227,7 @@ static int __cmd_inject(struct perf_inject *inject)
 	if (inject->build_ids) {
 		inject->tool.sample	  = perf_event__inject_buildid;
 		inject->tool.mmap	  = perf_event__repipe_mmap;
-		inject->tool.fork	  = perf_event__repipe_task;
+		inject->tool.fork	  = perf_event__repipe_fork;
 		inject->tool.tracing_data = perf_event__repipe_tracing_data;
 	}
 
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index a61725d..5104a40 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -556,8 +556,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 			.sample		 = process_sample_event,
 			.mmap		 = perf_event__process_mmap,
 			.comm		 = perf_event__process_comm,
-			.exit		 = perf_event__process_task,
-			.fork		 = perf_event__process_task,
+			.exit		 = perf_event__process_exit,
+			.fork		 = perf_event__process_fork,
 			.lost		 = perf_event__process_lost,
 			.read		 = process_read_event,
 			.attr		 = perf_event__process_attr,
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 3488ead..3a25cd8 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1672,7 +1672,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
 			.sample		 = perf_sched__process_tracepoint_sample,
 			.comm		 = perf_event__process_comm,
 			.lost		 = perf_event__process_lost,
-			.fork		 = perf_event__process_task,
+			.fork		 = perf_event__process_fork,
 			.ordered_samples = true,
 		},
 		.cmp_pid	      = LIST_HEAD_INIT(sched.cmp_pid),
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index fb96250..04ceb07 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -520,8 +520,8 @@ static struct perf_tool perf_script = {
 	.sample		 = process_sample_event,
 	.mmap		 = perf_event__process_mmap,
 	.comm		 = perf_event__process_comm,
-	.exit		 = perf_event__process_task,
-	.fork		 = perf_event__process_task,
+	.exit		 = perf_event__process_exit,
+	.fork		 = perf_event__process_fork,
 	.attr		 = perf_event__process_attr,
 	.event_type	 = perf_event__process_event_type,
 	.tracing_data	 = perf_event__process_tracing_data,
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 8e3a740..6a63999 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -64,7 +64,7 @@ static int perf_event__exit_del_thread(struct perf_tool *tool __maybe_unused,
 struct perf_tool build_id__mark_dso_hit_ops = {
 	.sample	= build_id__mark_dso_hit,
 	.mmap	= perf_event__process_mmap,
-	.fork	= perf_event__process_task,
+	.fork	= perf_event__process_fork,
 	.exit	= perf_event__exit_del_thread,
 	.attr		 = perf_event__process_attr,
 	.build_id	 = perf_event__process_build_id,
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 6715b19..eaaee22 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1,6 +1,7 @@
 #include <linux/types.h>
 #include "event.h"
 #include "debug.h"
+#include "machine.h"
 #include "sort.h"
 #include "string.h"
 #include "strlist.h"
@@ -702,10 +703,10 @@ size_t perf_event__fprintf_task(union perf_event *event, FILE *fp)
 		       event->fork.ppid, event->fork.ptid);
 }
 
-int perf_event__process_task(struct perf_tool *tool __maybe_unused,
+int perf_event__process_fork(struct perf_tool *tool __maybe_unused,
 			     union perf_event *event,
 			     struct perf_sample *sample __maybe_unused,
-			      struct machine *machine)
+			     struct machine *machine)
 {
 	struct thread *thread = machine__findnew_thread(machine, event->fork.tid);
 	struct thread *parent = machine__findnew_thread(machine, event->fork.ptid);
@@ -713,11 +714,6 @@ int perf_event__process_task(struct perf_tool *tool __maybe_unused,
 	if (dump_trace)
 		perf_event__fprintf_task(event, stdout);
 
-	if (event->header.type == PERF_RECORD_EXIT) {
-		machine__remove_thread(machine, thread);
-		return 0;
-	}
-
 	if (thread == NULL || parent == NULL ||
 	    thread__fork(thread, parent) < 0) {
 		dump_printf("problem processing PERF_RECORD_FORK, skipping event.\n");
@@ -727,6 +723,22 @@ int perf_event__process_task(struct perf_tool *tool __maybe_unused,
 	return 0;
 }
 
+int perf_event__process_exit(struct perf_tool *tool __maybe_unused,
+			     union perf_event *event,
+			     struct perf_sample *sample __maybe_unused,
+			     struct machine *machine)
+{
+	struct thread *thread = machine__find_thread(machine, event->fork.tid);
+
+	if (dump_trace)
+		perf_event__fprintf_task(event, stdout);
+
+	if (thread != NULL)
+		machine__remove_thread(machine, thread);
+
+	return 0;
+}
+
 size_t perf_event__fprintf(union perf_event *event, FILE *fp)
 {
 	size_t ret = fprintf(fp, "PERF_RECORD_%s",
@@ -761,8 +773,10 @@ int perf_event__process(struct perf_tool *tool, union perf_event *event,
 		perf_event__process_mmap(tool, event, sample, machine);
 		break;
 	case PERF_RECORD_FORK:
+		perf_event__process_fork(tool, event, sample, machine);
+		break;
 	case PERF_RECORD_EXIT:
-		perf_event__process_task(tool, event, sample, machine);
+		perf_event__process_exit(tool, event, sample, machine);
 		break;
 	case PERF_RECORD_LOST:
 		perf_event__process_lost(tool, event, sample, machine);
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 21b99e7..da97aff 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -191,7 +191,11 @@ int perf_event__process_mmap(struct perf_tool *tool,
 			     union perf_event *event,
 			     struct perf_sample *sample,
 			     struct machine *machine);
-int perf_event__process_task(struct perf_tool *tool,
+int perf_event__process_fork(struct perf_tool *tool,
+			     union perf_event *event,
+			     struct perf_sample *sample,
+			     struct machine *machine);
+int perf_event__process_exit(struct perf_tool *tool,
 			     union perf_event *event,
 			     struct perf_sample *sample,
 			     struct machine *machine);
-- 
1.7.9.2.358.g22243


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

* [PATCH 15/25] perf annotate: Handle PERF_RECORD_EXIT events
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (13 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 14/25] perf event: No need to create a thread when handling PERF_RECORD_EXIT Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 16/25] perf sched: " Arnaldo Carvalho de Melo
                   ` (10 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Jiri Olsa, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian

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

Noticed annotate wasn't handling those events while introducing
perf_event__process_{fork,exit}.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-of7tc8eqeuk3cupc6f7jtuq6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-annotate.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index cca2fb5..690fa9a 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -246,6 +246,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
 			.sample	= process_sample_event,
 			.mmap	= perf_event__process_mmap,
 			.comm	= perf_event__process_comm,
+			.exit	= perf_event__process_exit,
 			.fork	= perf_event__process_fork,
 			.ordered_samples = true,
 			.ordering_requires_timestamps = true,
-- 
1.7.9.2.358.g22243


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

* [PATCH 16/25] perf sched: Handle PERF_RECORD_EXIT events
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (14 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 15/25] perf annotate: Handle PERF_RECORD_EXIT events Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 17/25] perf machine: Carve up event processing specific from perf_tool Arnaldo Carvalho de Melo
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Jiri Olsa, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian

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

Noticed sched wasn't handling those events while introducing
perf_event__process_{fork,exit}.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-035rzjtnv9ri8sssi7ojjjq0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 3a25cd8..30e5336 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1672,6 +1672,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
 			.sample		 = perf_sched__process_tracepoint_sample,
 			.comm		 = perf_event__process_comm,
 			.lost		 = perf_event__process_lost,
+			.exit		 = perf_event__process_exit,
 			.fork		 = perf_event__process_fork,
 			.ordered_samples = true,
 		},
-- 
1.7.9.2.358.g22243


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

* [PATCH 17/25] perf machine: Carve up event processing specific from perf_tool
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (15 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 16/25] perf sched: " Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 18/25] perf tools: Remove duplicated include from trace-event-python.c Arnaldo Carvalho de Melo
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Jiri Olsa, Mike Galbraith, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian

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

The perf_tool vtable expects methods that receive perf_tool and
perf_sample entries, but for tools not interested in doing any special
processing on non PERF_RECORD_SAMPLE events, like 'perf top', and for
those not using perf_session, like 'perf trace', they were using
perf_event__process passing tool and sample paramenters that were just
not used.

Provide 'machine' methods for this purpose and make the perf_event
ones use them.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-ot9cc6mt025o8kbngzckcrx9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c  |    3 +-
 tools/perf/util/event.c   |  211 +++----------------------------------------
 tools/perf/util/machine.c |  220 +++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/machine.h |    8 ++
 4 files changed, 242 insertions(+), 200 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index ff6db80..fb9da71 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -26,6 +26,7 @@
 #include "util/color.h"
 #include "util/evlist.h"
 #include "util/evsel.h"
+#include "util/machine.h"
 #include "util/session.h"
 #include "util/symbol.h"
 #include "util/thread.h"
@@ -871,7 +872,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
 						   &sample, machine);
 		} else if (event->header.type < PERF_RECORD_MAX) {
 			hists__inc_nr_events(&evsel->hists, event->header.type);
-			perf_event__process(&top->tool, event, &sample, machine);
+			machine__process_event(machine, event);
 		} else
 			++session->hists.stats.nr_unknown_events;
 	}
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index eaaee22..0ae444e 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -520,134 +520,15 @@ int perf_event__process_comm(struct perf_tool *tool __maybe_unused,
 			     struct perf_sample *sample __maybe_unused,
 			     struct machine *machine)
 {
-	struct thread *thread = machine__findnew_thread(machine, event->comm.tid);
-
-	if (dump_trace)
-		perf_event__fprintf_comm(event, stdout);
-
-	if (thread == NULL || thread__set_comm(thread, event->comm.comm)) {
-		dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n");
-		return -1;
-	}
-
-	return 0;
+	return machine__process_comm_event(machine, event);
 }
 
 int perf_event__process_lost(struct perf_tool *tool __maybe_unused,
 			     union perf_event *event,
 			     struct perf_sample *sample __maybe_unused,
-			     struct machine *machine __maybe_unused)
-{
-	dump_printf(": id:%" PRIu64 ": lost:%" PRIu64 "\n",
-		    event->lost.id, event->lost.lost);
-	return 0;
-}
-
-static void perf_event__set_kernel_mmap_len(union perf_event *event,
-					    struct map **maps)
-{
-	maps[MAP__FUNCTION]->start = event->mmap.start;
-	maps[MAP__FUNCTION]->end   = event->mmap.start + event->mmap.len;
-	/*
-	 * Be a bit paranoid here, some perf.data file came with
-	 * a zero sized synthesized MMAP event for the kernel.
-	 */
-	if (maps[MAP__FUNCTION]->end == 0)
-		maps[MAP__FUNCTION]->end = ~0ULL;
-}
-
-static int perf_event__process_kernel_mmap(struct perf_tool *tool
-					   __maybe_unused,
-					   union perf_event *event,
-					   struct machine *machine)
+			     struct machine *machine)
 {
-	struct map *map;
-	char kmmap_prefix[PATH_MAX];
-	enum dso_kernel_type kernel_type;
-	bool is_kernel_mmap;
-
-	machine__mmap_name(machine, kmmap_prefix, sizeof(kmmap_prefix));
-	if (machine__is_host(machine))
-		kernel_type = DSO_TYPE_KERNEL;
-	else
-		kernel_type = DSO_TYPE_GUEST_KERNEL;
-
-	is_kernel_mmap = memcmp(event->mmap.filename,
-				kmmap_prefix,
-				strlen(kmmap_prefix) - 1) == 0;
-	if (event->mmap.filename[0] == '/' ||
-	    (!is_kernel_mmap && event->mmap.filename[0] == '[')) {
-
-		char short_module_name[1024];
-		char *name, *dot;
-
-		if (event->mmap.filename[0] == '/') {
-			name = strrchr(event->mmap.filename, '/');
-			if (name == NULL)
-				goto out_problem;
-
-			++name; /* skip / */
-			dot = strrchr(name, '.');
-			if (dot == NULL)
-				goto out_problem;
-			snprintf(short_module_name, sizeof(short_module_name),
-					"[%.*s]", (int)(dot - name), name);
-			strxfrchar(short_module_name, '-', '_');
-		} else
-			strcpy(short_module_name, event->mmap.filename);
-
-		map = machine__new_module(machine, event->mmap.start,
-					  event->mmap.filename);
-		if (map == NULL)
-			goto out_problem;
-
-		name = strdup(short_module_name);
-		if (name == NULL)
-			goto out_problem;
-
-		map->dso->short_name = name;
-		map->dso->sname_alloc = 1;
-		map->end = map->start + event->mmap.len;
-	} else if (is_kernel_mmap) {
-		const char *symbol_name = (event->mmap.filename +
-				strlen(kmmap_prefix));
-		/*
-		 * Should be there already, from the build-id table in
-		 * the header.
-		 */
-		struct dso *kernel = __dsos__findnew(&machine->kernel_dsos,
-						     kmmap_prefix);
-		if (kernel == NULL)
-			goto out_problem;
-
-		kernel->kernel = kernel_type;
-		if (__machine__create_kernel_maps(machine, kernel) < 0)
-			goto out_problem;
-
-		perf_event__set_kernel_mmap_len(event, machine->vmlinux_maps);
-
-		/*
-		 * Avoid using a zero address (kptr_restrict) for the ref reloc
-		 * symbol. Effectively having zero here means that at record
-		 * time /proc/sys/kernel/kptr_restrict was non zero.
-		 */
-		if (event->mmap.pgoff != 0) {
-			maps__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps,
-							 symbol_name,
-							 event->mmap.pgoff);
-		}
-
-		if (machine__is_default_guest(machine)) {
-			/*
-			 * preload dso of guest kernel and modules
-			 */
-			dso__load(kernel, machine->vmlinux_maps[MAP__FUNCTION],
-				  NULL);
-		}
-	}
-	return 0;
-out_problem:
-	return -1;
+	return machine__process_lost_event(machine, event);
 }
 
 size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp)
@@ -657,43 +538,12 @@ size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp)
 		       event->mmap.len, event->mmap.pgoff, event->mmap.filename);
 }
 
-int perf_event__process_mmap(struct perf_tool *tool,
+int perf_event__process_mmap(struct perf_tool *tool __maybe_unused,
 			     union perf_event *event,
 			     struct perf_sample *sample __maybe_unused,
 			     struct machine *machine)
 {
-	struct thread *thread;
-	struct map *map;
-	u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
-	int ret = 0;
-
-	if (dump_trace)
-		perf_event__fprintf_mmap(event, stdout);
-
-	if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL ||
-	    cpumode == PERF_RECORD_MISC_KERNEL) {
-		ret = perf_event__process_kernel_mmap(tool, event, machine);
-		if (ret < 0)
-			goto out_problem;
-		return 0;
-	}
-
-	thread = machine__findnew_thread(machine, event->mmap.pid);
-	if (thread == NULL)
-		goto out_problem;
-	map = map__new(&machine->user_dsos, event->mmap.start,
-			event->mmap.len, event->mmap.pgoff,
-			event->mmap.pid, event->mmap.filename,
-			MAP__FUNCTION);
-	if (map == NULL)
-		goto out_problem;
-
-	thread__insert_map(thread, map);
-	return 0;
-
-out_problem:
-	dump_printf("problem processing PERF_RECORD_MMAP, skipping event.\n");
-	return 0;
+	return machine__process_mmap_event(machine, event);
 }
 
 size_t perf_event__fprintf_task(union perf_event *event, FILE *fp)
@@ -708,19 +558,7 @@ int perf_event__process_fork(struct perf_tool *tool __maybe_unused,
 			     struct perf_sample *sample __maybe_unused,
 			     struct machine *machine)
 {
-	struct thread *thread = machine__findnew_thread(machine, event->fork.tid);
-	struct thread *parent = machine__findnew_thread(machine, event->fork.ptid);
-
-	if (dump_trace)
-		perf_event__fprintf_task(event, stdout);
-
-	if (thread == NULL || parent == NULL ||
-	    thread__fork(thread, parent) < 0) {
-		dump_printf("problem processing PERF_RECORD_FORK, skipping event.\n");
-		return -1;
-	}
-
-	return 0;
+	return machine__process_fork_event(machine, event);
 }
 
 int perf_event__process_exit(struct perf_tool *tool __maybe_unused,
@@ -728,15 +566,7 @@ int perf_event__process_exit(struct perf_tool *tool __maybe_unused,
 			     struct perf_sample *sample __maybe_unused,
 			     struct machine *machine)
 {
-	struct thread *thread = machine__find_thread(machine, event->fork.tid);
-
-	if (dump_trace)
-		perf_event__fprintf_task(event, stdout);
-
-	if (thread != NULL)
-		machine__remove_thread(machine, thread);
-
-	return 0;
+	return machine__process_exit_event(machine, event);
 }
 
 size_t perf_event__fprintf(union perf_event *event, FILE *fp)
@@ -762,29 +592,12 @@ size_t perf_event__fprintf(union perf_event *event, FILE *fp)
 	return ret;
 }
 
-int perf_event__process(struct perf_tool *tool, union perf_event *event,
-			struct perf_sample *sample, struct machine *machine)
+int perf_event__process(struct perf_tool *tool __maybe_unused,
+			union perf_event *event,
+			struct perf_sample *sample __maybe_unused,
+			struct machine *machine)
 {
-	switch (event->header.type) {
-	case PERF_RECORD_COMM:
-		perf_event__process_comm(tool, event, sample, machine);
-		break;
-	case PERF_RECORD_MMAP:
-		perf_event__process_mmap(tool, event, sample, machine);
-		break;
-	case PERF_RECORD_FORK:
-		perf_event__process_fork(tool, event, sample, machine);
-		break;
-	case PERF_RECORD_EXIT:
-		perf_event__process_exit(tool, event, sample, machine);
-		break;
-	case PERF_RECORD_LOST:
-		perf_event__process_lost(tool, event, sample, machine);
-	default:
-		break;
-	}
-
-	return 0;
+	return machine__process_event(machine, event);
 }
 
 void thread__find_addr_map(struct thread *self,
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 9d36d7e..502eec0 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1,3 +1,5 @@
+#include "debug.h"
+#include "event.h"
 #include "machine.h"
 #include "map.h"
 #include "thread.h"
@@ -55,3 +57,221 @@ struct thread *machine__find_thread(struct machine *machine, pid_t pid)
 {
 	return __machine__findnew_thread(machine, pid, false);
 }
+
+int machine__process_comm_event(struct machine *machine, union perf_event *event)
+{
+	struct thread *thread = machine__findnew_thread(machine, event->comm.tid);
+
+	if (dump_trace)
+		perf_event__fprintf_comm(event, stdout);
+
+	if (thread == NULL || thread__set_comm(thread, event->comm.comm)) {
+		dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n");
+		return -1;
+	}
+
+	return 0;
+}
+
+int machine__process_lost_event(struct machine *machine __maybe_unused,
+				union perf_event *event)
+{
+	dump_printf(": id:%" PRIu64 ": lost:%" PRIu64 "\n",
+		    event->lost.id, event->lost.lost);
+	return 0;
+}
+
+static void machine__set_kernel_mmap_len(struct machine *machine,
+					 union perf_event *event)
+{
+	machine->vmlinux_maps[MAP__FUNCTION]->start = event->mmap.start;
+	machine->vmlinux_maps[MAP__FUNCTION]->end   = (event->mmap.start +
+						       event->mmap.len);
+	/*
+	 * Be a bit paranoid here, some perf.data file came with
+	 * a zero sized synthesized MMAP event for the kernel.
+	 */
+	if (machine->vmlinux_maps[MAP__FUNCTION]->end == 0)
+		machine->vmlinux_maps[MAP__FUNCTION]->end = ~0ULL;
+}
+
+static int machine__process_kernel_mmap_event(struct machine *machine,
+					      union perf_event *event)
+{
+	struct map *map;
+	char kmmap_prefix[PATH_MAX];
+	enum dso_kernel_type kernel_type;
+	bool is_kernel_mmap;
+
+	machine__mmap_name(machine, kmmap_prefix, sizeof(kmmap_prefix));
+	if (machine__is_host(machine))
+		kernel_type = DSO_TYPE_KERNEL;
+	else
+		kernel_type = DSO_TYPE_GUEST_KERNEL;
+
+	is_kernel_mmap = memcmp(event->mmap.filename,
+				kmmap_prefix,
+				strlen(kmmap_prefix) - 1) == 0;
+	if (event->mmap.filename[0] == '/' ||
+	    (!is_kernel_mmap && event->mmap.filename[0] == '[')) {
+
+		char short_module_name[1024];
+		char *name, *dot;
+
+		if (event->mmap.filename[0] == '/') {
+			name = strrchr(event->mmap.filename, '/');
+			if (name == NULL)
+				goto out_problem;
+
+			++name; /* skip / */
+			dot = strrchr(name, '.');
+			if (dot == NULL)
+				goto out_problem;
+			snprintf(short_module_name, sizeof(short_module_name),
+					"[%.*s]", (int)(dot - name), name);
+			strxfrchar(short_module_name, '-', '_');
+		} else
+			strcpy(short_module_name, event->mmap.filename);
+
+		map = machine__new_module(machine, event->mmap.start,
+					  event->mmap.filename);
+		if (map == NULL)
+			goto out_problem;
+
+		name = strdup(short_module_name);
+		if (name == NULL)
+			goto out_problem;
+
+		map->dso->short_name = name;
+		map->dso->sname_alloc = 1;
+		map->end = map->start + event->mmap.len;
+	} else if (is_kernel_mmap) {
+		const char *symbol_name = (event->mmap.filename +
+				strlen(kmmap_prefix));
+		/*
+		 * Should be there already, from the build-id table in
+		 * the header.
+		 */
+		struct dso *kernel = __dsos__findnew(&machine->kernel_dsos,
+						     kmmap_prefix);
+		if (kernel == NULL)
+			goto out_problem;
+
+		kernel->kernel = kernel_type;
+		if (__machine__create_kernel_maps(machine, kernel) < 0)
+			goto out_problem;
+
+		machine__set_kernel_mmap_len(machine, event);
+
+		/*
+		 * Avoid using a zero address (kptr_restrict) for the ref reloc
+		 * symbol. Effectively having zero here means that at record
+		 * time /proc/sys/kernel/kptr_restrict was non zero.
+		 */
+		if (event->mmap.pgoff != 0) {
+			maps__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps,
+							 symbol_name,
+							 event->mmap.pgoff);
+		}
+
+		if (machine__is_default_guest(machine)) {
+			/*
+			 * preload dso of guest kernel and modules
+			 */
+			dso__load(kernel, machine->vmlinux_maps[MAP__FUNCTION],
+				  NULL);
+		}
+	}
+	return 0;
+out_problem:
+	return -1;
+}
+
+int machine__process_mmap_event(struct machine *machine, union perf_event *event)
+{
+	u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
+	struct thread *thread;
+	struct map *map;
+	int ret = 0;
+
+	if (dump_trace)
+		perf_event__fprintf_mmap(event, stdout);
+
+	if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL ||
+	    cpumode == PERF_RECORD_MISC_KERNEL) {
+		ret = machine__process_kernel_mmap_event(machine, event);
+		if (ret < 0)
+			goto out_problem;
+		return 0;
+	}
+
+	thread = machine__findnew_thread(machine, event->mmap.pid);
+	if (thread == NULL)
+		goto out_problem;
+	map = map__new(&machine->user_dsos, event->mmap.start,
+			event->mmap.len, event->mmap.pgoff,
+			event->mmap.pid, event->mmap.filename,
+			MAP__FUNCTION);
+	if (map == NULL)
+		goto out_problem;
+
+	thread__insert_map(thread, map);
+	return 0;
+
+out_problem:
+	dump_printf("problem processing PERF_RECORD_MMAP, skipping event.\n");
+	return 0;
+}
+
+int machine__process_fork_event(struct machine *machine, union perf_event *event)
+{
+	struct thread *thread = machine__findnew_thread(machine, event->fork.tid);
+	struct thread *parent = machine__findnew_thread(machine, event->fork.ptid);
+
+	if (dump_trace)
+		perf_event__fprintf_task(event, stdout);
+
+	if (thread == NULL || parent == NULL ||
+	    thread__fork(thread, parent) < 0) {
+		dump_printf("problem processing PERF_RECORD_FORK, skipping event.\n");
+		return -1;
+	}
+
+	return 0;
+}
+
+int machine__process_exit_event(struct machine *machine, union perf_event *event)
+{
+	struct thread *thread = machine__find_thread(machine, event->fork.tid);
+
+	if (dump_trace)
+		perf_event__fprintf_task(event, stdout);
+
+	if (thread != NULL)
+		machine__remove_thread(machine, thread);
+
+	return 0;
+}
+
+int machine__process_event(struct machine *machine, union perf_event *event)
+{
+	int ret;
+
+	switch (event->header.type) {
+	case PERF_RECORD_COMM:
+		ret = machine__process_comm_event(machine, event); break;
+	case PERF_RECORD_MMAP:
+		ret = machine__process_mmap_event(machine, event); break;
+	case PERF_RECORD_FORK:
+		ret = machine__process_fork_event(machine, event); break;
+	case PERF_RECORD_EXIT:
+		ret = machine__process_exit_event(machine, event); break;
+	case PERF_RECORD_LOST:
+		ret = machine__process_lost_event(machine, event); break;
+	default:
+		ret = -1;
+		break;
+	}
+
+	return ret;
+}
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
index 54df0cd..df152f1 100644
--- a/tools/perf/util/machine.h
+++ b/tools/perf/util/machine.h
@@ -5,7 +5,15 @@
 
 struct thread;
 struct machine;
+union perf_event;
 
 struct thread *machine__find_thread(struct machine *machine, pid_t pid);
 
+int machine__process_comm_event(struct machine *machine, union perf_event *event);
+int machine__process_exit_event(struct machine *machine, union perf_event *event);
+int machine__process_fork_event(struct machine *machine, union perf_event *event);
+int machine__process_lost_event(struct machine *machine, union perf_event *event);
+int machine__process_mmap_event(struct machine *machine, union perf_event *event);
+int machine__process_event(struct machine *machine, union perf_event *event);
+
 #endif /* __PERF_MACHINE_H */
-- 
1.7.9.2.358.g22243


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

* [PATCH 18/25] perf tools: Remove duplicated include from trace-event-python.c
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (16 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 17/25] perf machine: Carve up event processing specific from perf_tool Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 19/25] perf kvm: Only process events for vcpus of interest Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wei Yongjun, Ingo Molnar, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Remove duplicated include.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Link: http://lkml.kernel.org/r/CAPgLHd8fz+TznMVRdhzPb45WtZQXhVxadRQcLxUC4O9aX+SUbA@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 .../util/scripting-engines/trace-event-python.c    |    1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 730c663..14683df 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -32,7 +32,6 @@
 #include "../event.h"
 #include "../thread.h"
 #include "../trace-event.h"
-#include "../evsel.h"
 
 PyMODINIT_FUNC initperf_trace_context(void);
 
-- 
1.7.9.2.358.g22243


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

* [PATCH 19/25] perf kvm: Only process events for vcpus of interest
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (17 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 18/25] perf tools: Remove duplicated include from trace-event-python.c Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 20/25] perf kvm: Remove typecast in init_kvm_event_record Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Dong Hao, Frederic Weisbecker,
	Peter Zijlstra, Xiao Guangrong, Arnaldo Carvalho de Melo

From: David Ahern <dsahern@gmail.com>

Minimizing processing overhead for each sample - which becomes important
for the upcoming live mode when it has to deal with 100+k events per
second.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Dong Hao <haodong@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1349716656-48165-12-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-kvm.c |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 260abc5..b98095e 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -416,7 +416,10 @@ static double kvm_event_rel_stddev(int vcpu_id, struct kvm_event *event)
 static bool update_kvm_event(struct kvm_event *event, int vcpu_id,
 			     u64 time_diff)
 {
-	kvm_update_event_stats(&event->total, time_diff);
+	if (vcpu_id == -1) {
+		kvm_update_event_stats(&event->total, time_diff);
+		return true;
+	}
 
 	if (!kvm_event_expand(event, vcpu_id))
 		return false;
@@ -432,6 +435,12 @@ static bool handle_end_event(struct perf_kvm *kvm,
 {
 	struct kvm_event *event;
 	u64 time_begin, time_diff;
+	int vcpu;
+
+	if (kvm->trace_vcpu == -1)
+		vcpu = -1;
+	else
+		vcpu = vcpu_record->vcpu_id;
 
 	event = vcpu_record->last_event;
 	time_begin = vcpu_record->start_time;
@@ -461,7 +470,7 @@ static bool handle_end_event(struct perf_kvm *kvm,
 	BUG_ON(timestamp < time_begin);
 
 	time_diff = timestamp - time_begin;
-	return update_kvm_event(event, vcpu_record->vcpu_id, time_diff);
+	return update_kvm_event(event, vcpu, time_diff);
 }
 
 static
@@ -498,6 +507,11 @@ static bool handle_kvm_event(struct perf_kvm *kvm,
 	if (!vcpu_record)
 		return true;
 
+	/* only process events for vcpus user cares about */
+	if ((kvm->trace_vcpu != -1) &&
+	    (kvm->trace_vcpu != vcpu_record->vcpu_id))
+		return true;
+
 	if (kvm->events_ops->is_begin_event(evsel, sample, &key))
 		return handle_begin_event(kvm, vcpu_record, &key, sample->time);
 
-- 
1.7.9.2.358.g22243


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

* [PATCH 20/25] perf kvm: Remove typecast in init_kvm_event_record
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (18 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 19/25] perf kvm: Only process events for vcpus of interest Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 21/25] perf kvm: Total count is a u64, print as so Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Dong Hao, Frederic Weisbecker,
	Peter Zijlstra, Xiao Guangrong, Arnaldo Carvalho de Melo

From: David Ahern <dsahern@gmail.com>

Not needed after changing i to unsigned int.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Dong Hao <haodong@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1349716656-48165-7-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-kvm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index b98095e..8416754 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -313,9 +313,9 @@ struct vcpu_event_record {
 
 static void init_kvm_event_record(struct perf_kvm *kvm)
 {
-	int i;
+	unsigned int i;
 
-	for (i = 0; i < (int)EVENTS_CACHE_SIZE; i++)
+	for (i = 0; i < EVENTS_CACHE_SIZE; i++)
 		INIT_LIST_HEAD(&kvm->kvm_events_cache[i]);
 }
 
-- 
1.7.9.2.358.g22243


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

* [PATCH 21/25] perf kvm: Total count is a u64, print as so
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (19 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 20/25] perf kvm: Remove typecast in init_kvm_event_record Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 22/25] perf kvm: Add braces around multi-line statements Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Dong Hao, Frederic Weisbecker,
	Peter Zijlstra, Xiao Guangrong, Arnaldo Carvalho de Melo

From: David Ahern <dsahern@gmail.com>

remove cast and use proper type in format.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Dong Hao <haodong@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1349716656-48165-11-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-kvm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 8416754..72a302e 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -673,8 +673,8 @@ static void print_result(struct perf_kvm *kvm)
 		pr_info("\n");
 	}
 
-	pr_info("\nTotal Samples:%lld, Total events handled time:%.2fus.\n\n",
-		(unsigned long long)kvm->total_count, kvm->total_time / 1e3);
+	pr_info("\nTotal Samples:%" PRIu64 ", Total events handled time:%.2fus.\n\n",
+		kvm->total_count, kvm->total_time / 1e3);
 }
 
 static int process_sample_event(struct perf_tool *tool,
-- 
1.7.9.2.358.g22243


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

* [PATCH 22/25] perf kvm: Add braces around multi-line statements
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (20 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 21/25] perf kvm: Total count is a u64, print as so Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 23/25] perf tools: Add on_exit implementation Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Dong Hao, Frederic Weisbecker,
	Peter Zijlstra, Xiao Guangrong, Arnaldo Carvalho de Melo

From: David Ahern <dsahern@gmail.com>

Multi-line statements should have braces. Improves readability.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Dong Hao <haodong@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1349716656-48165-9-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-kvm.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 72a302e..836c82f 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -369,9 +369,10 @@ static struct kvm_event *find_create_kvm_event(struct perf_kvm *kvm,
 	BUG_ON(key->key == INVALID_KEY);
 
 	head = &kvm->kvm_events_cache[kvm_events_hash_fn(key->key)];
-	list_for_each_entry(event, head, hash_entry)
+	list_for_each_entry(event, head, hash_entry) {
 		if (event->key.key == key->key && event->key.info == key->info)
 			return event;
+	}
 
 	event = kvm_alloc_init_event(key);
 	if (!event)
@@ -610,13 +611,15 @@ static void sort_result(struct perf_kvm *kvm)
 	int vcpu = kvm->trace_vcpu;
 	struct kvm_event *event;
 
-	for (i = 0; i < EVENTS_CACHE_SIZE; i++)
-		list_for_each_entry(event, &kvm->kvm_events_cache[i], hash_entry)
+	for (i = 0; i < EVENTS_CACHE_SIZE; i++) {
+		list_for_each_entry(event, &kvm->kvm_events_cache[i], hash_entry) {
 			if (event_is_valid(event, vcpu)) {
 				update_total_count(kvm, event);
 				insert_to_result(&kvm->result, event,
 						 kvm->compare, vcpu);
 			}
+		}
+	}
 }
 
 /* returns left most element of result, and erase it */
-- 
1.7.9.2.358.g22243


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

* [PATCH 23/25] perf tools: Add on_exit implementation
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (21 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 22/25] perf kvm: Add braces around multi-line statements Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 24/25] perf tools: Update Makefile for Android Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Bernhard Rosenkraenzer, Irina Tirdea, David Ahern,
	Jiri Olsa, Namhyung Kim, Paul Mackerras, Pekka Enberg,
	Peter Zijlstra, Steven Rostedt, Arnaldo Carvalho de Melo

From: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>

on_exit() is only available in new versions of glibc.
It is not implemented in Bionic and will lead to linking errors when
compiling for Android.

Implement a wrapper for on_exit using atexit.

The implementation for on_exit is the one sent by Bernhard Rosenkraenzer in
https://lkml.org/lkml/2012/8/23/316. The configuration part from the Makefile
is different than the one from the original patch.

Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Irina Tirdea <irina.tirdea@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1349678613-7045-2-git-send-email-irina.tirdea@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile                 |    6 ++++++
 tools/perf/builtin-record.c         |   32 ++++++++++++++++++++++++++++++++
 tools/perf/config/feature-tests.mak |   11 ++++++++++-
 3 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d80a333..a7d8745 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -753,6 +753,12 @@ ifndef NO_STRLCPY
 	endif
 endif
 
+ifndef NO_ON_EXIT
+	ifeq ($(call try-cc,$(SOURCE_ON_EXIT),),y)
+		BASIC_CFLAGS += -DHAVE_ON_EXIT
+	endif
+endif
+
 ifndef NO_BACKTRACE
        ifeq ($(call try-cc,$(SOURCE_BACKTRACE),),y)
                BASIC_CFLAGS += -DBACKTRACE_SUPPORT
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index e9231659..73b5d7f 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -31,6 +31,38 @@
 #include <sched.h>
 #include <sys/mman.h>
 
+#ifndef HAVE_ON_EXIT
+#ifndef ATEXIT_MAX
+#define ATEXIT_MAX 32
+#endif
+static int __on_exit_count = 0;
+typedef void (*on_exit_func_t) (int, void *);
+static on_exit_func_t __on_exit_funcs[ATEXIT_MAX];
+static void *__on_exit_args[ATEXIT_MAX];
+static int __exitcode = 0;
+static void __handle_on_exit_funcs(void);
+static int on_exit(on_exit_func_t function, void *arg);
+#define exit(x) (exit)(__exitcode = (x))
+
+static int on_exit(on_exit_func_t function, void *arg)
+{
+	if (__on_exit_count == ATEXIT_MAX)
+		return -ENOMEM;
+	else if (__on_exit_count == 0)
+		atexit(__handle_on_exit_funcs);
+	__on_exit_funcs[__on_exit_count] = function;
+	__on_exit_args[__on_exit_count++] = arg;
+	return 0;
+}
+
+static void __handle_on_exit_funcs(void)
+{
+	int i;
+	for (i = 0; i < __on_exit_count; i++)
+		__on_exit_funcs[i] (__exitcode, __on_exit_args[i]);
+}
+#endif
+
 enum write_mode_t {
 	WRITE_FORCE,
 	WRITE_APPEND
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index 4add41b..eaeb0fd 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -203,4 +203,13 @@ int main(void)
 	return audit_open();
 }
 endef
-endif
\ No newline at end of file
+endif
+
+define SOURCE_ON_EXIT
+#include <stdio.h>
+
+int main(void)
+{
+	return on_exit(NULL, NULL);
+}
+endef
-- 
1.7.9.2.358.g22243


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

* [PATCH 24/25] perf tools: Update Makefile for Android
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (22 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 23/25] perf tools: Add on_exit implementation Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-08 22:32 ` [PATCH 25/25] Documentation: add documentation on compiling " Arnaldo Carvalho de Melo
  2012-10-09 13:34 ` [GIT PULL 00/25] perf/core improvements and fixes Ingo Molnar
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Irina Tirdea, Bernhard Rosenkraenzer, David Ahern,
	Jiri Olsa, Namhyung Kim, Paul Mackerras, Pekka Enberg,
	Peter Zijlstra, Steven Rostedt, Arnaldo Carvalho de Melo

From: Irina Tirdea <irina.tirdea@intel.com>

For cross-compiling on Android, some specific changes are needed in
the Makefile.

Update the Makefile to support cross-compiling for Android.
The original ideea for this was send by Bernhard Rosenkraenzer in
https://lkml.org/lkml/2012/8/23/316, but this is a rewrite.

Changes:
() support bionic in addition to glibc
() remove rt and pthread libraries that do not exist in Android
() use $(CFLAGS) when detecting initial compiler flags. This is needed
when setting CFLAGS as an argument of make (e.g. for setting --sysroot).
() include perf's local directory when building for Android to be able to find
relative paths if using --sysroot (e.g.: ../../include/linux/perf_event.h)

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Cc: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1349678613-7045-3-git-send-email-irina.tirdea@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile                 |   25 +++++++++++++++++++------
 tools/perf/config/feature-tests.mak |    9 +++++++++
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index a7d8745..318bec8 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -155,15 +155,15 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 
 -include config/feature-tests.mak
 
-ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -fstack-protector-all),y)
+ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all),y)
 	CFLAGS := $(CFLAGS) -fstack-protector-all
 endif
 
-ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wstack-protector),y)
+ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector),y)
        CFLAGS := $(CFLAGS) -Wstack-protector
 endif
 
-ifeq ($(call try-cc,$(SOURCE_HELLO),-Werror -Wvolatile-register-var),y)
+ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var),y)
        CFLAGS := $(CFLAGS) -Wvolatile-register-var
 endif
 
@@ -172,6 +172,13 @@ endif
 BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 BASIC_LDFLAGS =
 
+ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS)),y)
+	BIONIC := 1
+	EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
+	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
+	BASIC_CFLAGS += -I.
+endif
+
 # Guard against environment variables
 BUILTIN_OBJS =
 LIB_H =
@@ -469,12 +476,18 @@ else
 FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
 ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF)),y)
 	FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
-	ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y)
-		msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
-	else
+	ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC)),y)
+		LIBC_SUPPORT := 1
+	endif
+	ifeq ($(BIONIC),1)
+		LIBC_SUPPORT := 1
+	endif
+	ifeq ($(LIBC_SUPPORT),1)
 		NO_LIBELF := 1
 		NO_DWARF := 1
 		NO_DEMANGLE := 1
+	else
+		msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
 	endif
 else
 	FLAGS_DWARF=$(ALL_CFLAGS) -ldw -lelf $(ALL_LDFLAGS) $(EXTLIBS)
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index eaeb0fd..3ef5ec9 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -43,6 +43,15 @@ int main(void)
 }
 endef
 
+define SOURCE_BIONIC
+#include <android/api-level.h>
+
+int main(void)
+{
+	return __ANDROID_API__;
+}
+endef
+
 define SOURCE_ELF_MMAP
 #include <libelf.h>
 int main(void)
-- 
1.7.9.2.358.g22243


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

* [PATCH 25/25] Documentation: add documentation on compiling for Android
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (23 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 24/25] perf tools: Update Makefile for Android Arnaldo Carvalho de Melo
@ 2012-10-08 22:32 ` Arnaldo Carvalho de Melo
  2012-10-09 13:34 ` [GIT PULL 00/25] perf/core improvements and fixes Ingo Molnar
  25 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-08 22:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Irina Tirdea, David Ahern, Jiri Olsa, Namhyung Kim,
	Paul Mackerras, Pekka Enberg, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Irina Tirdea <irina.tirdea@intel.com>

Add documentation for cross-compiling on Android including:

() instructions on how to set the Android NDK environment
() how to cross-compile perf for Android
() how to install on an Android device/emulator, set the runtime
environment and run it

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1349678613-7045-4-git-send-email-irina.tirdea@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/android.txt |   75 ++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 tools/perf/Documentation/android.txt

diff --git a/tools/perf/Documentation/android.txt b/tools/perf/Documentation/android.txt
new file mode 100644
index 0000000..a39dbbb
--- /dev/null
+++ b/tools/perf/Documentation/android.txt
@@ -0,0 +1,75 @@
+How to compile perf for Android
+=========================================
+
+I. Set the Android NDK environment
+------------------------------------------------
+
+(a). Use the Android NDK
+------------------------------------------------
+1. You need to download and install the Android Native Development Kit (NDK).
+Set the NDK variable to point to the path where you installed the NDK:
+  export NDK=/path/to/android-ndk
+
+2. Set cross-compiling environment variables for NDK toolchain and sysroot.
+For arm:
+  export NDK_TOOLCHAIN=${NDK}/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-
+  export NDK_SYSROOT=${NDK}/platforms/android-9/arch-arm
+For x86:
+  export NDK_TOOLCHAIN=${NDK}/toolchains/x86-4.6/prebuilt/linux-x86/bin/i686-linux-android-
+  export NDK_SYSROOT=${NDK}/platforms/android-9/arch-x86
+
+This method is not working for Android NDK versions up to Revision 8b.
+perf uses some bionic enhancements that are not included in these NDK versions.
+You can use method (b) described below instead.
+
+(b). Use the Android source tree
+-----------------------------------------------
+1. Download the master branch of the Android source tree.
+Set the environment for the target you want using:
+  source build/envsetup.sh
+  lunch
+
+2. Build your own NDK sysroot to contain latest bionic changes and set the
+NDK sysroot environment variable.
+  cd ${ANDROID_BUILD_TOP}/ndk
+For arm:
+  ./build/tools/build-ndk-sysroot.sh --abi=arm
+  export NDK_SYSROOT=${ANDROID_BUILD_TOP}/ndk/build/platforms/android-3/arch-arm
+For x86:
+  ./build/tools/build-ndk-sysroot.sh --abi=x86
+  export NDK_SYSROOT=${ANDROID_BUILD_TOP}/ndk/build/platforms/android-3/arch-x86
+
+3. Set the NDK toolchain environment variable.
+For arm:
+  export NDK_TOOLCHAIN=${ANDROID_TOOLCHAIN}/arm-linux-androideabi-
+For x86:
+  export NDK_TOOLCHAIN=${ANDROID_TOOLCHAIN}/i686-linux-android-
+
+II. Compile perf for Android
+------------------------------------------------
+You need to run make with the NDK toolchain and sysroot defined above:
+  make CROSS_COMPILE=${NDK_TOOLCHAIN} CFLAGS="--sysroot=${NDK_SYSROOT}"
+
+III. Install perf
+-----------------------------------------------
+You need to connect to your Android device/emulator using adb.
+Install perf using:
+  adb push perf /data/perf
+
+If you also want to use perf-archive you need busybox tools for Android.
+For installing perf-archive, you first need to replace #!/bin/bash with #!/system/bin/sh:
+  sed 's/#!\/bin\/bash/#!\/system\/bin\/sh/g' perf-archive >> /tmp/perf-archive
+  chmod +x /tmp/perf-archive
+  adb push /tmp/perf-archive /data/perf-archive
+
+IV. Environment settings for running perf
+------------------------------------------------
+Some perf features need environment variables to run properly.
+You need to set these before running perf on the target:
+  adb shell
+  # PERF_PAGER=cat
+
+IV. Run perf
+------------------------------------------------
+Run perf on your device/emulator to which you previously connected using adb:
+  # ./data/perf
-- 
1.7.9.2.358.g22243


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

* Re: [GIT PULL 00/25] perf/core improvements and fixes
  2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (24 preceding siblings ...)
  2012-10-08 22:32 ` [PATCH 25/25] Documentation: add documentation on compiling " Arnaldo Carvalho de Melo
@ 2012-10-09 13:34 ` Ingo Molnar
  25 siblings, 0 replies; 38+ messages in thread
From: Ingo Molnar @ 2012-10-09 13:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Andi Kleen,
	Bernhard Rosenkraenzer, Corey Ashford, David Ahern, Dong Hao,
	Frederic Weisbecker, Irina Tirdea, Jiri Olsa, Mike Galbraith,
	Namhyung Kim, Namhyung Kim, Paul Mackerras, Pekka Enberg,
	Peter Zijlstra, Stephane Eranian, Steven Rostedt, Wei Yongjun,
	Xiao Guangrong, arnaldo.melo


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

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit 139c0815903de1a7865fe1d6beac5e995fefdf46:
> 
>   perf hists: Add more helpers for hist entry stat (2012-10-04 13:36:18 -0300)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo
> 
> for you to fetch changes up to 7747e2f4fb5fb840994613dd1474c17cddb7836b:
> 
>   Documentation: add documentation on compiling for Android (2012-10-08 17:44:39 -0300)
> 
> ----------------------------------------------------------------
> 
> perf/core improvements and fixes
> 
> . Handle PERF_RECORD_EXIT events in sched and annotate.
> 
> . struct machine refactorings to help in top and trace.
> 
> . Add on_exit implementation for systems without one, e.g. Android, from
>   Bernhard Rosenkraenzer.
> 
> . Only process events for vcpus of interest, helps handling large number
>   of events, from David Ahern.
> 
> . Cross compiling fixes for Android, from Irina Tirdea.
> 
> . Add documentation on compiling for Android, from Irina Tirdea.
> 
> . perf diff improvements from Jiri Olsa.
> 
> . Target (task/user/cpu/syswide) handling improvements, from Namhyung Kim.
> 
> . Add support in 'trace' for tracing workload given by command line, from
>   Namhyung Kim.
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> 
> Arnaldo Carvalho de Melo (6):
>       perf tools: Have the page size value available for all tools
>       perf machine: Introduce find_thread method
>       perf event: No need to create a thread when handling PERF_RECORD_EXIT
>       perf annotate: Handle PERF_RECORD_EXIT events
>       perf sched: Handle PERF_RECORD_EXIT events
>       perf machine: Carve up event processing specific from perf_tool
> 
> Bernhard Rosenkraenzer (1):
>       perf tools: Add on_exit implementation
> 
> David Ahern (4):
>       perf kvm: Only process events for vcpus of interest
>       perf kvm: Remove typecast in init_kvm_event_record
>       perf kvm: Total count is a u64, print as so
>       perf kvm: Add braces around multi-line statements
> 
> Irina Tirdea (2):
>       perf tools: Update Makefile for Android
>       Documentation: add documentation on compiling for Android
> 
> Jiri Olsa (8):
>       perf diff: Add -b option for perf diff to display paired entries only
>       perf diff: Add ratio computation way to compare hist entries
>       perf diff: Add option to sort entries based on diff computation
>       perf diff: Add weighted diff computation way to compare hist entries
>       perf diff: Add -p option to display period values for hist entries
>       perf diff: Add -F option to display formula for computation
>       perf diff: Include samples without symbol in overall stats
>       perf diff: Display empty space for non paired samples
> 
> Namhyung Kim (3):
>       perf trace: Validate target task/user/cpu argument
>       perf trace: Explicitly enable system-wide mode if no option is given
>       perf trace: Add support for tracing workload given by command line
> 
> Wei Yongjun (1):
>       perf tools: Remove duplicated include from trace-event-python.c
> 
>  tools/perf/Documentation/android.txt               |   75 ++++
>  tools/perf/Documentation/perf-diff.txt             |   60 +++
>  tools/perf/Makefile                                |   33 +-
>  tools/perf/builtin-annotate.c                      |    3 +-
>  tools/perf/builtin-diff.c                          |  405 +++++++++++++++++++-
>  tools/perf/builtin-inject.c                        |    6 +-
>  tools/perf/builtin-kvm.c                           |   35 +-
>  tools/perf/builtin-record.c                        |   32 ++
>  tools/perf/builtin-report.c                        |    4 +-
>  tools/perf/builtin-sched.c                         |    3 +-
>  tools/perf/builtin-script.c                        |    4 +-
>  tools/perf/builtin-test.c                          |    2 -
>  tools/perf/builtin-top.c                           |    3 +-
>  tools/perf/builtin-trace.c                         |   53 ++-
>  tools/perf/config/feature-tests.mak                |   20 +-
>  tools/perf/perf.c                                  |    2 +
>  tools/perf/ui/hist.c                               |  134 ++++++-
>  tools/perf/ui/stdio/hist.c                         |    2 +-
>  tools/perf/util/build-id.c                         |    2 +-
>  tools/perf/util/event.c                            |  215 +----------
>  tools/perf/util/event.h                            |    6 +-
>  tools/perf/util/evlist.c                           |    3 -
>  tools/perf/util/hist.h                             |    8 +
>  tools/perf/util/machine.c                          |  277 +++++++++++++
>  tools/perf/util/machine.h                          |   19 +
>  .../util/scripting-engines/trace-event-python.c    |    1 -
>  tools/perf/util/session.c                          |    4 +-
>  tools/perf/util/sort.h                             |   18 +
>  tools/perf/util/thread.c                           |   41 +-
>  tools/perf/util/thread.h                           |    2 +
>  tools/perf/util/trace-event-read.c                 |    2 -
>  tools/perf/util/util.c                             |    2 +
>  tools/perf/util/util.h                             |    2 +
>  33 files changed, 1173 insertions(+), 305 deletions(-)
>  create mode 100644 tools/perf/Documentation/android.txt
>  create mode 100644 tools/perf/util/machine.c
>  create mode 100644 tools/perf/util/machine.h

Pulled, thanks Arnaldo!

	Ingo

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

* Re: [GIT PULL 00/25] perf/core improvements and fixes
  2017-06-21 18:02 Arnaldo Carvalho de Melo
@ 2017-06-21 18:13 ` Ingo Molnar
  0 siblings, 0 replies; 38+ messages in thread
From: Ingo Molnar @ 2017-06-21 18:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Andi Kleen, David Ahern, Jiri Olsa,
	Kan Liang, linuxppc-dev, Milian Wolff, Namhyung Kim,
	Naveen N . Rao, Paolo Bonzini, Peter Zijlstra, Ravi Bangoria,
	Robert Elliott, Stephane Eranian, Thomas Gleixner, Wang Nan,
	Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit 007b811b4041989ec2dc91b9614aa2c41332723e:
> 
>   Merge tag 'perf-core-for-mingo-4.13-20170719' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-06-20 10:49:08 +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-4.13-20170621
> 
> for you to fetch changes up to 701516ae3dec801084bc913d21e03fce15c61a0b:
> 
>   perf script: Fix message because field list option is -F not -f (2017-06-21 11:35:53 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements ad fixes:
> 
> New features:
> 
> - Add support to measure SMI cost in 'perf stat' (Kan Liang)
> 
> - Add support for unwinding callchains in powerpc with libdw (Paolo Bonzini)
> 
> Fixes:
> 
> - Fix message: cpu list option is -C not -c (Adrian Hunter)
> 
> - Fix 'perf script' message: field list option is -F not -f (Adrian Hunter)
> 
> - Intel PT fixes: (Adrian Hunter)
> 
>   o Fix missing stack clear
>   o Ensure IP is zero when state is INTEL_PT_STATE_NO_IP
>   o Fix last_ip usage
>   o Ensure never to set 'last_ip' when packet 'count' is zero
>   o Clear FUP flag on error
>   o Fix transactions_sample_type
> 
> Infrastructure:
> 
> - Intel PT cleanups/refactorings (Adrian Hunter)
> 
>   o Use FUP always when scanning for an IP
>   o Add missing __fallthrough
>   o Remove redundant initial_skip checks
>   o Allow decoding with branch tracing disabled
>   o Add default config for pass-through branch enable
>   o Add documentation for new config terms
>   o Add decoder support for ptwrite and power event packets
>   o Add reserved byte to CBR packet payload
>   o Add decoder support for CBR events
> 
> - Move  find_process() to the only place that uses it, skimming some
>   more fat from util.[ch] (Arnaldo Carvalho de Melo)
> 
> - Do parameter validation earlier on fetch_kernel_version() (Arnaldo Carvalho de Melo)
> 
> - Remove unused _ALL_SOURCE define (Arnaldo Carvalho de Melo)
> 
> - Add sysfs__write_int function (Kan Liang)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (19):
>       perf intel-pt: Move decoder error setting into one condition
>       perf intel-pt: Improve sample timestamp
>       perf intel-pt: Fix missing stack clear
>       perf intel-pt: Ensure IP is zero when state is INTEL_PT_STATE_NO_IP
>       perf intel-pt: Fix last_ip usage
>       perf intel-pt: Ensure never to set 'last_ip' when packet 'count' is zero
>       perf intel-pt: Use FUP always when scanning for an IP
>       perf intel-pt: Clear FUP flag on error
>       perf intel-pt: Add missing __fallthrough
>       perf intel-pt: Allow decoding with branch tracing disabled
>       perf intel-pt: Add default config for pass-through branch enable
>       perf intel-pt: Add documentation for new config terms
>       perf intel-pt: Add decoder support for ptwrite and power event packets
>       perf intel-pt: Add reserved byte to CBR packet payload
>       perf intel-pt: Add decoder support for CBR events
>       perf intel-pt: Remove redundant initial_skip checks
>       perf intel-pt: Fix transactions_sample_type
>       perf tools: Fix message because cpu list option is -C not -c
>       perf script: Fix message because field list option is -F not -f
> 
> Arnaldo Carvalho de Melo (3):
>       perf evsel: Adopt find_process()
>       perf tools: Do parameter validation earlier on fetch_kernel_version()
>       perf tools: Remove unused _ALL_SOURCE define
> 
> Kan Liang (2):
>       tools lib api fs: Add sysfs__write_int function
>       perf stat: Add support to measure SMI cost
> 
> Paolo Bonzini (1):
>       perf unwind: Support for powerpc
> 
>  tools/lib/api/fs/fs.c                              |  30 +++
>  tools/lib/api/fs/fs.h                              |   4 +
>  tools/perf/Documentation/intel-pt.txt              |  36 +++
>  tools/perf/Documentation/perf-stat.txt             |  14 +
>  tools/perf/Makefile.config                         |   2 +-
>  tools/perf/arch/powerpc/util/Build                 |   2 +
>  tools/perf/arch/powerpc/util/unwind-libdw.c        |  73 ++++++
>  tools/perf/arch/x86/util/intel-pt.c                |   5 +
>  tools/perf/builtin-script.c                        |   2 +-
>  tools/perf/builtin-stat.c                          |  49 ++++
>  tools/perf/util/evsel.c                            |  39 +++
>  .../perf/util/intel-pt-decoder/intel-pt-decoder.c  | 290 +++++++++++++++++++--
>  .../perf/util/intel-pt-decoder/intel-pt-decoder.h  |  13 +
>  .../util/intel-pt-decoder/intel-pt-pkt-decoder.c   | 110 +++++++-
>  .../util/intel-pt-decoder/intel-pt-pkt-decoder.h   |   7 +
>  tools/perf/util/intel-pt.c                         |  23 +-
>  tools/perf/util/session.c                          |   2 +-
>  tools/perf/util/stat-shadow.c                      |  33 +++
>  tools/perf/util/stat.c                             |   2 +
>  tools/perf/util/stat.h                             |   2 +
>  tools/perf/util/util.c                             |  52 +---
>  tools/perf/util/util.h                             |   3 -
>  22 files changed, 710 insertions(+), 83 deletions(-)
>  create mode 100644 tools/perf/arch/powerpc/util/unwind-libdw.c

Pulled, thanks a lot Arnaldo!

	Ingo

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

* [GIT PULL 00/25] perf/core improvements and fixes
@ 2017-06-21 18:02 Arnaldo Carvalho de Melo
  2017-06-21 18:13 ` Ingo Molnar
  0 siblings, 1 reply; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-21 18:02 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Andi Kleen, David Ahern, Jiri Olsa, Kan Liang, linuxppc-dev,
	Milian Wolff, Namhyung Kim, Naveen N . Rao, Paolo Bonzini,
	Peter Zijlstra, Ravi Bangoria, Robert Elliott, Stephane Eranian,
	Thomas Gleixner, Wang Nan, 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 007b811b4041989ec2dc91b9614aa2c41332723e:

  Merge tag 'perf-core-for-mingo-4.13-20170719' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-06-20 10:49:08 +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-4.13-20170621

for you to fetch changes up to 701516ae3dec801084bc913d21e03fce15c61a0b:

  perf script: Fix message because field list option is -F not -f (2017-06-21 11:35:53 -0300)

----------------------------------------------------------------
perf/core improvements ad fixes:

New features:

- Add support to measure SMI cost in 'perf stat' (Kan Liang)

- Add support for unwinding callchains in powerpc with libdw (Paolo Bonzini)

Fixes:

- Fix message: cpu list option is -C not -c (Adrian Hunter)

- Fix 'perf script' message: field list option is -F not -f (Adrian Hunter)

- Intel PT fixes: (Adrian Hunter)

  o Fix missing stack clear
  o Ensure IP is zero when state is INTEL_PT_STATE_NO_IP
  o Fix last_ip usage
  o Ensure never to set 'last_ip' when packet 'count' is zero
  o Clear FUP flag on error
  o Fix transactions_sample_type

Infrastructure:

- Intel PT cleanups/refactorings (Adrian Hunter)

  o Use FUP always when scanning for an IP
  o Add missing __fallthrough
  o Remove redundant initial_skip checks
  o Allow decoding with branch tracing disabled
  o Add default config for pass-through branch enable
  o Add documentation for new config terms
  o Add decoder support for ptwrite and power event packets
  o Add reserved byte to CBR packet payload
  o Add decoder support for CBR events

- Move  find_process() to the only place that uses it, skimming some
  more fat from util.[ch] (Arnaldo Carvalho de Melo)

- Do parameter validation earlier on fetch_kernel_version() (Arnaldo Carvalho de Melo)

- Remove unused _ALL_SOURCE define (Arnaldo Carvalho de Melo)

- Add sysfs__write_int function (Kan Liang)

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

----------------------------------------------------------------
Adrian Hunter (19):
      perf intel-pt: Move decoder error setting into one condition
      perf intel-pt: Improve sample timestamp
      perf intel-pt: Fix missing stack clear
      perf intel-pt: Ensure IP is zero when state is INTEL_PT_STATE_NO_IP
      perf intel-pt: Fix last_ip usage
      perf intel-pt: Ensure never to set 'last_ip' when packet 'count' is zero
      perf intel-pt: Use FUP always when scanning for an IP
      perf intel-pt: Clear FUP flag on error
      perf intel-pt: Add missing __fallthrough
      perf intel-pt: Allow decoding with branch tracing disabled
      perf intel-pt: Add default config for pass-through branch enable
      perf intel-pt: Add documentation for new config terms
      perf intel-pt: Add decoder support for ptwrite and power event packets
      perf intel-pt: Add reserved byte to CBR packet payload
      perf intel-pt: Add decoder support for CBR events
      perf intel-pt: Remove redundant initial_skip checks
      perf intel-pt: Fix transactions_sample_type
      perf tools: Fix message because cpu list option is -C not -c
      perf script: Fix message because field list option is -F not -f

Arnaldo Carvalho de Melo (3):
      perf evsel: Adopt find_process()
      perf tools: Do parameter validation earlier on fetch_kernel_version()
      perf tools: Remove unused _ALL_SOURCE define

Kan Liang (2):
      tools lib api fs: Add sysfs__write_int function
      perf stat: Add support to measure SMI cost

Paolo Bonzini (1):
      perf unwind: Support for powerpc

 tools/lib/api/fs/fs.c                              |  30 +++
 tools/lib/api/fs/fs.h                              |   4 +
 tools/perf/Documentation/intel-pt.txt              |  36 +++
 tools/perf/Documentation/perf-stat.txt             |  14 +
 tools/perf/Makefile.config                         |   2 +-
 tools/perf/arch/powerpc/util/Build                 |   2 +
 tools/perf/arch/powerpc/util/unwind-libdw.c        |  73 ++++++
 tools/perf/arch/x86/util/intel-pt.c                |   5 +
 tools/perf/builtin-script.c                        |   2 +-
 tools/perf/builtin-stat.c                          |  49 ++++
 tools/perf/util/evsel.c                            |  39 +++
 .../perf/util/intel-pt-decoder/intel-pt-decoder.c  | 290 +++++++++++++++++++--
 .../perf/util/intel-pt-decoder/intel-pt-decoder.h  |  13 +
 .../util/intel-pt-decoder/intel-pt-pkt-decoder.c   | 110 +++++++-
 .../util/intel-pt-decoder/intel-pt-pkt-decoder.h   |   7 +
 tools/perf/util/intel-pt.c                         |  23 +-
 tools/perf/util/session.c                          |   2 +-
 tools/perf/util/stat-shadow.c                      |  33 +++
 tools/perf/util/stat.c                             |   2 +
 tools/perf/util/stat.h                             |   2 +
 tools/perf/util/util.c                             |  52 +---
 tools/perf/util/util.h                             |   3 -
 22 files changed, 710 insertions(+), 83 deletions(-)
 create mode 100644 tools/perf/arch/powerpc/util/unwind-libdw.c

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_no_slang_O: make NO_SLANG=1
              make_clean_all_O: make clean all
                make_no_gtk2_O: make NO_GTK2=1
             make_no_libperl_O: make NO_LIBPERL=1
            make_no_auxtrace_O: make NO_AUXTRACE=1
                    make_doc_O: make doc
           make_no_libbionic_O: make NO_LIBBIONIC=1
           make_no_backtrace_O: make NO_BACKTRACE=1
              make_no_libelf_O: make NO_LIBELF=1
            make_no_libaudit_O: make NO_LIBAUDIT=1
             make_no_libnuma_O: make NO_LIBNUMA=1
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
       make_util_pmu_bison_o_O: make util/pmu-bison.o
            make_no_demangle_O: make NO_DEMANGLE=1
             make_util_map_o_O: make util/map.o
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
         make_with_clangllvm_O: make LIBCLANGLLVM=1
           make_no_libunwind_O: make NO_LIBUNWIND=1
           make_no_libpython_O: make NO_LIBPYTHON=1
                 make_perf_o_O: make perf.o
                   make_tags_O: make tags
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
            make_install_bin_O: make install-bin
                  make_debug_O: make DEBUG=1
              make_no_libbpf_O: make NO_LIBBPF=1
        make_with_babeltrace_O: make LIBBABELTRACE=1
                   make_pure_O: make
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
         make_install_prefix_O: make install prefix=/tmp/krava
                make_install_O: make install
                   make_help_O: make help
                 make_static_O: make LDFLAGS=-static
                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_newt_O: make NO_NEWT=1
  OK
  make: Leaving directory '/home/acme/git/linux/tools/perf'
  $ 

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

* Re: [GIT PULL 00/25] perf/core improvements and fixes
  2015-05-27 15:38 Arnaldo Carvalho de Melo
@ 2015-05-27 16:43 ` Ingo Molnar
  0 siblings, 0 replies; 38+ messages in thread
From: Ingo Molnar @ 2015-05-27 16:43 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Borislav Petkov, David Ahern,
	Don Zickus, Frederic Weisbecker, Jiri Olsa, Josef Bacik,
	kernel-team, Luigi Semenzato, Martin Liska, Masami Hiramatsu,
	Namhyung Kim, Nam T . Nguyen, Paul Mackerras, Peter Zijlstra,
	Richard Weinberger, Simon Que, Stephane Eranian,
	Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Now with the intel PT patches removed except for one, for a problem I
> found when trying it on a machine without that feature and that Adrian improved
> things to make it clear it wasn't available.
> 
> 	Ah two patches from Masami, for perf probe, were added.
> 
> 	Please consider applying,
> 
> Regards,
> 
> - Arnaldo
> 
> The following changes since commit a82d24edfeaf1ed244cf8b969916840c6feb5165:
> 
>   perf/x86/intel/pt: Remove redundant variable declaration (2015-05-27 09:17:48 +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 dddc7ee32fa13efc66afa71ebd83bce545c8392a:
> 
>   perf probe: Fix an error when deleting probes successfully (2015-05-27 12:21:46 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> New features:
> 
> - Add option in 'perf sched' to merge like comms to lat output (Josef Bacik)
> 
> - Improve 'perf probe' error messages when not finding a
>   suitable vmlinux (Masami Hiramatsu)
> 
> Infrastructure:
> 
> - Use atomic.h for various pre-existing reference counts (Arnaldo Carvalho de Melo)
> 
> - Leg work for refcounting 'struct map' (Arnaldo Carvalho de Melo)
> 
> - Assign default value for some pointers (Martin Liška)
> 
> - Improve setting of gcc debug option (Martin Liška)
> 
> - Separate the tests and tools in installation (Nam T. Nguyen)
> 
> - Reduce number of arguments of hist_entry_iter__add() (Namhyung Kim)
> 
> - DSO data cache fixes (Namhyung Kim)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (5):
>       perf tools: Fix function declarations needed by parse-events.y
>       perf tools: Fix parse_events_error dereferences
>       perf build: Fix libunwind feature detection on 32-bit x86
>       perf session: Fix perf_session__peek_event()
>       perf tools: Disallow PMU events intel_pt and intel_bts until there is support
> 
> Arnaldo Carvalho de Melo (10):
>       perf hists: Rename add_hist_entry to hists__findnew_entry
>       perf comm: Use atomic.h for refcounting
>       perf machine: Do not call map_groups__delete(), drop refcnt instead
>       perf tools: Rename maps__next
>       perf tools: Remove redundant initialization of thread linkage members
>       perf tools: Nuke unused map_groups__flush()
>       perf tools: Import rb_erase_init from block/ in the kernel sources
>       perf machine: Mark removed threads as such
>       perf tools: Leave DSO destruction to the map destruction
>       perf tools: Use maps__first()/map__next()
> 
> Josef Bacik (1):
>       perf sched: Add option to merge like comms to lat output
> 
> Martin Liska (1):
>       perf tools: Improve setting of gcc debug option
> 
> Martin Liška (1):
>       perf tools: Assign default value for some pointers
> 
> Masami Hiramatsu (2):
>       perf probe: Show the error reason comes from invalid DSO
>       perf probe: Fix an error when deleting probes successfully
> 
> Nam T. Nguyen (1):
>       perf tools: Separate the tests and tools in installation
> 
> Namhyung Kim (4):
>       perf hists: Reducing arguments of hist_entry_iter__add()
>       perf tools: Fix dso__data_read_offset() file opening
>       perf tools: Get rid of dso__data_fd() from dso__data_size()
>       perf tools: Add dso__data_get/put_fd()
> 
>  tools/perf/Makefile.perf               |  6 ++-
>  tools/perf/arch/common.c               |  2 +-
>  tools/perf/builtin-report.c            |  9 ++--
>  tools/perf/builtin-sched.c             | 77 +++++++++++++++++++++++++++--
>  tools/perf/builtin-top.c               |  7 +--
>  tools/perf/config/Makefile             |  4 +-
>  tools/perf/config/utilities.mak        | 19 ++++++++
>  tools/perf/tests/dso-data.c            | 11 +++++
>  tools/perf/tests/hists_cumulate.c      |  6 ++-
>  tools/perf/tests/hists_filter.c        |  4 +-
>  tools/perf/tests/hists_output.c        |  6 ++-
>  tools/perf/tests/vmlinux-kallsyms.c    | 34 ++++++-------
>  tools/perf/util/comm.c                 | 13 +++--
>  tools/perf/util/dso.c                  | 88 +++++++++++++++++++---------------
>  tools/perf/util/dso.h                  | 13 +++--
>  tools/perf/util/event.c                |  7 ++-
>  tools/perf/util/hist.c                 | 24 ++++------
>  tools/perf/util/hist.h                 |  1 -
>  tools/perf/util/include/linux/rbtree.h | 14 ++++++
>  tools/perf/util/machine.c              |  6 +--
>  tools/perf/util/map.c                  | 31 ++----------
>  tools/perf/util/map.h                  |  6 +--
>  tools/perf/util/parse-events.c         | 18 +++----
>  tools/perf/util/parse-events.h         |  6 +++
>  tools/perf/util/parse-events.y         |  6 ++-
>  tools/perf/util/pmu.c                  |  4 ++
>  tools/perf/util/probe-event.c          | 65 +++++++++++++------------
>  tools/perf/util/probe-event.h          |  3 --
>  tools/perf/util/session.c              |  6 +--
>  tools/perf/util/symbol.c               | 25 +++++-----
>  tools/perf/util/thread.c               |  2 -
>  tools/perf/util/trace-event-parse.c    |  2 +-
>  tools/perf/util/unwind-libunwind.c     | 11 +++--
>  33 files changed, 332 insertions(+), 204 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

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

* [GIT PULL 00/25] perf/core improvements and fixes
@ 2015-05-27 15:38 Arnaldo Carvalho de Melo
  2015-05-27 16:43 ` Ingo Molnar
  0 siblings, 1 reply; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-27 15:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, David Ahern, Don Zickus, Frederic Weisbecker,
	Jiri Olsa, Josef Bacik, kernel-team, Luigi Semenzato,
	Martin Liska, Masami Hiramatsu, Namhyung Kim, Nam T . Nguyen,
	Paul Mackerras, Peter Zijlstra, Richard Weinberger, Simon Que,
	Stephane Eranian, Arnaldo Carvalho de Melo

Hi Ingo,

	Now with the intel PT patches removed except for one, for a problem I
found when trying it on a machine without that feature and that Adrian improved
things to make it clear it wasn't available.

	Ah two patches from Masami, for perf probe, were added.

	Please consider applying,

Regards,

- Arnaldo

The following changes since commit a82d24edfeaf1ed244cf8b969916840c6feb5165:

  perf/x86/intel/pt: Remove redundant variable declaration (2015-05-27 09:17:48 +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 dddc7ee32fa13efc66afa71ebd83bce545c8392a:

  perf probe: Fix an error when deleting probes successfully (2015-05-27 12:21:46 -0300)

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

New features:

- Add option in 'perf sched' to merge like comms to lat output (Josef Bacik)

- Improve 'perf probe' error messages when not finding a
  suitable vmlinux (Masami Hiramatsu)

Infrastructure:

- Use atomic.h for various pre-existing reference counts (Arnaldo Carvalho de Melo)

- Leg work for refcounting 'struct map' (Arnaldo Carvalho de Melo)

- Assign default value for some pointers (Martin Liška)

- Improve setting of gcc debug option (Martin Liška)

- Separate the tests and tools in installation (Nam T. Nguyen)

- Reduce number of arguments of hist_entry_iter__add() (Namhyung Kim)

- DSO data cache fixes (Namhyung Kim)

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

----------------------------------------------------------------
Adrian Hunter (5):
      perf tools: Fix function declarations needed by parse-events.y
      perf tools: Fix parse_events_error dereferences
      perf build: Fix libunwind feature detection on 32-bit x86
      perf session: Fix perf_session__peek_event()
      perf tools: Disallow PMU events intel_pt and intel_bts until there is support

Arnaldo Carvalho de Melo (10):
      perf hists: Rename add_hist_entry to hists__findnew_entry
      perf comm: Use atomic.h for refcounting
      perf machine: Do not call map_groups__delete(), drop refcnt instead
      perf tools: Rename maps__next
      perf tools: Remove redundant initialization of thread linkage members
      perf tools: Nuke unused map_groups__flush()
      perf tools: Import rb_erase_init from block/ in the kernel sources
      perf machine: Mark removed threads as such
      perf tools: Leave DSO destruction to the map destruction
      perf tools: Use maps__first()/map__next()

Josef Bacik (1):
      perf sched: Add option to merge like comms to lat output

Martin Liska (1):
      perf tools: Improve setting of gcc debug option

Martin Liška (1):
      perf tools: Assign default value for some pointers

Masami Hiramatsu (2):
      perf probe: Show the error reason comes from invalid DSO
      perf probe: Fix an error when deleting probes successfully

Nam T. Nguyen (1):
      perf tools: Separate the tests and tools in installation

Namhyung Kim (4):
      perf hists: Reducing arguments of hist_entry_iter__add()
      perf tools: Fix dso__data_read_offset() file opening
      perf tools: Get rid of dso__data_fd() from dso__data_size()
      perf tools: Add dso__data_get/put_fd()

 tools/perf/Makefile.perf               |  6 ++-
 tools/perf/arch/common.c               |  2 +-
 tools/perf/builtin-report.c            |  9 ++--
 tools/perf/builtin-sched.c             | 77 +++++++++++++++++++++++++++--
 tools/perf/builtin-top.c               |  7 +--
 tools/perf/config/Makefile             |  4 +-
 tools/perf/config/utilities.mak        | 19 ++++++++
 tools/perf/tests/dso-data.c            | 11 +++++
 tools/perf/tests/hists_cumulate.c      |  6 ++-
 tools/perf/tests/hists_filter.c        |  4 +-
 tools/perf/tests/hists_output.c        |  6 ++-
 tools/perf/tests/vmlinux-kallsyms.c    | 34 ++++++-------
 tools/perf/util/comm.c                 | 13 +++--
 tools/perf/util/dso.c                  | 88 +++++++++++++++++++---------------
 tools/perf/util/dso.h                  | 13 +++--
 tools/perf/util/event.c                |  7 ++-
 tools/perf/util/hist.c                 | 24 ++++------
 tools/perf/util/hist.h                 |  1 -
 tools/perf/util/include/linux/rbtree.h | 14 ++++++
 tools/perf/util/machine.c              |  6 +--
 tools/perf/util/map.c                  | 31 ++----------
 tools/perf/util/map.h                  |  6 +--
 tools/perf/util/parse-events.c         | 18 +++----
 tools/perf/util/parse-events.h         |  6 +++
 tools/perf/util/parse-events.y         |  6 ++-
 tools/perf/util/pmu.c                  |  4 ++
 tools/perf/util/probe-event.c          | 65 +++++++++++++------------
 tools/perf/util/probe-event.h          |  3 --
 tools/perf/util/session.c              |  6 +--
 tools/perf/util/symbol.c               | 25 +++++-----
 tools/perf/util/thread.c               |  2 -
 tools/perf/util/trace-event-parse.c    |  2 +-
 tools/perf/util/unwind-libunwind.c     | 11 +++--
 33 files changed, 332 insertions(+), 204 deletions(-)

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

* Re: [GIT PULL 00/25] perf/core improvements and fixes
  2015-05-05 21:31 Arnaldo Carvalho de Melo
@ 2015-05-06  2:47 ` Ingo Molnar
  0 siblings, 0 replies; 38+ messages in thread
From: Ingo Molnar @ 2015-05-06  2:47 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, David Ahern, Frederic Weisbecker,
	Jiri Olsa, Joonsoo Kim, linux-mm, Masami Hiramatsu, Minchan Kim,
	Namhyung Kim, Pekka Enberg, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Please consider applying, on top of previous requests,
> 
> - Arnaldo
> 
> The following changes since commit 0c160d495b5616e071bb4f873812e8f473128149:
> 
>   perf kmem: Add kmem.default config option (2015-05-04 13:34:48 -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-3
> 
> for you to fetch changes up to 3698dab1c849c7e1cd440df4fca24baa1973d53b:
> 
>   perf tools: Move TUI-specific fields out of map_symbol (2015-05-05 18:13:24 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Improve --filter support for 'perf probe', allowing using its arguments
>   on other commands, as --add, --del, etc (Masami Hiramatsu)
> 
> - Show warning when running 'perf kmem stat' on a unsuitable perf.data file,
>   i.e. one with events that are not the ones required for the stat variant
>   used (Namhyung Kim).
> 
> Infrastructure:
> 
> - Auxtrace support patches, paving the way to support Intel PT and BTS (Adrian Hunter)
> 
> - hists browser (top, report) refactorings (Namhyung Kim)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (9):
>       perf report: Fix placement of itrace option in documentation
>       perf tools: Add AUX area tracing index
>       perf tools: Hit all build ids when AUX area tracing
>       perf tools: Add build option NO_AUXTRACE to exclude AUX area tracing
>       perf auxtrace: Add option to synthesize events for transactions
>       perf tools: Add support for PERF_RECORD_AUX
>       perf tools: Add support for PERF_RECORD_ITRACE_START
>       perf tools: Add AUX area tracing Snapshot Mode
>       perf record: Add AUX area tracing Snapshot Mode support
> 
> Masami Hiramatsu (4):
>       perf probe: Allow to use filter on --del command
>       perf probe: Accept filter argument for --funcs
>       perf probe: Remove redundant cleanup of params.filter
>       perf probe: Cleanup and consolidate command parsers
> 
> Namhyung Kim (12):
>       perf kmem: Show warning when trying to run stat without record
>       perf tools: Move TUI-specific fields into unnamed union
>       perf tools: Move init_have_children field to the unnamed union
>       perf hists browser: Fix possible memory leak
>       perf hists browser: Save hist_browser_timer pointer in hist_browser
>       perf hists browser: Save pstack in the hist_browser
>       perf hists browser: Save perf_session_env in the hist_browser
>       perf hists browser: Split popup menu actions
>       perf hists browser: Split popup menu actions - part 2
>       perf tools: Introduce pstack_peek()
>       perf hists browser: Simplify zooming code using pstack_peek()
>       perf tools: Move TUI-specific fields out of map_symbol
> 
>  tools/perf/Documentation/perf-inject.txt |   9 +-
>  tools/perf/Documentation/perf-probe.txt  |   3 +-
>  tools/perf/Documentation/perf-record.txt |   7 +
>  tools/perf/Documentation/perf-report.txt |  15 +-
>  tools/perf/Documentation/perf-script.txt |   9 +-
>  tools/perf/Makefile.perf                 |   2 +
>  tools/perf/builtin-buildid-list.c        |   9 +
>  tools/perf/builtin-inject.c              |  78 +++-
>  tools/perf/builtin-kmem.c                |  17 +-
>  tools/perf/builtin-probe.c               | 133 +++----
>  tools/perf/builtin-record.c              | 172 ++++++++-
>  tools/perf/config/Makefile               |   5 +
>  tools/perf/perf.h                        |   3 +
>  tools/perf/tests/make                    |   4 +-
>  tools/perf/ui/browsers/hists.c           | 633 +++++++++++++++++++------------
>  tools/perf/util/Build                    |   2 +-
>  tools/perf/util/auxtrace.c               | 305 ++++++++++++++-
>  tools/perf/util/auxtrace.h               | 217 +++++++++++
>  tools/perf/util/callchain.h              |   4 +
>  tools/perf/util/event.c                  |  39 ++
>  tools/perf/util/event.h                  |  24 ++
>  tools/perf/util/header.c                 |  31 +-
>  tools/perf/util/hist.c                   |   2 +-
>  tools/perf/util/machine.c                |  21 +
>  tools/perf/util/machine.h                |   4 +
>  tools/perf/util/parse-options.h          |   4 +
>  tools/perf/util/probe-event.c            | 102 ++---
>  tools/perf/util/probe-event.h            |   2 +-
>  tools/perf/util/pstack.c                 |   7 +
>  tools/perf/util/pstack.h                 |   1 +
>  tools/perf/util/session.c                |  32 ++
>  tools/perf/util/session.h                |   1 +
>  tools/perf/util/sort.h                   |  22 +-
>  tools/perf/util/symbol.h                 |   2 -
>  tools/perf/util/tool.h                   |   2 +
>  35 files changed, 1455 insertions(+), 468 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

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

* [GIT PULL 00/25] perf/core improvements and fixes
@ 2015-05-05 21:31 Arnaldo Carvalho de Melo
  2015-05-06  2:47 ` Ingo Molnar
  0 siblings, 1 reply; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-05 21:31 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Frederic Weisbecker, Jiri Olsa, Joonsoo Kim,
	linux-mm, Masami Hiramatsu, Minchan Kim, Namhyung Kim,
	Pekka Enberg, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider applying, on top of previous requests,

- Arnaldo

The following changes since commit 0c160d495b5616e071bb4f873812e8f473128149:

  perf kmem: Add kmem.default config option (2015-05-04 13:34:48 -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-3

for you to fetch changes up to 3698dab1c849c7e1cd440df4fca24baa1973d53b:

  perf tools: Move TUI-specific fields out of map_symbol (2015-05-05 18:13:24 -0300)

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

User visible:

- Improve --filter support for 'perf probe', allowing using its arguments
  on other commands, as --add, --del, etc (Masami Hiramatsu)

- Show warning when running 'perf kmem stat' on a unsuitable perf.data file,
  i.e. one with events that are not the ones required for the stat variant
  used (Namhyung Kim).

Infrastructure:

- Auxtrace support patches, paving the way to support Intel PT and BTS (Adrian Hunter)

- hists browser (top, report) refactorings (Namhyung Kim)

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

----------------------------------------------------------------
Adrian Hunter (9):
      perf report: Fix placement of itrace option in documentation
      perf tools: Add AUX area tracing index
      perf tools: Hit all build ids when AUX area tracing
      perf tools: Add build option NO_AUXTRACE to exclude AUX area tracing
      perf auxtrace: Add option to synthesize events for transactions
      perf tools: Add support for PERF_RECORD_AUX
      perf tools: Add support for PERF_RECORD_ITRACE_START
      perf tools: Add AUX area tracing Snapshot Mode
      perf record: Add AUX area tracing Snapshot Mode support

Masami Hiramatsu (4):
      perf probe: Allow to use filter on --del command
      perf probe: Accept filter argument for --funcs
      perf probe: Remove redundant cleanup of params.filter
      perf probe: Cleanup and consolidate command parsers

Namhyung Kim (12):
      perf kmem: Show warning when trying to run stat without record
      perf tools: Move TUI-specific fields into unnamed union
      perf tools: Move init_have_children field to the unnamed union
      perf hists browser: Fix possible memory leak
      perf hists browser: Save hist_browser_timer pointer in hist_browser
      perf hists browser: Save pstack in the hist_browser
      perf hists browser: Save perf_session_env in the hist_browser
      perf hists browser: Split popup menu actions
      perf hists browser: Split popup menu actions - part 2
      perf tools: Introduce pstack_peek()
      perf hists browser: Simplify zooming code using pstack_peek()
      perf tools: Move TUI-specific fields out of map_symbol

 tools/perf/Documentation/perf-inject.txt |   9 +-
 tools/perf/Documentation/perf-probe.txt  |   3 +-
 tools/perf/Documentation/perf-record.txt |   7 +
 tools/perf/Documentation/perf-report.txt |  15 +-
 tools/perf/Documentation/perf-script.txt |   9 +-
 tools/perf/Makefile.perf                 |   2 +
 tools/perf/builtin-buildid-list.c        |   9 +
 tools/perf/builtin-inject.c              |  78 +++-
 tools/perf/builtin-kmem.c                |  17 +-
 tools/perf/builtin-probe.c               | 133 +++----
 tools/perf/builtin-record.c              | 172 ++++++++-
 tools/perf/config/Makefile               |   5 +
 tools/perf/perf.h                        |   3 +
 tools/perf/tests/make                    |   4 +-
 tools/perf/ui/browsers/hists.c           | 633 +++++++++++++++++++------------
 tools/perf/util/Build                    |   2 +-
 tools/perf/util/auxtrace.c               | 305 ++++++++++++++-
 tools/perf/util/auxtrace.h               | 217 +++++++++++
 tools/perf/util/callchain.h              |   4 +
 tools/perf/util/event.c                  |  39 ++
 tools/perf/util/event.h                  |  24 ++
 tools/perf/util/header.c                 |  31 +-
 tools/perf/util/hist.c                   |   2 +-
 tools/perf/util/machine.c                |  21 +
 tools/perf/util/machine.h                |   4 +
 tools/perf/util/parse-options.h          |   4 +
 tools/perf/util/probe-event.c            | 102 ++---
 tools/perf/util/probe-event.h            |   2 +-
 tools/perf/util/pstack.c                 |   7 +
 tools/perf/util/pstack.h                 |   1 +
 tools/perf/util/session.c                |  32 ++
 tools/perf/util/session.h                |   1 +
 tools/perf/util/sort.h                   |  22 +-
 tools/perf/util/symbol.h                 |   2 -
 tools/perf/util/tool.h                   |   2 +
 35 files changed, 1455 insertions(+), 468 deletions(-)

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

* Re: [GIT PULL 00/25] perf/core improvements and fixes
  2015-03-24 16:19 Arnaldo Carvalho de Melo
@ 2015-03-24 16:26 ` Ingo Molnar
  0 siblings, 0 replies; 38+ messages in thread
From: Ingo Molnar @ 2015-03-24 16:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Andrew Morton, Borislav Petkov,
	Corey Ashford, David Ahern, Don Zickus, Frederic Weisbecker,
	He Kuang, Javi Merino, Jiri Olsa, Joonsoo Kim, Josef Bacik,
	Masami Hiramatsu, Minchan Kim, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Shawn Bohrer, Stephane Eranian, Steven Rostedt,
	Vinson Lee, Wang Nan, Yann Droneaud, 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 963a70b8a2d65538f7d58b2b84a2ae10a3ecb6ea:
> 
>   Merge tag 'perf-core-for-mingo-2' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-03-22 10:56:19 +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
> 
> for you to fetch changes up to e03eaa400cf8b8bded86cc5c41018a1c69152f16:
> 
>   perf tools: Add pid/tid filtering to report and script commands (2015-03-24 13:02:46 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Improve support of compressed kernel modules (Jiri Olsa)
> 
> - Add --kallsyms option to 'perf diff' (David Ahern)
> 
> - Add pid/tid filtering to 'report' and 'script' commands (David Ahern)
> 
> - Add support for __print_array() in libtraceevent (Javi Merino)
> 
> - Save DSO loading errno to better report errors (Arnaldo Carvalho de Melo)
> 
> - Fix 'probe' to get ummapped symbol address on kernel (Masami Hiramatsu)
> 
> - Print big numbers using thousands' group in 'kmem' (Namhyung Kim)
> 
> - Remove (null) value of "Sort order" for perf mem report (Yunlong Song)
> 
> Infrastructure:
> 
> - Handle NULL comm name in libtracevent (Josef Bacik)
> 
> - Libtraceevent synchronization with trace-cmd repo (Steven Rostedt)
> 
> - Work around lack of sched_getcpu in glibc < 2.6. (Vinson Lee)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (2):
>       perf target: Simplify handling of strerror_r return
>       perf symbols: Save DSO loading errno to better report errors
> 
> David Ahern (2):
>       perf diff: Add kallsyms option
>       perf tools: Add pid/tid filtering to report and script commands
> 
> Javi Merino (2):
>       tools lib traceevent: Factor out allocating and processing args
>       tools lib traceevent: Add support for __print_array()
> 
> Jiri Olsa (7):
>       perf tools: Use kmod_path__parse in map_groups__set_modules_path_dir
>       perf tools: Use kmod_path__parse in decompress_kmodule
>       perf tools: Use kmod_path__parse in is_kernel_module
>       perf tools: Remove compressed argument from is_kernel_module
>       perf tools: Remove is_kmodule_extension function
>       perf tools: Try to lookup kernel module map before creating one
>       perf annotate: Allow annotation for decompressed kernel modules
> 
> Josef Bacik (1):
>       tools lib traceevent: Handle NULL comm name
> 
> Masami Hiramatsu (1):
>       perf probe: Fix to get ummapped symbol address on kernel
> 
> Namhyung Kim (1):
>       perf kmem: Print big numbers using thousands' group
> 
> Steven Rostedt (1):
>       tools lib traceevent: Make plugin options either string or boolean
> 
> Steven Rostedt (Red Hat) (6):
>       tools lib traceevent: Copy trace_clock and free it
>       tools lib traceevent: Handle %z in bprint format
>       tools lib traceevent: Add pevent_data_pid_from_comm()
>       tools lib traceevent kbuffer: Remove extra update to data pointer in PADDING
>       tools lib traceevent: Add way to find sub buffer boundary
>       tools lib traceevent: Free filter tokens in process_filter()
> 
> Vinson Lee (1):
>       perf tools: Work around lack of sched_getcpu in glibc < 2.6.
> 
> Yunlong Song (1):
>       perf tools: Remove (null) value of "Sort order" for perf mem report
> 
>  tools/lib/traceevent/event-parse.c                 | 267 ++++++++++++++++++---
>  tools/lib/traceevent/event-parse.h                 |  21 +-
>  tools/lib/traceevent/event-plugin.c                |  60 ++++-
>  tools/lib/traceevent/kbuffer-parse.c               |  12 +-
>  tools/lib/traceevent/kbuffer.h                     |   1 +
>  tools/lib/traceevent/parse-filter.c                |   2 +
>  tools/perf/Documentation/perf-diff.txt             |   3 +
>  tools/perf/Documentation/perf-report.txt           |   5 +
>  tools/perf/Documentation/perf-script.txt           |   6 +
>  tools/perf/builtin-diff.c                          |   2 +
>  tools/perf/builtin-kmem.c                          |  11 +-
>  tools/perf/builtin-report.c                        |   6 +-
>  tools/perf/builtin-script.c                        |   4 +
>  tools/perf/builtin-top.c                           |   6 +-
>  tools/perf/util/annotate.c                         |  32 ++-
>  tools/perf/util/cloexec.c                          |   6 +
>  tools/perf/util/cloexec.h                          |   6 +
>  tools/perf/util/dso.c                              |  61 +++--
>  tools/perf/util/dso.h                              |  31 ++-
>  tools/perf/util/header.c                           |   2 +-
>  tools/perf/util/machine.c                          |  72 ++++--
>  tools/perf/util/probe-event.c                      |   5 +-
>  .../perf/util/scripting-engines/trace-event-perl.c |   5 +
>  .../util/scripting-engines/trace-event-python.c    |   5 +
>  tools/perf/util/sort.h                             |   1 +
>  tools/perf/util/symbol-elf.c                       |  57 +++--
>  tools/perf/util/symbol-minimal.c                   |   7 +-
>  tools/perf/util/symbol.c                           |  31 ++-
>  tools/perf/util/symbol.h                           |   7 +
>  tools/perf/util/target.c                           |   7 +-
>  tools/perf/util/thread.h                           |  11 +
>  31 files changed, 621 insertions(+), 131 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

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

* [GIT PULL 00/25] perf/core improvements and fixes
@ 2015-03-24 16:19 Arnaldo Carvalho de Melo
  2015-03-24 16:26 ` Ingo Molnar
  0 siblings, 1 reply; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-24 16:19 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Andrew Morton, Borislav Petkov, Corey Ashford, David Ahern,
	Don Zickus, Frederic Weisbecker, He Kuang, Javi Merino,
	Jiri Olsa, Joonsoo Kim, Josef Bacik, Masami Hiramatsu,
	Minchan Kim, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Shawn Bohrer, Stephane Eranian, Steven Rostedt, Vinson Lee,
	Wang Nan, Yann Droneaud, Yunlong Song, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling.

- Arnaldo

The following changes since commit 963a70b8a2d65538f7d58b2b84a2ae10a3ecb6ea:

  Merge tag 'perf-core-for-mingo-2' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-03-22 10:56:19 +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

for you to fetch changes up to e03eaa400cf8b8bded86cc5c41018a1c69152f16:

  perf tools: Add pid/tid filtering to report and script commands (2015-03-24 13:02:46 -0300)

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

User visible:

- Improve support of compressed kernel modules (Jiri Olsa)

- Add --kallsyms option to 'perf diff' (David Ahern)

- Add pid/tid filtering to 'report' and 'script' commands (David Ahern)

- Add support for __print_array() in libtraceevent (Javi Merino)

- Save DSO loading errno to better report errors (Arnaldo Carvalho de Melo)

- Fix 'probe' to get ummapped symbol address on kernel (Masami Hiramatsu)

- Print big numbers using thousands' group in 'kmem' (Namhyung Kim)

- Remove (null) value of "Sort order" for perf mem report (Yunlong Song)

Infrastructure:

- Handle NULL comm name in libtracevent (Josef Bacik)

- Libtraceevent synchronization with trace-cmd repo (Steven Rostedt)

- Work around lack of sched_getcpu in glibc < 2.6. (Vinson Lee)

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

----------------------------------------------------------------
Arnaldo Carvalho de Melo (2):
      perf target: Simplify handling of strerror_r return
      perf symbols: Save DSO loading errno to better report errors

David Ahern (2):
      perf diff: Add kallsyms option
      perf tools: Add pid/tid filtering to report and script commands

Javi Merino (2):
      tools lib traceevent: Factor out allocating and processing args
      tools lib traceevent: Add support for __print_array()

Jiri Olsa (7):
      perf tools: Use kmod_path__parse in map_groups__set_modules_path_dir
      perf tools: Use kmod_path__parse in decompress_kmodule
      perf tools: Use kmod_path__parse in is_kernel_module
      perf tools: Remove compressed argument from is_kernel_module
      perf tools: Remove is_kmodule_extension function
      perf tools: Try to lookup kernel module map before creating one
      perf annotate: Allow annotation for decompressed kernel modules

Josef Bacik (1):
      tools lib traceevent: Handle NULL comm name

Masami Hiramatsu (1):
      perf probe: Fix to get ummapped symbol address on kernel

Namhyung Kim (1):
      perf kmem: Print big numbers using thousands' group

Steven Rostedt (1):
      tools lib traceevent: Make plugin options either string or boolean

Steven Rostedt (Red Hat) (6):
      tools lib traceevent: Copy trace_clock and free it
      tools lib traceevent: Handle %z in bprint format
      tools lib traceevent: Add pevent_data_pid_from_comm()
      tools lib traceevent kbuffer: Remove extra update to data pointer in PADDING
      tools lib traceevent: Add way to find sub buffer boundary
      tools lib traceevent: Free filter tokens in process_filter()

Vinson Lee (1):
      perf tools: Work around lack of sched_getcpu in glibc < 2.6.

Yunlong Song (1):
      perf tools: Remove (null) value of "Sort order" for perf mem report

 tools/lib/traceevent/event-parse.c                 | 267 ++++++++++++++++++---
 tools/lib/traceevent/event-parse.h                 |  21 +-
 tools/lib/traceevent/event-plugin.c                |  60 ++++-
 tools/lib/traceevent/kbuffer-parse.c               |  12 +-
 tools/lib/traceevent/kbuffer.h                     |   1 +
 tools/lib/traceevent/parse-filter.c                |   2 +
 tools/perf/Documentation/perf-diff.txt             |   3 +
 tools/perf/Documentation/perf-report.txt           |   5 +
 tools/perf/Documentation/perf-script.txt           |   6 +
 tools/perf/builtin-diff.c                          |   2 +
 tools/perf/builtin-kmem.c                          |  11 +-
 tools/perf/builtin-report.c                        |   6 +-
 tools/perf/builtin-script.c                        |   4 +
 tools/perf/builtin-top.c                           |   6 +-
 tools/perf/util/annotate.c                         |  32 ++-
 tools/perf/util/cloexec.c                          |   6 +
 tools/perf/util/cloexec.h                          |   6 +
 tools/perf/util/dso.c                              |  61 +++--
 tools/perf/util/dso.h                              |  31 ++-
 tools/perf/util/header.c                           |   2 +-
 tools/perf/util/machine.c                          |  72 ++++--
 tools/perf/util/probe-event.c                      |   5 +-
 .../perf/util/scripting-engines/trace-event-perl.c |   5 +
 .../util/scripting-engines/trace-event-python.c    |   5 +
 tools/perf/util/sort.h                             |   1 +
 tools/perf/util/symbol-elf.c                       |  57 +++--
 tools/perf/util/symbol-minimal.c                   |   7 +-
 tools/perf/util/symbol.c                           |  31 ++-
 tools/perf/util/symbol.h                           |   7 +
 tools/perf/util/target.c                           |   7 +-
 tools/perf/util/thread.h                           |  11 +
 31 files changed, 621 insertions(+), 131 deletions(-)

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

* [GIT PULL 00/25] perf/core improvements and fixes
@ 2013-11-25 14:17 Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-11-25 14:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
	Namhyung Kim, Paul Mackerras, Pekka Enberg, Peter Zijlstra,
	Ramkumar Ramachandra, Stanislav Fomichev, Stephane Eranian,
	Steven Rostedt, Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>

Hi Ingo,

	Please consider pulling,

	This is based on top of a recent tip/perf/urgent.

- Arnaldo

The following changes since commit e98a6e59dff885eb387163b1a7abe019a44ba90b:

  Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2013-11-20 14:29:46 +0100)

are available in the git repository at:


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

for you to fetch changes up to 33d7da61e10ad7d43c60d4a5f4adb712361e5131:

  perf script: Print callchains and symbols if they exist (2013-11-22 15:47:41 -0300)

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

. Make per-cpu mmaps the default in 'perf record', from Adrian Hunter.

. Default -t/--thread 'perf record' option to no inheritance,
  from Adrian Hunter.

. Make 'perf top -g' refer to callchains, for consistency with other tools,
  from David Ahern.

. Skip ignored symbols while printing callchain, from David Ahern.

. Print callchains and symbols if they exist in 'perf script',
  from David Ahern.

. Remove thread summary coloring in 'perf trace', from Pekka Enberg.

. zsh completion support, from Ramkumar Ramachandra.

. 'perf timechart' improvements, including backtrace support,
  from Stanislav Fomichev.

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

----------------------------------------------------------------
Adrian Hunter (4):
      perf record: Make per-cpu mmaps the default.
      perf tools: Allow '--inherit' as the negation of '--no-inherit'
      perf tools: Add option macro OPT_BOOLEAN_SET
      perf record: Default -t option to no inheritance

David Ahern (6):
      perf top: Make -g refer to callchains
      perf evsel: Skip ignored symbols while printing callchain
      perf symbols: Move idle syms check from top to generic function
      perf thread: Move comm_list check into function
      perf tools: Export setup_list
      perf script: Print callchains and symbols if they exist

Namhyung Kim (1):
      perf script: Move evname print code to process_event()

Pekka Enberg (1):
      perf trace: Remove thread summary coloring

Ramkumar Ramachandra (5):
      perf completion: Introduce a layer of indirection
      perf completion: Factor out compgen stuff
      perf completion: Factor out call to __ltrim_colon_completions
      perf completion: Introduce zsh support
      perf completion: Rename file to reflect zsh support

Stanislav Fomichev (7):
      perf timechart: Always try to print at least 15 tasks
      perf timechart: Add option to limit number of tasks
      perf timechart: Use proc_num to implement --power-only
      perf timechart: Add support for displaying only tasks related data
      perf timechart: Group figures and add title with details
      perf timechart: Add support for -P and -T in timechart recording
      perf timechart: Add backtrace support

Steven Rostedt (1):
      tools lib traceevent: Use helper trace-seq in print functions like kernel does

 tools/lib/traceevent/event-parse.c                 |   7 +-
 tools/perf/Documentation/perf-record.txt           |  12 +-
 tools/perf/Documentation/perf-timechart.txt        |  26 +-
 tools/perf/Documentation/perf-top.txt              |   5 +-
 tools/perf/Makefile.perf                           |   4 +-
 tools/perf/builtin-record.c                        |  13 +-
 tools/perf/builtin-script.c                        |  35 ++-
 tools/perf/builtin-timechart.c                     | 306 +++++++++++++++++----
 tools/perf/builtin-top.c                           |  29 +-
 tools/perf/builtin-trace.c                         |  13 +-
 tools/perf/{bash_completion => perf-completion.sh} | 100 ++++++-
 tools/perf/perf.h                                  |   1 +
 tools/perf/tests/attr/test-record-no-inherit       |   2 +-
 tools/perf/util/event.c                            |   3 +-
 tools/perf/util/evlist.c                           |   6 +-
 tools/perf/util/evsel.c                            |   5 +-
 tools/perf/util/parse-options.c                    |  21 ++
 tools/perf/util/parse-options.h                    |   8 +
 tools/perf/util/session.c                          |  10 +-
 tools/perf/util/svghelper.c                        |  77 +++++-
 tools/perf/util/svghelper.h                        |  11 +-
 tools/perf/util/symbol.c                           |  32 ++-
 tools/perf/util/symbol.h                           |   4 +
 tools/perf/util/target.c                           |  11 +-
 tools/perf/util/target.h                           |   4 +-
 tools/perf/util/thread.h                           |  12 +
 26 files changed, 603 insertions(+), 154 deletions(-)
 rename tools/perf/{bash_completion => perf-completion.sh} (65%)

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

* Re: [GIT PULL 00/25] perf/core improvements and fixes
  2013-01-31 17:25 Arnaldo Carvalho de Melo
@ 2013-02-01 10:18 ` Ingo Molnar
  0 siblings, 0 replies; 38+ messages in thread
From: Ingo Molnar @ 2013-02-01 10:18 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Andi Kleen, Anton Blanchard, David Ahern,
	Frederic Weisbecker, Jiri Olsa, linuxppc-dev, Mike Galbraith,
	Namhyung Kim, Namhyung Kim, Paul Mackerras, Pekka Enberg,
	Peter Zijlstra, Robert Richter, Stephane Eranian,
	Sukadev Bhattiprolu, acme, Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit 152fefa921535665f95840c08062844ab2f5593e:
> 
>   Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2013-01-31 10:20:14 +0100)
> 
> are available in the git repository at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo
> 
> for you to fetch changes up to 2ac3634a7e1c8eedc961030c87c5c36ebd5bbf8e:
> 
>   perf: Document the ABI of perf sysfs entries (2013-01-31 13:07:51 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> . Make some POWER7 events available in sysfs, equivalent to
>   what was done on x86, from Sukadev Bhattiprolu.
> 
> . Add event group view, from Namyung Kim:
> 
>   To use it, 'perf record' should group events when recording. And then perf
>   report parses the saved group relation from file header and prints them
>   together if --group option is provided.  You can use 'perf evlist' command to
>   see event group information:
> 
>     $ perf record -e '{ref-cycles,cycles}' noploop 1
>     [ perf record: Woken up 2 times to write data ]
>     [ perf record: Captured and wrote 0.385 MB perf.data (~16807 samples) ]
> 
>     $ perf evlist --group
>     {ref-cycles,cycles}
> 
>   With this example, default perf report will show you each event
>   separately like this:
> 
>     $ perf report
>     ...
>     # group: {ref-cycles,cycles}
>     # ========
>     # Samples: 3K of event 'ref-cycles'
>     # Event count (approx.): 3153797218
>     #
>     # Overhead  Command      Shared Object                      Symbol
>     # ........  .......  .................  ..........................
>         99.84%  noploop  noploop            [.] main
>          0.07%  noploop  ld-2.15.so         [.] strcmp
>          0.03%  noploop  [kernel.kallsyms]  [k] timerqueue_del
>          0.03%  noploop  [kernel.kallsyms]  [k] sched_clock_cpu
>          0.02%  noploop  [kernel.kallsyms]  [k] account_user_time
>          0.01%  noploop  [kernel.kallsyms]  [k] __alloc_pages_nodemask
>          0.00%  noploop  [kernel.kallsyms]  [k] native_write_msr_safe
> 
>     # Samples: 3K of event 'cycles'
>     # Event count (approx.): 3722310525
>     #
>     # Overhead  Command      Shared Object                     Symbol
>     # ........  .......  .................  .........................
>         99.76%  noploop  noploop            [.] main
>          0.11%  noploop  [kernel.kallsyms]  [k] _raw_spin_lock
>          0.06%  noploop  [kernel.kallsyms]  [k] find_get_page
>          0.03%  noploop  [kernel.kallsyms]  [k] sched_clock_cpu
>          0.02%  noploop  [kernel.kallsyms]  [k] rcu_check_callbacks
>          0.02%  noploop  [kernel.kallsyms]  [k] __current_kernel_time
>          0.00%  noploop  [kernel.kallsyms]  [k] native_write_msr_safe
> 
>   In this case the event group information will be shown in the end of
>   header area.  So you can use --group option to enable event group view.
> 
>     $ perf report --group
>     ...
>     # group: {ref-cycles,cycles}
>     # ========
>     # Samples: 7K of event 'anon group { ref-cycles, cycles }'
>     # Event count (approx.): 6876107743
>     #
>     #         Overhead  Command      Shared Object                      Symbol
>     # ................  .......  .................  ..........................
>         99.84%  99.76%  noploop  noploop            [.] main
>          0.07%   0.00%  noploop  ld-2.15.so         [.] strcmp
>          0.03%   0.00%  noploop  [kernel.kallsyms]  [k] timerqueue_del
>          0.03%   0.03%  noploop  [kernel.kallsyms]  [k] sched_clock_cpu
>          0.02%   0.00%  noploop  [kernel.kallsyms]  [k] account_user_time
>          0.01%   0.00%  noploop  [kernel.kallsyms]  [k] __alloc_pages_nodemask
>          0.00%   0.00%  noploop  [kernel.kallsyms]  [k] native_write_msr_safe
>          0.00%   0.11%  noploop  [kernel.kallsyms]  [k] _raw_spin_lock
>          0.00%   0.06%  noploop  [kernel.kallsyms]  [k] find_get_page
>          0.00%   0.02%  noploop  [kernel.kallsyms]  [k] rcu_check_callbacks
>          0.00%   0.02%  noploop  [kernel.kallsyms]  [k] __current_kernel_time
> 
>   As you can see the Overhead column now contains both of ref-cycles and
>   cycles and header line shows group information also - 'anon group {
>   ref-cycles, cycles }'.  The output is sorted by period of group leader
>   first.
> 
>   If perf.data file doesn't contain group information, this --group
>   option does nothing.  So if you want enable event group view by
>   default you can set it in ~/.perfconfig file:
> 
>     $ cat ~/.perfconfig
>     [report]
>     group = true
> 
>   It can be overridden with command line if you want:
> 
>     $ perf report --no-group
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (2):
>       perf top: Stop using exit()
>       perf top: Delete maps on exit
> 
> Namhyung Kim (18):
>       perf tools: Keep group information
>       perf tests: Add group test conditions
>       perf header: Add HEADER_GROUP_DESC feature
>       perf report: Make another loop for linking group hists
>       perf hists: Resort hist entries using group members for output
>       perf ui/hist: Consolidate hpp helpers
>       perf hists browser: Convert hpp helpers to a function
>       perf gtk/browser: Convert hpp helpers to a function
>       perf ui/hist: Add support for event group view
>       perf hists browser: Move coloring logic to hpp functions
>       perf hists browser: Add suppport for event group view
>       perf gtk/browser: Add support for event group view
>       perf gtk/browser: Trim column header string when event group enabled
>       perf report: Bypass non-leader events when event group is enabled
>       perf report: Show group description when event group is enabled
>       perf report: Add --group option
>       perf report: Add report.group config option
>       perf evlist: Add --group option
> 
> Sukadev Bhattiprolu (5):
>       perf/Power7: Use macros to identify perf events
>       perf: Make EVENT_ATTR global
>       perf/POWER7: Make generic event translations available in sysfs
>       perf/POWER7: Make some POWER7 events available in sysfs
>       perf: Document the ABI of perf sysfs entries
> 
>  .../testing/sysfs-bus-event_source-devices-events  |  62 +++++
>  arch/powerpc/include/asm/perf_event_server.h       |  26 ++
>  arch/powerpc/perf/core-book3s.c                    |  12 +
>  arch/powerpc/perf/power7-pmu.c                     |  80 +++++-
>  arch/x86/kernel/cpu/perf_event.c                   |  13 +-
>  include/linux/perf_event.h                         |  11 +
>  tools/perf/Documentation/perf-evlist.txt           |   4 +
>  tools/perf/Documentation/perf-report.txt           |   3 +
>  tools/perf/builtin-evlist.c                        |   7 +
>  tools/perf/builtin-record.c                        |   3 +
>  tools/perf/builtin-report.c                        |  47 +++-
>  tools/perf/builtin-top.c                           |  62 +++--
>  tools/perf/tests/parse-events.c                    |  28 ++
>  tools/perf/ui/browsers/hists.c                     | 217 ++++++++++++---
>  tools/perf/ui/gtk/hists.c                          | 130 +++++++--
>  tools/perf/ui/hist.c                               | 306 ++++++++++-----------
>  tools/perf/ui/stdio/hist.c                         |   2 +
>  tools/perf/util/evlist.c                           |   7 +-
>  tools/perf/util/evlist.h                           |   1 +
>  tools/perf/util/evsel.c                            |  49 +++-
>  tools/perf/util/evsel.h                            |  16 ++
>  tools/perf/util/header.c                           | 164 +++++++++++
>  tools/perf/util/header.h                           |   2 +
>  tools/perf/util/hist.c                             |  59 +++-
>  tools/perf/util/parse-events.c                     |   1 +
>  tools/perf/util/parse-events.h                     |   1 +
>  tools/perf/util/parse-events.y                     |  10 +
>  tools/perf/util/symbol.h                           |   3 +-
>  28 files changed, 1059 insertions(+), 267 deletions(-)
>  create mode 100644 Documentation/ABI/testing/sysfs-bus-event_source-devices-events

Pulled, thanks a lot Arnaldo!

	Ingo

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

* [GIT PULL 00/25] perf/core improvements and fixes
@ 2013-01-31 17:25 Arnaldo Carvalho de Melo
  2013-02-01 10:18 ` Ingo Molnar
  0 siblings, 1 reply; 38+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-01-31 17:25 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Andi Kleen,
	Anton Blanchard, David Ahern, Frederic Weisbecker, Jiri Olsa,
	linuxppc-dev, Mike Galbraith, Namhyung Kim, Namhyung Kim,
	Paul Mackerras, Pekka Enberg, Peter Zijlstra, Robert Richter,
	Stephane Eranian, Sukadev Bhattiprolu, acme,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit 152fefa921535665f95840c08062844ab2f5593e:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2013-01-31 10:20:14 +0100)

are available in the git repository at:


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

for you to fetch changes up to 2ac3634a7e1c8eedc961030c87c5c36ebd5bbf8e:

  perf: Document the ABI of perf sysfs entries (2013-01-31 13:07:51 -0300)

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

. Make some POWER7 events available in sysfs, equivalent to
  what was done on x86, from Sukadev Bhattiprolu.

. Add event group view, from Namyung Kim:

  To use it, 'perf record' should group events when recording. And then perf
  report parses the saved group relation from file header and prints them
  together if --group option is provided.  You can use 'perf evlist' command to
  see event group information:

    $ perf record -e '{ref-cycles,cycles}' noploop 1
    [ perf record: Woken up 2 times to write data ]
    [ perf record: Captured and wrote 0.385 MB perf.data (~16807 samples) ]

    $ perf evlist --group
    {ref-cycles,cycles}

  With this example, default perf report will show you each event
  separately like this:

    $ perf report
    ...
    # group: {ref-cycles,cycles}
    # ========
    # Samples: 3K of event 'ref-cycles'
    # Event count (approx.): 3153797218
    #
    # Overhead  Command      Shared Object                      Symbol
    # ........  .......  .................  ..........................
        99.84%  noploop  noploop            [.] main
         0.07%  noploop  ld-2.15.so         [.] strcmp
         0.03%  noploop  [kernel.kallsyms]  [k] timerqueue_del
         0.03%  noploop  [kernel.kallsyms]  [k] sched_clock_cpu
         0.02%  noploop  [kernel.kallsyms]  [k] account_user_time
         0.01%  noploop  [kernel.kallsyms]  [k] __alloc_pages_nodemask
         0.00%  noploop  [kernel.kallsyms]  [k] native_write_msr_safe

    # Samples: 3K of event 'cycles'
    # Event count (approx.): 3722310525
    #
    # Overhead  Command      Shared Object                     Symbol
    # ........  .......  .................  .........................
        99.76%  noploop  noploop            [.] main
         0.11%  noploop  [kernel.kallsyms]  [k] _raw_spin_lock
         0.06%  noploop  [kernel.kallsyms]  [k] find_get_page
         0.03%  noploop  [kernel.kallsyms]  [k] sched_clock_cpu
         0.02%  noploop  [kernel.kallsyms]  [k] rcu_check_callbacks
         0.02%  noploop  [kernel.kallsyms]  [k] __current_kernel_time
         0.00%  noploop  [kernel.kallsyms]  [k] native_write_msr_safe

  In this case the event group information will be shown in the end of
  header area.  So you can use --group option to enable event group view.

    $ perf report --group
    ...
    # group: {ref-cycles,cycles}
    # ========
    # Samples: 7K of event 'anon group { ref-cycles, cycles }'
    # Event count (approx.): 6876107743
    #
    #         Overhead  Command      Shared Object                      Symbol
    # ................  .......  .................  ..........................
        99.84%  99.76%  noploop  noploop            [.] main
         0.07%   0.00%  noploop  ld-2.15.so         [.] strcmp
         0.03%   0.00%  noploop  [kernel.kallsyms]  [k] timerqueue_del
         0.03%   0.03%  noploop  [kernel.kallsyms]  [k] sched_clock_cpu
         0.02%   0.00%  noploop  [kernel.kallsyms]  [k] account_user_time
         0.01%   0.00%  noploop  [kernel.kallsyms]  [k] __alloc_pages_nodemask
         0.00%   0.00%  noploop  [kernel.kallsyms]  [k] native_write_msr_safe
         0.00%   0.11%  noploop  [kernel.kallsyms]  [k] _raw_spin_lock
         0.00%   0.06%  noploop  [kernel.kallsyms]  [k] find_get_page
         0.00%   0.02%  noploop  [kernel.kallsyms]  [k] rcu_check_callbacks
         0.00%   0.02%  noploop  [kernel.kallsyms]  [k] __current_kernel_time

  As you can see the Overhead column now contains both of ref-cycles and
  cycles and header line shows group information also - 'anon group {
  ref-cycles, cycles }'.  The output is sorted by period of group leader
  first.

  If perf.data file doesn't contain group information, this --group
  option does nothing.  So if you want enable event group view by
  default you can set it in ~/.perfconfig file:

    $ cat ~/.perfconfig
    [report]
    group = true

  It can be overridden with command line if you want:

    $ perf report --no-group

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

----------------------------------------------------------------
Arnaldo Carvalho de Melo (2):
      perf top: Stop using exit()
      perf top: Delete maps on exit

Namhyung Kim (18):
      perf tools: Keep group information
      perf tests: Add group test conditions
      perf header: Add HEADER_GROUP_DESC feature
      perf report: Make another loop for linking group hists
      perf hists: Resort hist entries using group members for output
      perf ui/hist: Consolidate hpp helpers
      perf hists browser: Convert hpp helpers to a function
      perf gtk/browser: Convert hpp helpers to a function
      perf ui/hist: Add support for event group view
      perf hists browser: Move coloring logic to hpp functions
      perf hists browser: Add suppport for event group view
      perf gtk/browser: Add support for event group view
      perf gtk/browser: Trim column header string when event group enabled
      perf report: Bypass non-leader events when event group is enabled
      perf report: Show group description when event group is enabled
      perf report: Add --group option
      perf report: Add report.group config option
      perf evlist: Add --group option

Sukadev Bhattiprolu (5):
      perf/Power7: Use macros to identify perf events
      perf: Make EVENT_ATTR global
      perf/POWER7: Make generic event translations available in sysfs
      perf/POWER7: Make some POWER7 events available in sysfs
      perf: Document the ABI of perf sysfs entries

 .../testing/sysfs-bus-event_source-devices-events  |  62 +++++
 arch/powerpc/include/asm/perf_event_server.h       |  26 ++
 arch/powerpc/perf/core-book3s.c                    |  12 +
 arch/powerpc/perf/power7-pmu.c                     |  80 +++++-
 arch/x86/kernel/cpu/perf_event.c                   |  13 +-
 include/linux/perf_event.h                         |  11 +
 tools/perf/Documentation/perf-evlist.txt           |   4 +
 tools/perf/Documentation/perf-report.txt           |   3 +
 tools/perf/builtin-evlist.c                        |   7 +
 tools/perf/builtin-record.c                        |   3 +
 tools/perf/builtin-report.c                        |  47 +++-
 tools/perf/builtin-top.c                           |  62 +++--
 tools/perf/tests/parse-events.c                    |  28 ++
 tools/perf/ui/browsers/hists.c                     | 217 ++++++++++++---
 tools/perf/ui/gtk/hists.c                          | 130 +++++++--
 tools/perf/ui/hist.c                               | 306 ++++++++++-----------
 tools/perf/ui/stdio/hist.c                         |   2 +
 tools/perf/util/evlist.c                           |   7 +-
 tools/perf/util/evlist.h                           |   1 +
 tools/perf/util/evsel.c                            |  49 +++-
 tools/perf/util/evsel.h                            |  16 ++
 tools/perf/util/header.c                           | 164 +++++++++++
 tools/perf/util/header.h                           |   2 +
 tools/perf/util/hist.c                             |  59 +++-
 tools/perf/util/parse-events.c                     |   1 +
 tools/perf/util/parse-events.h                     |   1 +
 tools/perf/util/parse-events.y                     |  10 +
 tools/perf/util/symbol.h                           |   3 +-
 28 files changed, 1059 insertions(+), 267 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-event_source-devices-events

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

end of thread, other threads:[~2017-06-21 18:13 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-08 22:32 [GIT PULL 00/25] perf/core improvements and fixes Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 01/25] perf trace: Validate target task/user/cpu argument Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 02/25] perf trace: Explicitly enable system-wide mode if no option is given Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 03/25] perf trace: Add support for tracing workload given by command line Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 04/25] perf diff: Add -b option for perf diff to display paired entries only Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 05/25] perf diff: Add ratio computation way to compare hist entries Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 06/25] perf diff: Add option to sort entries based on diff computation Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 07/25] perf diff: Add weighted diff computation way to compare hist entries Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 08/25] perf diff: Add -p option to display period values for " Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 09/25] perf diff: Add -F option to display formula for computation Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 10/25] perf diff: Include samples without symbol in overall stats Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 11/25] perf diff: Display empty space for non paired samples Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 12/25] perf tools: Have the page size value available for all tools Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 13/25] perf machine: Introduce find_thread method Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 14/25] perf event: No need to create a thread when handling PERF_RECORD_EXIT Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 15/25] perf annotate: Handle PERF_RECORD_EXIT events Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 16/25] perf sched: " Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 17/25] perf machine: Carve up event processing specific from perf_tool Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 18/25] perf tools: Remove duplicated include from trace-event-python.c Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 19/25] perf kvm: Only process events for vcpus of interest Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 20/25] perf kvm: Remove typecast in init_kvm_event_record Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 21/25] perf kvm: Total count is a u64, print as so Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 22/25] perf kvm: Add braces around multi-line statements Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 23/25] perf tools: Add on_exit implementation Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 24/25] perf tools: Update Makefile for Android Arnaldo Carvalho de Melo
2012-10-08 22:32 ` [PATCH 25/25] Documentation: add documentation on compiling " Arnaldo Carvalho de Melo
2012-10-09 13:34 ` [GIT PULL 00/25] perf/core improvements and fixes Ingo Molnar
2013-01-31 17:25 Arnaldo Carvalho de Melo
2013-02-01 10:18 ` Ingo Molnar
2013-11-25 14:17 Arnaldo Carvalho de Melo
2015-03-24 16:19 Arnaldo Carvalho de Melo
2015-03-24 16:26 ` Ingo Molnar
2015-05-05 21:31 Arnaldo Carvalho de Melo
2015-05-06  2:47 ` Ingo Molnar
2015-05-27 15:38 Arnaldo Carvalho de Melo
2015-05-27 16:43 ` Ingo Molnar
2017-06-21 18:02 Arnaldo Carvalho de Melo
2017-06-21 18:13 ` 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).