linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 00/37] perf/core improvements and fixes
@ 2012-12-11 22:47 Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 01/37] perf symbols: Fix dso__fprintf() print statement Arnaldo Carvalho de Melo
                   ` (37 more replies)
  0 siblings, 38 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Andi Kleen, Corey Ashford,
	David Ahern, David S. Miller, Feng Tang, Frank Eigler,
	Frederic Weisbecker, Jiri Olsa, Kushal Das, Mark Wielaard,
	Mike Galbraith, Namhyung Kim, Paul Mackerras, Pekka Enberg,
	Peter Zijlstra, Robert Richter, Stephane Eranian, Steven Rostedt,
	acme, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling.

	Jiri, tomorrow I'll go over the hists patches as I think you're fully
ok with Namhyung latest patchset.

Regards,

- Arnaldo

The following changes since commit cc1b39dbf9f55a438e8a21a694394c20e6a17129:

  Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core (2012-12-08 15:54:35 +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 2376c67a7bbc7849b806688ba2efb8520c21c458:

  perf top: Use perf_evlist__config() (2012-12-11 17:22:39 -0300)

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

. perf build-id cache now can show DSOs present in a perf.data file that are
  not in the cache, to integrate with build-id servers being put in place by
  organizations such as Fedora.

. perf buildid-list -i an-elf-file-instead-of-a-perf.data is back showing its
  build-id.

. No need to do feature checks when doing a 'make tags'

. Fix some 'perf test' errors and make them use the tracepoint evsel constructor.

. perf top now shares more of the evsel config/creation routines with 'record',
  paving the way for further integration like 'top' snapshots, etc.

. perf top now supports DWARF callchains.

. perf evlist decodes sample_type and read_format, helping diagnose problems.

. Fix mmap limitations on 32-bit, fix from David Miller.

. perf diff fixes from Jiri Olsa.

. Ignore ABS symbols when loading data maps, fix from Namhyung Kim

. Hists improvements from Namhyung Kim

. Don't check configuration on make clean, from Namhyung Kim

. Fix dso__fprintf() print statement, from Stephane Eranian.

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

----------------------------------------------------------------
Arnaldo Carvalho de Melo (20):
      perf top: Add missing newline on pr_err call
      perf tools: Don't check configuration on make tags
      perf tools: Fix TUI helpline output
      perf buildid-list: We need to check if a file is ELF first
      perf symbols: Generalize filter in __fprintf_buildid methods
      perf buildid-cache: Add option to show build ids that are missing in the cache
      perf machine: Move more machine methods to machine.c
      perf evsel: Update sample_size when setting sample_type bits
      perf test: Fixup error reporting in basic mmap test
      perf test: Use perf_evsel__newtp constructor in the tracepoint tests
      perf evsel: Introduce method to request IDs be used
      perf evsel: No need to always ask for PERF_FORMAT_ID in read_format
      perf evsel: No need to always ask for PERF_FORMAT_TOTAL_TIME_{ENABLED,RUNNING}
      perf evlist: Set the leader in the perf_evlist__config method
      perf evsel: Adopt fprintf routine from 'perf evlist'
      perf tools: Add install-bin Makefile target
      perf evsel: Decode read_format and sample_type in perf_evsel__fprintf
      perf record: Pass perf_record_opts to the callchain cmdline parsing callback
      perf record: Export the callchain parsing routine and help
      perf top: Use perf_evlist__config()

David Miller (1):
      perf tools: Fix mmap limitations on 32-bit

Jiri Olsa (6):
      perf hists: Introduce perf_hpp__list for period related columns
      perf hists: Fix period symbol_conf.field_sep display
      perf diff: Remove displacement from struct hist_entry_diff
      perf diff: Change compute methods to work with pair directly
      perf diff: Change formula methods to work with pair directly
      perf diff: Remove displacement output option

Namhyung Kim (9):
      perf ui: Always compile error printing code
      perf ui/helpline: Introduce ui_helpline__vshow()
      perf tools: Don't check configuration on make clean
      perf session: Free environment information when deleting session
      perf symbols: Ignore ABS symbols when loading data maps
      perf hists: Fix typo on hist__entry_add_pair
      perf hists: Link hist entry pairs to leader
      perf evsel: Set leader evsel's ->leader to itself
      perf evsel: Convert to _is_group_leader method

Stephane Eranian (1):
      perf symbols: Fix dso__fprintf() print statement

 tools/perf/Documentation/Makefile               |    4 +
 tools/perf/Documentation/perf-buildid-cache.txt |    3 +
 tools/perf/Documentation/perf-diff.txt          |    4 -
 tools/perf/Documentation/perf-top.txt           |    2 +-
 tools/perf/Makefile                             |   51 +-
 tools/perf/builtin-buildid-cache.c              |   48 +-
 tools/perf/builtin-buildid-list.c               |   21 +-
 tools/perf/builtin-diff.c                       |  121 ++--
 tools/perf/builtin-evlist.c                     |   81 +--
 tools/perf/builtin-record.c                     |   40 +-
 tools/perf/builtin-report.c                     |    1 +
 tools/perf/builtin-stat.c                       |    2 +-
 tools/perf/builtin-top.c                        |  207 ++-----
 tools/perf/builtin-trace.c                      |    2 +-
 tools/perf/tests/attr/base-record               |    2 +-
 tools/perf/tests/attr/test-record-group         |    2 +
 tools/perf/tests/attr/test-record-group1        |    2 +
 tools/perf/tests/mmap-basic.c                   |   40 +-
 tools/perf/tests/open-syscall-all-cpus.c        |   18 +-
 tools/perf/tests/open-syscall.c                 |   17 +-
 tools/perf/tests/parse-events.c                 |   20 +-
 tools/perf/tests/perf-record.c                  |    8 +-
 tools/perf/tests/tests.h                        |    3 -
 tools/perf/tests/util.c                         |   30 -
 tools/perf/ui/browsers/hists.c                  |   20 +-
 tools/perf/ui/gtk/browser.c                     |   30 +-
 tools/perf/ui/gtk/helpline.c                    |   23 +-
 tools/perf/ui/helpline.c                        |   12 +
 tools/perf/ui/helpline.h                        |   22 +-
 tools/perf/ui/hist.c                            |  170 +++---
 tools/perf/ui/setup.c                           |    1 +
 tools/perf/ui/stdio/hist.c                      |   17 +-
 tools/perf/ui/tui/helpline.c                    |   29 +-
 tools/perf/ui/util.c                            |   10 +
 tools/perf/util/callchain.h                     |    5 +
 tools/perf/util/debug.c                         |   28 +-
 tools/perf/util/debug.h                         |   33 +-
 tools/perf/util/dso.c                           |    6 +-
 tools/perf/util/dso.h                           |    2 +-
 tools/perf/util/evlist.c                        |   17 +-
 tools/perf/util/evlist.h                        |    4 +-
 tools/perf/util/evsel.c                         |  186 +++++-
 tools/perf/util/evsel.h                         |   25 +-
 tools/perf/util/hist.c                          |    4 +-
 tools/perf/util/hist.h                          |   22 +-
 tools/perf/util/machine.c                       |  742 +++++++++++++++++++++++
 tools/perf/util/machine.h                       |   11 +-
 tools/perf/util/session.c                       |  256 +-------
 tools/perf/util/session.h                       |    5 +-
 tools/perf/util/sort.h                          |    5 +-
 tools/perf/util/symbol-elf.c                    |   11 +
 tools/perf/util/symbol.c                        |  522 +---------------
 tools/perf/util/symbol.h                        |    4 +
 tools/perf/util/thread.c                        |   20 +-
 tools/perf/util/thread.h                        |    1 +
 tools/perf/util/top.c                           |   22 +-
 tools/perf/util/top.h                           |    8 +-
 57 files changed, 1483 insertions(+), 1519 deletions(-)
 delete mode 100644 tools/perf/tests/util.c

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

* [PATCH 01/37] perf symbols: Fix dso__fprintf() print statement
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 02/37] perf ui: Always compile error printing code Arnaldo Carvalho de Melo
                   ` (36 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Stephane Eranian, Ingo Molnar, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Stephane Eranian <eranian@google.com>

Was ignoring the dso type (function vs. variable) and was therefore
printing bogus information.

Signed-off-by: Stephane Eranian <eranian@google.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20121120095101.GA5939@quad
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/dso.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index d6d9a46..be43785 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -583,7 +583,7 @@ size_t dso__fprintf(struct dso *dso, enum map_type type, FILE *fp)
 	if (dso->short_name != dso->long_name)
 		ret += fprintf(fp, "%s, ", dso->long_name);
 	ret += fprintf(fp, "%s, %sloaded, ", map_type__name[type],
-		       dso->loaded ? "" : "NOT ");
+		       dso__loaded(dso, type) ? "" : "NOT ");
 	ret += dso__fprintf_buildid(dso, fp);
 	ret += fprintf(fp, ")\n");
 	for (nd = rb_first(&dso->symbols[type]); nd; nd = rb_next(nd)) {
-- 
1.7.9.2.358.g22243


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

* [PATCH 02/37] perf ui: Always compile error printing code
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 01/37] perf symbols: Fix dso__fprintf() print statement Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 03/37] perf ui/helpline: Introduce ui_helpline__vshow() Arnaldo Carvalho de Melo
                   ` (35 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Andi Kleen, David Ahern,
	Jiri Olsa, Pekka Enberg, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

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

It is used everywhere so always build it regardless of ui engine.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1352911664-24620-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile     |   14 +++++---------
 tools/perf/ui/util.c    |   10 ++++++++++
 tools/perf/util/debug.c |   22 ----------------------
 tools/perf/util/debug.h |   33 ++-------------------------------
 4 files changed, 17 insertions(+), 62 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 891bc77..8fca560 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -378,8 +378,11 @@ LIB_H += util/rblist.h
 LIB_H += util/intlist.h
 LIB_H += util/perf_regs.h
 LIB_H += util/unwind.h
-LIB_H += ui/helpline.h
 LIB_H += util/vdso.h
+LIB_H += ui/helpline.h
+LIB_H += ui/progress.h
+LIB_H += ui/util.h
+LIB_H += ui/ui.h
 
 LIB_OBJS += $(OUTPUT)util/abspath.o
 LIB_OBJS += $(OUTPUT)util/alias.o
@@ -453,6 +456,7 @@ LIB_OBJS += $(OUTPUT)util/stat.o
 LIB_OBJS += $(OUTPUT)ui/setup.o
 LIB_OBJS += $(OUTPUT)ui/helpline.o
 LIB_OBJS += $(OUTPUT)ui/progress.o
+LIB_OBJS += $(OUTPUT)ui/util.o
 LIB_OBJS += $(OUTPUT)ui/hist.o
 LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
 
@@ -646,7 +650,6 @@ ifndef NO_NEWT
 		LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
 		LIB_OBJS += $(OUTPUT)ui/browsers/map.o
 		LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
-		LIB_OBJS += $(OUTPUT)ui/util.o
 		LIB_OBJS += $(OUTPUT)ui/tui/setup.o
 		LIB_OBJS += $(OUTPUT)ui/tui/util.o
 		LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
@@ -655,9 +658,6 @@ ifndef NO_NEWT
 		LIB_H += ui/browsers/map.h
 		LIB_H += ui/keysyms.h
 		LIB_H += ui/libslang.h
-		LIB_H += ui/progress.h
-		LIB_H += ui/util.h
-		LIB_H += ui/ui.h
 	endif
 endif
 
@@ -677,10 +677,6 @@ ifndef NO_GTK2
 		LIB_OBJS += $(OUTPUT)ui/gtk/util.o
 		LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
 		LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
-		# Make sure that it'd be included only once.
-		ifeq ($(findstring -DNEWT_SUPPORT,$(BASIC_CFLAGS)),)
-			LIB_OBJS += $(OUTPUT)ui/util.o
-		endif
 	endif
 endif
 
diff --git a/tools/perf/ui/util.c b/tools/perf/ui/util.c
index 4f98977..3014a7c 100644
--- a/tools/perf/ui/util.c
+++ b/tools/perf/ui/util.c
@@ -52,6 +52,16 @@ int ui__warning(const char *format, ...)
 	return ret;
 }
 
+int ui__error_paranoid(void)
+{
+	return ui__error("Permission error - are you root?\n"
+		    "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n"
+		    " -1 - Not paranoid at all\n"
+		    "  0 - Disallow raw tracepoint access for unpriv\n"
+		    "  1 - Disallow cpu events for unpriv\n"
+		    "  2 - Disallow kernel profiling for unpriv\n");
+}
+
 
 /**
  * perf_error__register - Register error logging functions
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index 03f830b..39861a2a 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -49,28 +49,6 @@ int dump_printf(const char *fmt, ...)
 	return ret;
 }
 
-#if !defined(NEWT_SUPPORT) && !defined(GTK2_SUPPORT)
-int ui__warning(const char *format, ...)
-{
-	va_list args;
-
-	va_start(args, format);
-	vfprintf(stderr, format, args);
-	va_end(args);
-	return 0;
-}
-#endif
-
-int ui__error_paranoid(void)
-{
-	return ui__error("Permission error - are you root?\n"
-		    "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n"
-		    " -1 - Not paranoid at all\n"
-		    "  0 - Disallow raw tracepoint access for unpriv\n"
-		    "  1 - Disallow cpu events for unpriv\n"
-		    "  2 - Disallow kernel profiling for unpriv\n");
-}
-
 void trace_event(union perf_event *event)
 {
 	unsigned char *raw_event = (void *)event;
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index 83e8d23..6e2667f 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -5,6 +5,8 @@
 #include <stdbool.h>
 #include "event.h"
 #include "../ui/helpline.h"
+#include "../ui/progress.h"
+#include "../ui/util.h"
 
 extern int verbose;
 extern bool quiet, dump_trace;
@@ -12,38 +14,7 @@ extern bool quiet, dump_trace;
 int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
 void trace_event(union perf_event *event);
 
-struct ui_progress;
-struct perf_error_ops;
-
-#if defined(NEWT_SUPPORT) || defined(GTK2_SUPPORT)
-
-#include "../ui/progress.h"
 int ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
-#include "../ui/util.h"
-
-#else
-
-static inline void ui_progress__update(u64 curr __maybe_unused,
-				       u64 total __maybe_unused,
-				       const char *title __maybe_unused) {}
-static inline void ui_progress__finish(void) {}
-
-#define ui__error(format, arg...) ui__warning(format, ##arg)
-
-static inline int
-perf_error__register(struct perf_error_ops *eops __maybe_unused)
-{
-	return 0;
-}
-
-static inline int
-perf_error__unregister(struct perf_error_ops *eops __maybe_unused)
-{
-	return 0;
-}
-
-#endif /* NEWT_SUPPORT || GTK2_SUPPORT */
-
 int ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
 int ui__error_paranoid(void);
 
-- 
1.7.9.2.358.g22243


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

* [PATCH 03/37] perf ui/helpline: Introduce ui_helpline__vshow()
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 01/37] perf symbols: Fix dso__fprintf() print statement Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 02/37] perf ui: Always compile error printing code Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 04/37] perf tools: Don't check configuration on make clean Arnaldo Carvalho de Melo
                   ` (34 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Andi Kleen, David Ahern,
	Jiri Olsa, Pekka Enberg, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

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

The ui_helpline__vshow() will be used for pr_* functions.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1352911664-24620-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/gtk/helpline.c |   23 ++++++++++++-----------
 tools/perf/ui/helpline.c     |   12 ++++++++++++
 tools/perf/ui/helpline.h     |   22 ++--------------------
 tools/perf/ui/tui/helpline.c |   29 +++++++++++++++--------------
 tools/perf/util/debug.c      |    6 ++----
 5 files changed, 43 insertions(+), 49 deletions(-)

diff --git a/tools/perf/ui/gtk/helpline.c b/tools/perf/ui/gtk/helpline.c
index 5db4432..3388cbd 100644
--- a/tools/perf/ui/gtk/helpline.c
+++ b/tools/perf/ui/gtk/helpline.c
@@ -24,17 +24,7 @@ static void gtk_helpline_push(const char *msg)
 			   pgctx->statbar_ctx_id, msg);
 }
 
-static struct ui_helpline gtk_helpline_fns = {
-	.pop	= gtk_helpline_pop,
-	.push	= gtk_helpline_push,
-};
-
-void perf_gtk__init_helpline(void)
-{
-	helpline_fns = &gtk_helpline_fns;
-}
-
-int perf_gtk__show_helpline(const char *fmt, va_list ap)
+static int gtk_helpline_show(const char *fmt, va_list ap)
 {
 	int ret;
 	char *ptr;
@@ -54,3 +44,14 @@ int perf_gtk__show_helpline(const char *fmt, va_list ap)
 
 	return ret;
 }
+
+static struct ui_helpline gtk_helpline_fns = {
+	.pop	= gtk_helpline_pop,
+	.push	= gtk_helpline_push,
+	.show	= gtk_helpline_show,
+};
+
+void perf_gtk__init_helpline(void)
+{
+	helpline_fns = &gtk_helpline_fns;
+}
diff --git a/tools/perf/ui/helpline.c b/tools/perf/ui/helpline.c
index a49bcf3..700fb3c 100644
--- a/tools/perf/ui/helpline.c
+++ b/tools/perf/ui/helpline.c
@@ -16,9 +16,16 @@ static void nop_helpline__push(const char *msg __maybe_unused)
 {
 }
 
+static int nop_helpline__show(const char *fmt __maybe_unused,
+			       va_list ap __maybe_unused)
+{
+	return 0;
+}
+
 static struct ui_helpline default_helpline_fns = {
 	.pop	= nop_helpline__pop,
 	.push	= nop_helpline__push,
+	.show	= nop_helpline__show,
 };
 
 struct ui_helpline *helpline_fns = &default_helpline_fns;
@@ -59,3 +66,8 @@ void ui_helpline__puts(const char *msg)
 	ui_helpline__pop();
 	ui_helpline__push(msg);
 }
+
+int ui_helpline__vshow(const char *fmt, va_list ap)
+{
+	return helpline_fns->show(fmt, ap);
+}
diff --git a/tools/perf/ui/helpline.h b/tools/perf/ui/helpline.h
index baa28a4..46181f4 100644
--- a/tools/perf/ui/helpline.h
+++ b/tools/perf/ui/helpline.h
@@ -9,6 +9,7 @@
 struct ui_helpline {
 	void (*pop)(void);
 	void (*push)(const char *msg);
+	int  (*show)(const char *fmt, va_list ap);
 };
 
 extern struct ui_helpline *helpline_fns;
@@ -20,28 +21,9 @@ void ui_helpline__push(const char *msg);
 void ui_helpline__vpush(const char *fmt, va_list ap);
 void ui_helpline__fpush(const char *fmt, ...);
 void ui_helpline__puts(const char *msg);
+int  ui_helpline__vshow(const char *fmt, va_list ap);
 
 extern char ui_helpline__current[512];
-
-#ifdef NEWT_SUPPORT
 extern char ui_helpline__last_msg[];
-int ui_helpline__show_help(const char *format, va_list ap);
-#else
-static inline int ui_helpline__show_help(const char *format __maybe_unused,
-					 va_list ap __maybe_unused)
-{
-	return 0;
-}
-#endif /* NEWT_SUPPORT */
-
-#ifdef GTK2_SUPPORT
-int perf_gtk__show_helpline(const char *format, va_list ap);
-#else
-static inline int perf_gtk__show_helpline(const char *format __maybe_unused,
-					  va_list ap __maybe_unused)
-{
-	return 0;
-}
-#endif /* GTK2_SUPPORT */
 
 #endif /* _PERF_UI_HELPLINE_H_ */
diff --git a/tools/perf/ui/tui/helpline.c b/tools/perf/ui/tui/helpline.c
index 2884d2f..1c8b9af 100644
--- a/tools/perf/ui/tui/helpline.c
+++ b/tools/perf/ui/tui/helpline.c
@@ -8,6 +8,8 @@
 #include "../ui.h"
 #include "../libslang.h"
 
+char ui_helpline__last_msg[1024];
+
 static void tui_helpline__pop(void)
 {
 }
@@ -23,20 +25,7 @@ static void tui_helpline__push(const char *msg)
 	strncpy(ui_helpline__current, msg, sz)[sz - 1] = '\0';
 }
 
-struct ui_helpline tui_helpline_fns = {
-	.pop	= tui_helpline__pop,
-	.push	= tui_helpline__push,
-};
-
-void ui_helpline__init(void)
-{
-	helpline_fns = &tui_helpline_fns;
-	ui_helpline__puts(" ");
-}
-
-char ui_helpline__last_msg[1024];
-
-int ui_helpline__show_help(const char *format, va_list ap)
+static int tui_helpline__show(const char *format, va_list ap)
 {
 	int ret;
 	static int backlog;
@@ -55,3 +44,15 @@ int ui_helpline__show_help(const char *format, va_list ap)
 
 	return ret;
 }
+
+struct ui_helpline tui_helpline_fns = {
+	.pop	= tui_helpline__pop,
+	.push	= tui_helpline__push,
+	.show	= tui_helpline__show,
+};
+
+void ui_helpline__init(void)
+{
+	helpline_fns = &tui_helpline_fns;
+	ui_helpline__puts(" ");
+}
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index 39861a2a..391c9a9 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -23,10 +23,8 @@ int eprintf(int level, const char *fmt, ...)
 
 	if (verbose >= level) {
 		va_start(args, fmt);
-		if (use_browser == 1)
-			ret = ui_helpline__show_help(fmt, args);
-		else if (use_browser == 2)
-			ret = perf_gtk__show_helpline(fmt, args);
+		if (use_browser > 1)
+			ui_helpline__vshow(fmt, args);
 		else
 			ret = vfprintf(stderr, fmt, args);
 		va_end(args);
-- 
1.7.9.2.358.g22243


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

* [PATCH 04/37] perf tools: Don't check configuration on make clean
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2012-12-11 22:47 ` [PATCH 03/37] perf ui/helpline: Introduce ui_helpline__vshow() Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 05/37] perf session: Free environment information when deleting session Arnaldo Carvalho de Melo
                   ` (33 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 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>

Current perf build process checks various system configuration on
invocation to make.  But this is not needed just for cleaning.

To do that, move some of python related variables out of conditional
since 'clean' target needs them.  Normal path should not be affected by
this.

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/1352867990-658-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/Makefile |    2 ++
 tools/perf/Makefile               |   28 ++++++++++++++++------------
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile
index ef6d22e..f6e5901 100644
--- a/tools/perf/Documentation/Makefile
+++ b/tools/perf/Documentation/Makefile
@@ -222,10 +222,12 @@ install-pdf: pdf
 #install-html: html
 #	'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
 
+ifneq ($(MAKECMDGOALS),clean)
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) $(OUTPUT)PERF-VERSION-FILE
 
 -include $(OUTPUT)PERF-VERSION-FILE
+endif
 
 #
 # Determine "include::" file references in asciidoc files.
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 8fca560..08da9fc 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -153,6 +153,7 @@ INSTALL = install
 # explicitly what architecture to check for. Fix this up for yours..
 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 
+ifneq ($(MAKECMDGOALS),clean)
 -include config/feature-tests.mak
 
 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
@@ -206,6 +207,7 @@ ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
 	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
 	BASIC_CFLAGS += -I.
 endif
+endif # MAKECMDGOALS != clean
 
 # Guard against environment variables
 BUILTIN_OBJS =
@@ -230,11 +232,19 @@ endif
 LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
 TE_LIB := -L$(TE_PATH) -ltraceevent
 
+export LIBTRACEEVENT
+
+# python extension build directories
+PYTHON_EXTBUILD     := $(OUTPUT)python_ext_build/
+PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
+PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
+export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
+
+python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
+
 PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
 PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py
 
-export LIBTRACEEVENT
-
 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
 	$(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \
 	  --quiet build_ext; \
@@ -514,6 +524,7 @@ PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT)
 #
 # Platform specific tweaks
 #
+ifneq ($(MAKECMDGOALS),clean)
 
 # We choose to avoid "if .. else if .. else .. endif endif"
 # because maintaining the nesting to match is a pain.  If
@@ -703,7 +714,7 @@ disable-python = $(eval $(disable-python_code))
 define disable-python_code
   BASIC_CFLAGS += -DNO_LIBPYTHON
   $(if $(1),$(warning No $(1) was found))
-  $(warning Python support won't be built)
+  $(warning Python support will not be built)
 endef
 
 override PYTHON := \
@@ -711,19 +722,10 @@ override PYTHON := \
 
 ifndef PYTHON
   $(call disable-python,python interpreter)
-  python-clean :=
 else
 
   PYTHON_WORD := $(call shell-wordify,$(PYTHON))
 
-  # python extension build directories
-  PYTHON_EXTBUILD     := $(OUTPUT)python_ext_build/
-  PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
-  PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
-  export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
-
-  python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
-
   ifdef NO_LIBPYTHON
     $(call disable-python)
   else
@@ -839,6 +841,8 @@ ifdef ASCIIDOC8
 	export ASCIIDOC8
 endif
 
+endif # MAKECMDGOALS != clean
+
 # Shell quote (do not use $(call) to accommodate ancient setups);
 
 ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG))
-- 
1.7.9.2.358.g22243


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

* [PATCH 05/37] perf session: Free environment information when deleting session
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2012-12-11 22:47 ` [PATCH 04/37] perf tools: Don't check configuration on make clean Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 06/37] perf top: Add missing newline on pr_err call Arnaldo Carvalho de Melo
                   ` (32 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Andi Kleen, Feng Tang,
	Peter Zijlstra, Arnaldo Carvalho de Melo

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

The perf session environment information was saved (so allocated) during
perf_session__open, but was not freed.  As free(3) handles NULL pointer
input properly it won't cause a issue for writing modes - e.g. perf
record

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Feng Tang <feng.tang@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1353472999-23042-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index ce6f511..d5fb607 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -204,11 +204,28 @@ static void perf_session__delete_threads(struct perf_session *session)
 	machine__delete_threads(&session->host_machine);
 }
 
+static void perf_session_env__delete(struct perf_session_env *env)
+{
+	free(env->hostname);
+	free(env->os_release);
+	free(env->version);
+	free(env->arch);
+	free(env->cpu_desc);
+	free(env->cpuid);
+
+	free(env->cmdline);
+	free(env->sibling_cores);
+	free(env->sibling_threads);
+	free(env->numa_nodes);
+	free(env->pmu_mappings);
+}
+
 void perf_session__delete(struct perf_session *self)
 {
 	perf_session__destroy_kernel_maps(self);
 	perf_session__delete_dead_threads(self);
 	perf_session__delete_threads(self);
+	perf_session_env__delete(&self->header.env);
 	machine__exit(&self->host_machine);
 	close(self->fd);
 	free(self);
-- 
1.7.9.2.358.g22243


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

* [PATCH 06/37] perf top: Add missing newline on pr_err call
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2012-12-11 22:47 ` [PATCH 05/37] perf session: Free environment information when deleting session Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 07/37] perf tools: Fix mmap limitations on 32-bit Arnaldo Carvalho de Melo
                   ` (31 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 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_event__process_sample function, when not finding a machine
associated with a sample, was calling pr_err without a newline,
garbling the screen on TUI mode due to a problem introduced by a
recent ui_helpline patch.

On --stdio it would just concatenate the messages for each sample with
no machine associated, fix it by adding the newline.

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-vuz88welqvp15c2uybd9osnz@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index c9ff395..987e1b8 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -727,7 +727,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
 	}
 
 	if (!machine) {
-		pr_err("%u unprocessable samples recorded.",
+		pr_err("%u unprocessable samples recorded.\n",
 		       top->session->hists.stats.nr_unprocessable_samples++);
 		return;
 	}
-- 
1.7.9.2.358.g22243


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

* [PATCH 07/37] perf tools: Fix mmap limitations on 32-bit
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2012-12-11 22:47 ` [PATCH 06/37] perf top: Add missing newline on pr_err call Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 08/37] perf hists: Introduce perf_hpp__list for period related columns Arnaldo Carvalho de Melo
                   ` (30 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Miller, Ingo Molnar, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: David Miller <davem@davemloft.net>

This is a suggested patch to fix the bug I reported at:

	http://marc.info/?l=linux-kernel&m=135033028924652&w=2

Essentially, there is a hard requirement that when perf analyzes a
trace, it must have the entire thing mmap()'d.

Therefore the scheme used on 32-bit where we have a fixed (8) number of
32MB mmaps, and cycle through them, simply does not work.

One of the reasons this requirement exists is because the iterators
maintain references to perf entry objects and those references don't
just simply go away when this mmap code decides to cycle an old mmap
area out and reuse it.  At this point, those entry pointers now point to
garbage resulting in unpredictable behavior and crashes.

It is better to try to mmap() as much as we can and if we do actually
run into address space limitations, the failure of the mmap() call will
indicate that and stop processing.

I noticed that perf_session->mmap_window is set to a constant in one
location, and only used in one other location.  So I got rid of it
altogether.

So we adjust the size of the mmaps[] array to the maximum we could need.
On 64-bit we only need one slot.  On 32-bit we could need up to 128 (128
* 32MB == 4GB).

I've verified that this allows a large (~600MB) perf.data file to be
analyzed properly with a 32-bit perf binary, which previously was not
possible.

Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20121110.141219.582924082787523608.davem@davemloft.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c |   25 ++++++++++++++-----------
 tools/perf/util/session.h |    1 -
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index d5fb607..aa5e582 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -128,15 +128,6 @@ struct perf_session *perf_session__new(const char *filename, int mode,
 		goto out;
 
 	memcpy(self->filename, filename, len);
-	/*
-	 * On 64bit we can mmap the data file in one go. No need for tiny mmap
-	 * slices. On 32bit we use 32MB.
-	 */
-#if BITS_PER_LONG == 64
-	self->mmap_window = ULLONG_MAX;
-#else
-	self->mmap_window = 32 * 1024 * 1024ULL;
-#endif
 	self->machines = RB_ROOT;
 	self->repipe = repipe;
 	INIT_LIST_HEAD(&self->ordered_samples.samples);
@@ -1386,6 +1377,18 @@ fetch_mmaped_event(struct perf_session *session,
 	return event;
 }
 
+/*
+ * On 64bit we can mmap the data file in one go. No need for tiny mmap
+ * slices. On 32bit we use 32MB.
+ */
+#if BITS_PER_LONG == 64
+#define MMAP_SIZE ULLONG_MAX
+#define NUM_MMAPS 1
+#else
+#define MMAP_SIZE (32 * 1024 * 1024ULL)
+#define NUM_MMAPS 128
+#endif
+
 int __perf_session__process_events(struct perf_session *session,
 				   u64 data_offset, u64 data_size,
 				   u64 file_size, struct perf_tool *tool)
@@ -1393,7 +1396,7 @@ 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	mmap_size;
-	char *buf, *mmaps[8];
+	char *buf, *mmaps[NUM_MMAPS];
 	union perf_event *event;
 	uint32_t size;
 
@@ -1408,7 +1411,7 @@ int __perf_session__process_events(struct perf_session *session,
 
 	progress_next = file_size / 16;
 
-	mmap_size = session->mmap_window;
+	mmap_size = MMAP_SIZE;
 	if (mmap_size > file_size)
 		mmap_size = file_size;
 
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index cea133a..c18fabd 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -30,7 +30,6 @@ struct ordered_samples {
 struct perf_session {
 	struct perf_header	header;
 	unsigned long		size;
-	unsigned long		mmap_window;
 	struct machine		host_machine;
 	struct rb_root		machines;
 	struct perf_evlist	*evlist;
-- 
1.7.9.2.358.g22243


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

* [PATCH 08/37] perf hists: Introduce perf_hpp__list for period related columns
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2012-12-11 22:47 ` [PATCH 07/37] perf tools: Fix mmap limitations on 32-bit Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 09/37] perf hists: Fix period symbol_conf.field_sep display Arnaldo Carvalho de Melo
                   ` (29 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Peter Zijlstra, Ingo Molnar,
	Paul Mackerras, Corey Ashford, Frederic Weisbecker, Namhyung Kim,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Adding perf_hpp__list list to register and contain all period related
columns the command is interested in.

This way we get rid of static array holding all possible columns and
enable commands to register their own columns.

It'll be handy for diff command in future to process and display data
for multiple files.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/n/tip-kiykge4igrcl7etmpmveto1h@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-diff.c      |   21 ++++-----
 tools/perf/builtin-report.c    |    1 +
 tools/perf/ui/browsers/hists.c |   20 +++++----
 tools/perf/ui/gtk/browser.c    |   30 +++++--------
 tools/perf/ui/hist.c           |   96 ++++++++++++++++++++++------------------
 tools/perf/ui/setup.c          |    1 +
 tools/perf/ui/stdio/hist.c     |   17 +++----
 tools/perf/util/hist.h         |   11 ++++-
 8 files changed, 101 insertions(+), 96 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 93b852f..9fbbc01 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -597,40 +597,35 @@ static const struct option options[] = {
 
 static void ui_init(void)
 {
-	perf_hpp__init();
-
-	/* No overhead column. */
-	perf_hpp__column_enable(PERF_HPP__OVERHEAD, false);
-
 	/*
 	 * Display baseline/delta/ratio/displacement/
 	 * formula/periods columns.
 	 */
-	perf_hpp__column_enable(PERF_HPP__BASELINE, true);
+	perf_hpp__column_enable(PERF_HPP__BASELINE);
 
 	switch (compute) {
 	case COMPUTE_DELTA:
-		perf_hpp__column_enable(PERF_HPP__DELTA, true);
+		perf_hpp__column_enable(PERF_HPP__DELTA);
 		break;
 	case COMPUTE_RATIO:
-		perf_hpp__column_enable(PERF_HPP__RATIO, true);
+		perf_hpp__column_enable(PERF_HPP__RATIO);
 		break;
 	case COMPUTE_WEIGHTED_DIFF:
-		perf_hpp__column_enable(PERF_HPP__WEIGHTED_DIFF, true);
+		perf_hpp__column_enable(PERF_HPP__WEIGHTED_DIFF);
 		break;
 	default:
 		BUG_ON(1);
 	};
 
 	if (show_displacement)
-		perf_hpp__column_enable(PERF_HPP__DISPL, true);
+		perf_hpp__column_enable(PERF_HPP__DISPL);
 
 	if (show_formula)
-		perf_hpp__column_enable(PERF_HPP__FORMULA, true);
+		perf_hpp__column_enable(PERF_HPP__FORMULA);
 
 	if (show_period) {
-		perf_hpp__column_enable(PERF_HPP__PERIOD, true);
-		perf_hpp__column_enable(PERF_HPP__PERIOD_BASELINE, true);
+		perf_hpp__column_enable(PERF_HPP__PERIOD);
+		perf_hpp__column_enable(PERF_HPP__PERIOD_BASELINE);
 	}
 }
 
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index fc25100..5134acf 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -692,6 +692,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 		setup_browser(true);
 	else {
 		use_browser = 0;
+		perf_hpp__column_enable(PERF_HPP__OVERHEAD);
 		perf_hpp__init();
 	}
 
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index ccc4bd1..57b82c2 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -587,6 +587,8 @@ HPP__COLOR_FN(overhead_guest_us, period_guest_us)
 
 void hist_browser__init_hpp(void)
 {
+	perf_hpp__column_enable(PERF_HPP__OVERHEAD);
+
 	perf_hpp__init();
 
 	perf_hpp__format[PERF_HPP__OVERHEAD].color =
@@ -607,12 +609,13 @@ static int hist_browser__show_entry(struct hist_browser *browser,
 {
 	char s[256];
 	double percent;
-	int i, printed = 0;
+	int printed = 0;
 	int width = browser->b.width;
 	char folded_sign = ' ';
 	bool current_entry = ui_browser__is_current_entry(&browser->b, row);
 	off_t row_offset = entry->row_offset;
 	bool first = true;
+	struct perf_hpp_fmt *fmt;
 
 	if (current_entry) {
 		browser->he_selection = entry;
@@ -629,12 +632,11 @@ static int hist_browser__show_entry(struct hist_browser *browser,
 			.buf		= s,
 			.size		= sizeof(s),
 		};
+		int i = 0;
 
 		ui_browser__gotorc(&browser->b, row, 0);
 
-		for (i = 0; i < PERF_HPP__MAX_INDEX; i++) {
-			if (!perf_hpp__format[i].cond)
-				continue;
+		perf_hpp__for_each_format(fmt) {
 
 			if (!first) {
 				slsmg_printf("  ");
@@ -642,14 +644,14 @@ static int hist_browser__show_entry(struct hist_browser *browser,
 			}
 			first = false;
 
-			if (perf_hpp__format[i].color) {
+			if (fmt->color) {
 				hpp.ptr = &percent;
 				/* It will set percent for us. See HPP__COLOR_FN above. */
-				width -= perf_hpp__format[i].color(&hpp, entry);
+				width -= fmt->color(&hpp, entry);
 
 				ui_browser__set_percent_color(&browser->b, percent, current_entry);
 
-				if (i == PERF_HPP__OVERHEAD && symbol_conf.use_callchain) {
+				if (!i && symbol_conf.use_callchain) {
 					slsmg_printf("%c ", folded_sign);
 					width -= 2;
 				}
@@ -659,9 +661,11 @@ static int hist_browser__show_entry(struct hist_browser *browser,
 				if (!current_entry || !browser->b.navkeypressed)
 					ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL);
 			} else {
-				width -= perf_hpp__format[i].entry(&hpp, entry);
+				width -= fmt->entry(&hpp, entry);
 				slsmg_printf("%s", s);
 			}
+
+			i++;
 		}
 
 		/* The scroll bar isn't being used */
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c
index 253b621..e59ba33 100644
--- a/tools/perf/ui/gtk/browser.c
+++ b/tools/perf/ui/gtk/browser.c
@@ -74,6 +74,8 @@ HPP__COLOR_FN(overhead_guest_us, period_guest_us)
 
 void perf_gtk__init_hpp(void)
 {
+	perf_hpp__column_enable(PERF_HPP__OVERHEAD);
+
 	perf_hpp__init();
 
 	perf_hpp__format[PERF_HPP__OVERHEAD].color =
@@ -90,13 +92,14 @@ void perf_gtk__init_hpp(void)
 
 static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists)
 {
+	struct perf_hpp_fmt *fmt;
 	GType col_types[MAX_COLUMNS];
 	GtkCellRenderer *renderer;
 	struct sort_entry *se;
 	GtkListStore *store;
 	struct rb_node *nd;
 	GtkWidget *view;
-	int i, col_idx;
+	int col_idx;
 	int nr_cols;
 	char s[512];
 
@@ -107,12 +110,8 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists)
 
 	nr_cols = 0;
 
-	for (i = 0; i < PERF_HPP__MAX_INDEX; i++) {
-		if (!perf_hpp__format[i].cond)
-			continue;
-
+	perf_hpp__for_each_format(fmt)
 		col_types[nr_cols++] = G_TYPE_STRING;
-	}
 
 	list_for_each_entry(se, &hist_entry__sort_list, list) {
 		if (se->elide)
@@ -129,12 +128,8 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists)
 
 	col_idx = 0;
 
-	for (i = 0; i < PERF_HPP__MAX_INDEX; i++) {
-		if (!perf_hpp__format[i].cond)
-			continue;
-
-		perf_hpp__format[i].header(&hpp);
-
+	perf_hpp__for_each_format(fmt) {
+		fmt->header(&hpp);
 		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
 							    -1, s,
 							    renderer, "markup",
@@ -166,14 +161,11 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists)
 
 		col_idx = 0;
 
-		for (i = 0; i < PERF_HPP__MAX_INDEX; i++) {
-			if (!perf_hpp__format[i].cond)
-				continue;
-
-			if (perf_hpp__format[i].color)
-				perf_hpp__format[i].color(&hpp, h);
+		perf_hpp__for_each_format(fmt) {
+			if (fmt->color)
+				fmt->color(&hpp, h);
 			else
-				perf_hpp__format[i].entry(&hpp, h);
+				fmt->entry(&hpp, h);
 
 			gtk_list_store_set(store, &iter, col_idx++, s, -1);
 		}
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index aa84130..0a5281f 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -386,60 +386,71 @@ static int hpp__entry_formula(struct perf_hpp *hpp, struct hist_entry *he)
 	return scnprintf(hpp->buf, hpp->size, fmt, buf);
 }
 
-#define HPP__COLOR_PRINT_FNS(_name)		\
-	.header	= hpp__header_ ## _name,		\
-	.width	= hpp__width_ ## _name,		\
-	.color	= hpp__color_ ## _name,		\
-	.entry	= hpp__entry_ ## _name
+#define HPP__COLOR_PRINT_FNS(_name)			\
+	{						\
+		.header	= hpp__header_ ## _name,	\
+		.width	= hpp__width_ ## _name,		\
+		.color	= hpp__color_ ## _name,		\
+		.entry	= hpp__entry_ ## _name		\
+	}
 
-#define HPP__PRINT_FNS(_name)			\
-	.header	= hpp__header_ ## _name,		\
-	.width	= hpp__width_ ## _name,		\
-	.entry	= hpp__entry_ ## _name
+#define HPP__PRINT_FNS(_name)				\
+	{						\
+		.header	= hpp__header_ ## _name,	\
+		.width	= hpp__width_ ## _name,		\
+		.entry	= hpp__entry_ ## _name		\
+	}
 
 struct perf_hpp_fmt perf_hpp__format[] = {
-	{ .cond = false, HPP__COLOR_PRINT_FNS(baseline) },
-	{ .cond = true,  HPP__COLOR_PRINT_FNS(overhead) },
-	{ .cond = false, HPP__COLOR_PRINT_FNS(overhead_sys) },
-	{ .cond = false, HPP__COLOR_PRINT_FNS(overhead_us) },
-	{ .cond = false, HPP__COLOR_PRINT_FNS(overhead_guest_sys) },
-	{ .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) },
-	{ .cond = false, HPP__PRINT_FNS(displ) },
-	{ .cond = false, HPP__PRINT_FNS(formula) }
+	HPP__COLOR_PRINT_FNS(baseline),
+	HPP__COLOR_PRINT_FNS(overhead),
+	HPP__COLOR_PRINT_FNS(overhead_sys),
+	HPP__COLOR_PRINT_FNS(overhead_us),
+	HPP__COLOR_PRINT_FNS(overhead_guest_sys),
+	HPP__COLOR_PRINT_FNS(overhead_guest_us),
+	HPP__PRINT_FNS(samples),
+	HPP__PRINT_FNS(period),
+	HPP__PRINT_FNS(period_baseline),
+	HPP__PRINT_FNS(delta),
+	HPP__PRINT_FNS(ratio),
+	HPP__PRINT_FNS(wdiff),
+	HPP__PRINT_FNS(displ),
+	HPP__PRINT_FNS(formula)
 };
 
+LIST_HEAD(perf_hpp__list);
+
 #undef HPP__COLOR_PRINT_FNS
 #undef HPP__PRINT_FNS
 
 void perf_hpp__init(void)
 {
 	if (symbol_conf.show_cpu_utilization) {
-		perf_hpp__format[PERF_HPP__OVERHEAD_SYS].cond = true;
-		perf_hpp__format[PERF_HPP__OVERHEAD_US].cond = true;
+		perf_hpp__column_enable(PERF_HPP__OVERHEAD_SYS);
+		perf_hpp__column_enable(PERF_HPP__OVERHEAD_US);
 
 		if (perf_guest) {
-			perf_hpp__format[PERF_HPP__OVERHEAD_GUEST_SYS].cond = true;
-			perf_hpp__format[PERF_HPP__OVERHEAD_GUEST_US].cond = true;
+			perf_hpp__column_enable(PERF_HPP__OVERHEAD_GUEST_SYS);
+			perf_hpp__column_enable(PERF_HPP__OVERHEAD_GUEST_US);
 		}
 	}
 
 	if (symbol_conf.show_nr_samples)
-		perf_hpp__format[PERF_HPP__SAMPLES].cond = true;
+		perf_hpp__column_enable(PERF_HPP__SAMPLES);
 
 	if (symbol_conf.show_total_period)
-		perf_hpp__format[PERF_HPP__PERIOD].cond = true;
+		perf_hpp__column_enable(PERF_HPP__PERIOD);
 }
 
-void perf_hpp__column_enable(unsigned col, bool enable)
+void perf_hpp__column_register(struct perf_hpp_fmt *format)
+{
+	list_add_tail(&format->list, &perf_hpp__list);
+}
+
+void perf_hpp__column_enable(unsigned col)
 {
 	BUG_ON(col >= PERF_HPP__MAX_INDEX);
-	perf_hpp__format[col].cond = enable;
+	perf_hpp__column_register(&perf_hpp__format[col]);
 }
 
 static inline void advance_hpp(struct perf_hpp *hpp, int inc)
@@ -452,27 +463,25 @@ int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he,
 				bool color)
 {
 	const char *sep = symbol_conf.field_sep;
+	struct perf_hpp_fmt *fmt;
 	char *start = hpp->buf;
-	int i, ret;
+	int ret;
 	bool first = true;
 
 	if (symbol_conf.exclude_other && !he->parent)
 		return 0;
 
-	for (i = 0; i < PERF_HPP__MAX_INDEX; i++) {
-		if (!perf_hpp__format[i].cond)
-			continue;
-
+	perf_hpp__for_each_format(fmt) {
 		if (!sep || !first) {
 			ret = scnprintf(hpp->buf, hpp->size, "%s", sep ?: "  ");
 			advance_hpp(hpp, ret);
 			first = false;
 		}
 
-		if (color && perf_hpp__format[i].color)
-			ret = perf_hpp__format[i].color(hpp, he);
+		if (color && fmt->color)
+			ret = fmt->color(hpp, he);
 		else
-			ret = perf_hpp__format[i].entry(hpp, he);
+			ret = fmt->entry(hpp, he);
 
 		advance_hpp(hpp, ret);
 	}
@@ -504,16 +513,15 @@ int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,
  */
 unsigned int hists__sort_list_width(struct hists *hists)
 {
+	struct perf_hpp_fmt *fmt;
 	struct sort_entry *se;
-	int i, ret = 0;
+	int i = 0, ret = 0;
 
-	for (i = 0; i < PERF_HPP__MAX_INDEX; i++) {
-		if (!perf_hpp__format[i].cond)
-			continue;
+	perf_hpp__for_each_format(fmt) {
 		if (i)
 			ret += 2;
 
-		ret += perf_hpp__format[i].width(NULL);
+		ret += fmt->width(NULL);
 	}
 
 	list_for_each_entry(se, &hist_entry__sort_list, list)
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index ebb4cc1..166f13d 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -30,6 +30,7 @@ void setup_browser(bool fallback_to_pager)
 		if (fallback_to_pager)
 			setup_pager();
 
+		perf_hpp__column_enable(PERF_HPP__OVERHEAD);
 		perf_hpp__init();
 		break;
 	}
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index f0ee204..0eae3b2 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -335,13 +335,14 @@ static int hist_entry__fprintf(struct hist_entry *he, size_t size,
 size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
 		      int max_cols, FILE *fp)
 {
+	struct perf_hpp_fmt *fmt;
 	struct sort_entry *se;
 	struct rb_node *nd;
 	size_t ret = 0;
 	unsigned int width;
 	const char *sep = symbol_conf.field_sep;
 	const char *col_width = symbol_conf.col_width_list_str;
-	int idx, nr_rows = 0;
+	int nr_rows = 0;
 	char bf[96];
 	struct perf_hpp dummy_hpp = {
 		.buf	= bf,
@@ -355,16 +356,14 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
 		goto print_entries;
 
 	fprintf(fp, "# ");
-	for (idx = 0; idx < PERF_HPP__MAX_INDEX; idx++) {
-		if (!perf_hpp__format[idx].cond)
-			continue;
 
+	perf_hpp__for_each_format(fmt) {
 		if (!first)
 			fprintf(fp, "%s", sep ?: "  ");
 		else
 			first = false;
 
-		perf_hpp__format[idx].header(&dummy_hpp);
+		fmt->header(&dummy_hpp);
 		fprintf(fp, "%s", bf);
 	}
 
@@ -400,18 +399,16 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
 	first = true;
 
 	fprintf(fp, "# ");
-	for (idx = 0; idx < PERF_HPP__MAX_INDEX; idx++) {
-		unsigned int i;
 
-		if (!perf_hpp__format[idx].cond)
-			continue;
+	perf_hpp__for_each_format(fmt) {
+		unsigned int i;
 
 		if (!first)
 			fprintf(fp, "%s", sep ?: "  ");
 		else
 			first = false;
 
-		width = perf_hpp__format[idx].width(&dummy_hpp);
+		width = fmt->width(&dummy_hpp);
 		for (i = 0; i < width; i++)
 			fprintf(fp, ".");
 	}
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 8b091a5..a935a60 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -126,13 +126,19 @@ struct perf_hpp {
 };
 
 struct perf_hpp_fmt {
-	bool cond;
 	int (*header)(struct perf_hpp *hpp);
 	int (*width)(struct perf_hpp *hpp);
 	int (*color)(struct perf_hpp *hpp, struct hist_entry *he);
 	int (*entry)(struct perf_hpp *hpp, struct hist_entry *he);
+
+	struct list_head list;
 };
 
+extern struct list_head perf_hpp__list;
+
+#define perf_hpp__for_each_format(format) \
+	list_for_each_entry(format, &perf_hpp__list, list)
+
 extern struct perf_hpp_fmt perf_hpp__format[];
 
 enum {
@@ -155,7 +161,8 @@ enum {
 };
 
 void perf_hpp__init(void);
-void perf_hpp__column_enable(unsigned col, bool enable);
+void perf_hpp__column_register(struct perf_hpp_fmt *format);
+void perf_hpp__column_enable(unsigned col);
 int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he,
 				bool color);
 
-- 
1.7.9.2.358.g22243


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

* [PATCH 09/37] perf hists: Fix period symbol_conf.field_sep display
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2012-12-11 22:47 ` [PATCH 08/37] perf hists: Introduce perf_hpp__list for period related columns Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 10/37] perf symbols: Ignore ABS symbols when loading data maps Arnaldo Carvalho de Melo
                   ` (28 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Paul Mackerras, Corey Ashford, Frederic Weisbecker,
	Namhyung Kim, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Currently we don't properly display hist data with symbol_conf.field_sep
separator. We need to display either space or separator.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/n/tip-cyggwys0bz5kqdowwvfd8h72@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/hist.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 0a5281f..6e639b5 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -472,11 +472,15 @@ int hist_entry__period_snprintf(struct perf_hpp *hpp, struct hist_entry *he,
 		return 0;
 
 	perf_hpp__for_each_format(fmt) {
+		/*
+		 * If there's no field_sep, we still need
+		 * to display initial '  '.
+		 */
 		if (!sep || !first) {
 			ret = scnprintf(hpp->buf, hpp->size, "%s", sep ?: "  ");
 			advance_hpp(hpp, ret);
+		} else
 			first = false;
-		}
 
 		if (color && fmt->color)
 			ret = fmt->color(hpp, he);
-- 
1.7.9.2.358.g22243


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

* [PATCH 10/37] perf symbols: Ignore ABS symbols when loading data maps
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (8 preceding siblings ...)
  2012-12-11 22:47 ` [PATCH 09/37] perf hists: Fix period symbol_conf.field_sep display Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 11/37] perf hists: Fix typo on hist__entry_add_pair Arnaldo Carvalho de Melo
                   ` (27 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Andi Kleen, Ingo Molnar,
	Jiri Olsa, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo

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

When loading symbols in a data mapping, ABS symbols (which has a value
of SHN_ABS in its st_shndx) failed at elf_getscn().  And it marks the
loading as a failure so already loaded symbols cannot be fixed up.

I'm not sure what should be done. Just ignore them for now. :)

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1353502185-26521-19-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol-elf.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index db0cc92..f63557b 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -718,6 +718,17 @@ int dso__load_sym(struct dso *dso, struct map *map,
 					sym.st_value);
 			used_opd = true;
 		}
+		/*
+		 * When loading symbols in a data mapping, ABS symbols (which
+		 * has a value of SHN_ABS in its st_shndx) failed at
+		 * elf_getscn().  And it marks the loading as a failure so
+		 * already loaded symbols cannot be fixed up.
+		 *
+		 * I'm not sure what should be done. Just ignore them for now.
+		 * - Namhyung Kim
+		 */
+		if (sym.st_shndx == SHN_ABS)
+			continue;
 
 		sec = elf_getscn(runtime_ss->elf, sym.st_shndx);
 		if (!sec)
-- 
1.7.9.2.358.g22243


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

* [PATCH 11/37] perf hists: Fix typo on hist__entry_add_pair
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (9 preceding siblings ...)
  2012-12-11 22:47 ` [PATCH 10/37] perf symbols: Ignore ABS symbols when loading data maps Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 12/37] perf hists: Link hist entry pairs to leader Arnaldo Carvalho de Melo
                   ` (26 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Andi Kleen, Jiri Olsa,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo

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

Fix a misplaced underscore.  In this case, 'hist_entry' is the name of
data structure and we usually put double underscores between data
structure and actual function name.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>,
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-8jdq8g6kl6v54hkexrfwsy72@git.kernel.org
[ committer note: put it in front of the patch queue where it came from ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.c |    4 ++--
 tools/perf/util/sort.h |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index cb17e2a..d2bc05c 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -785,7 +785,7 @@ void hists__match(struct hists *leader, struct hists *other)
 		pair = hists__find_entry(other, pos);
 
 		if (pair)
-			hist__entry_add_pair(pos, pair);
+			hist_entry__add_pair(pos, pair);
 	}
 }
 
@@ -806,7 +806,7 @@ int hists__link(struct hists *leader, struct hists *other)
 			pair = hists__add_dummy_entry(leader, pos);
 			if (pair == NULL)
 				return -1;
-			hist__entry_add_pair(pair, pos);
+			hist_entry__add_pair(pair, pos);
 		}
 	}
 
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index b4e8c3b..91ae274 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -118,7 +118,7 @@ static inline struct hist_entry *hist_entry__next_pair(struct hist_entry *he)
 	return NULL;
 }
 
-static inline void hist__entry_add_pair(struct hist_entry *he,
+static inline void hist_entry__add_pair(struct hist_entry *he,
 					struct hist_entry *pair)
 {
 	list_add_tail(&he->pairs.head, &pair->pairs.node);
-- 
1.7.9.2.358.g22243


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

* [PATCH 12/37] perf hists: Link hist entry pairs to leader
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (10 preceding siblings ...)
  2012-12-11 22:47 ` [PATCH 11/37] perf hists: Fix typo on hist__entry_add_pair Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:47 ` [PATCH 13/37] perf evsel: Set leader evsel's ->leader to itself Arnaldo Carvalho de Melo
                   ` (25 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Andi Kleen, Jiri Olsa,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo

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

Current hists__match/link() link a leader to its pair, so if multiple
pairs were linked, the leader will lose pointer to previous pairs since
it was overwritten.  Fix it by making leader the list head.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1354171126-14387-8-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/hist.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index d2bc05c..82df1b2 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -785,7 +785,7 @@ void hists__match(struct hists *leader, struct hists *other)
 		pair = hists__find_entry(other, pos);
 
 		if (pair)
-			hist_entry__add_pair(pos, pair);
+			hist_entry__add_pair(pair, pos);
 	}
 }
 
@@ -806,7 +806,7 @@ int hists__link(struct hists *leader, struct hists *other)
 			pair = hists__add_dummy_entry(leader, pos);
 			if (pair == NULL)
 				return -1;
-			hist_entry__add_pair(pair, pos);
+			hist_entry__add_pair(pos, pair);
 		}
 	}
 
-- 
1.7.9.2.358.g22243


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

* [PATCH 13/37] perf evsel: Set leader evsel's ->leader to itself
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (11 preceding siblings ...)
  2012-12-11 22:47 ` [PATCH 12/37] perf hists: Link hist entry pairs to leader Arnaldo Carvalho de Melo
@ 2012-12-11 22:47 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 14/37] perf evsel: Convert to _is_group_leader method Arnaldo Carvalho de Melo
                   ` (24 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Andi Kleen, Jiri Olsa,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo

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

Currently only non-leader members are set ->leader to the leader evsel
of the group and the leader has set NULL.  Thus it requires special
casing for leader evsels.  Set ->leader to itself will remove this.

Suggested-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1354171126-14387-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c |    1 -
 tools/perf/util/evsel.c  |    1 +
 tools/perf/util/evsel.h  |    2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 7052934..90db2a1 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -111,7 +111,6 @@ void __perf_evlist__set_leader(struct list_head *list)
 	struct perf_evsel *evsel, *leader;
 
 	leader = list_entry(list->next, struct perf_evsel, node);
-	leader->leader = NULL;
 
 	list_for_each_entry(evsel, list, node) {
 		if (evsel != leader)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 1b16dd1..7e93418 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -55,6 +55,7 @@ void perf_evsel__init(struct perf_evsel *evsel,
 {
 	evsel->idx	   = idx;
 	evsel->attr	   = *attr;
+	evsel->leader	   = evsel;
 	INIT_LIST_HEAD(&evsel->node);
 	hists__init(&evsel->hists);
 	evsel->sample_size = __perf_evsel__sample_size(attr->sample_type);
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 3d2b801..cbf6d97 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -228,6 +228,6 @@ static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel)
 
 static inline bool perf_evsel__is_group_member(const struct perf_evsel *evsel)
 {
-	return evsel->leader != NULL;
+	return evsel->leader != evsel;
 }
 #endif /* __PERF_EVSEL_H */
-- 
1.7.9.2.358.g22243


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

* [PATCH 14/37] perf evsel: Convert to _is_group_leader method
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (12 preceding siblings ...)
  2012-12-11 22:47 ` [PATCH 13/37] perf evsel: Set leader evsel's ->leader to itself Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 15/37] perf diff: Remove displacement from struct hist_entry_diff Arnaldo Carvalho de Melo
                   ` (23 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Andi Kleen, Jiri Olsa,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo

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

Convert perf_evsel__is_group_member to perf_evsel__is_group_leader.
This is because the most usecases are using negative form to check
whether the given evsel is a leader or not and it's IMHO somewhat
ambiguous - leader also *is* a member of the group.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1354171126-14387-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c       |    2 +-
 tools/perf/tests/parse-events.c |   20 ++++++++++----------
 tools/perf/util/evlist.c        |    4 ++--
 tools/perf/util/evsel.c         |    6 +++---
 tools/perf/util/evsel.h         |    4 ++--
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index c247fac..c12655a 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -153,7 +153,7 @@ retry:
 	}
 
 	if (!perf_target__has_task(&target) &&
-	    !perf_evsel__is_group_member(evsel)) {
+	    perf_evsel__is_group_leader(evsel)) {
 		attr->disabled = 1;
 		attr->enable_on_exec = 1;
 	}
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 32ee478..294ffdd 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -521,7 +521,7 @@ static int test__group1(struct perf_evlist *evlist)
 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
 	TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
-	TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel));
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
 
 	/* cycles:upp */
 	evsel = perf_evsel__next(evsel);
@@ -557,7 +557,7 @@ static int test__group2(struct perf_evlist *evlist)
 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
 	TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
-	TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel));
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
 
 	/* cache-references + :u modifier */
 	evsel = perf_evsel__next(evsel);
@@ -583,7 +583,7 @@ static int test__group2(struct perf_evlist *evlist)
 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
 	TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
-	TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel));
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
 
 	return 0;
 }
@@ -606,7 +606,7 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused)
 	TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
 	TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
-	TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel));
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
 	TEST_ASSERT_VAL("wrong group name",
 		!strcmp(leader->group_name, "group1"));
 
@@ -636,7 +636,7 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused)
 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
 	TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
-	TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel));
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
 	TEST_ASSERT_VAL("wrong group name",
 		!strcmp(leader->group_name, "group2"));
 
@@ -663,7 +663,7 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused)
 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest);
 	TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
-	TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel));
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
 
 	return 0;
 }
@@ -687,7 +687,7 @@ static int test__group4(struct perf_evlist *evlist __maybe_unused)
 	TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
 	TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 1);
 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
-	TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel));
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
 
 	/* instructions:kp + p */
 	evsel = perf_evsel__next(evsel);
@@ -724,7 +724,7 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused)
 	TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
-	TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel));
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
 
 	/* instructions + G */
 	evsel = perf_evsel__next(evsel);
@@ -751,7 +751,7 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused)
 	TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host);
 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
-	TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel));
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
 
 	/* instructions:G */
 	evsel = perf_evsel__next(evsel);
@@ -777,7 +777,7 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused)
 	TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest);
 	TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host);
 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);
-	TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel));
+	TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel));
 
 	return 0;
 }
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 90db2a1..d0e1e82 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -221,7 +221,7 @@ void perf_evlist__disable(struct perf_evlist *evlist)
 
 	for (cpu = 0; cpu < evlist->cpus->nr; cpu++) {
 		list_for_each_entry(pos, &evlist->entries, node) {
-			if (perf_evsel__is_group_member(pos))
+			if (!perf_evsel__is_group_leader(pos))
 				continue;
 			for (thread = 0; thread < evlist->threads->nr; thread++)
 				ioctl(FD(pos, cpu, thread),
@@ -237,7 +237,7 @@ void perf_evlist__enable(struct perf_evlist *evlist)
 
 	for (cpu = 0; cpu < cpu_map__nr(evlist->cpus); cpu++) {
 		list_for_each_entry(pos, &evlist->entries, node) {
-			if (perf_evsel__is_group_member(pos))
+			if (!perf_evsel__is_group_leader(pos))
 				continue;
 			for (thread = 0; thread < evlist->threads->nr; thread++)
 				ioctl(FD(pos, cpu, thread),
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 7e93418..bb58b05 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -520,14 +520,14 @@ void perf_evsel__config(struct perf_evsel *evsel,
 	 * Disabling only independent events or group leaders,
 	 * keeping group members enabled.
 	 */
-	if (!perf_evsel__is_group_member(evsel))
+	if (perf_evsel__is_group_leader(evsel))
 		attr->disabled = 1;
 
 	/*
 	 * Setting enable_on_exec for independent events and
 	 * group leaders for traced executed by perf.
 	 */
-	if (perf_target__none(&opts->target) && !perf_evsel__is_group_member(evsel))
+	if (perf_target__none(&opts->target) && perf_evsel__is_group_leader(evsel))
 		attr->enable_on_exec = 1;
 }
 
@@ -708,7 +708,7 @@ static int get_group_fd(struct perf_evsel *evsel, int cpu, int thread)
 	struct perf_evsel *leader = evsel->leader;
 	int fd;
 
-	if (!perf_evsel__is_group_member(evsel))
+	if (perf_evsel__is_group_leader(evsel))
 		return -1;
 
 	/*
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index cbf6d97..3f7ff47 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -226,8 +226,8 @@ static inline struct perf_evsel *perf_evsel__next(struct perf_evsel *evsel)
 	return list_entry(evsel->node.next, struct perf_evsel, node);
 }
 
-static inline bool perf_evsel__is_group_member(const struct perf_evsel *evsel)
+static inline bool perf_evsel__is_group_leader(const struct perf_evsel *evsel)
 {
-	return evsel->leader != evsel;
+	return evsel->leader == evsel;
 }
 #endif /* __PERF_EVSEL_H */
-- 
1.7.9.2.358.g22243


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

* [PATCH 15/37] perf diff: Remove displacement from struct hist_entry_diff
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (13 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 14/37] perf evsel: Convert to _is_group_leader method Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 16/37] perf diff: Change compute methods to work with pair directly Arnaldo Carvalho de Melo
                   ` (22 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Removing displacement from struct hist_entry_diff, because it's not
used. Displacement is not used for sorting, so there's no reason to
pre-calculate it.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.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/1354110769-2998-5-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/sort.h |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 91ae274..a1c0d56 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -55,9 +55,6 @@ struct he_stat {
 struct hist_entry_diff {
 	bool	computed;
 
-	/* PERF_HPP__DISPL */
-	int	displacement;
-
 	/* PERF_HPP__DELTA */
 	double	period_ratio_delta;
 
-- 
1.7.9.2.358.g22243


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

* [PATCH 16/37] perf diff: Change compute methods to work with pair directly
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (14 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 15/37] perf diff: Remove displacement from struct hist_entry_diff Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 17/37] perf diff: Change formula " Arnaldo Carvalho de Melo
                   ` (21 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Changing compute methods to operate over hist entry and its pair
directly. This makes the code more obvious and readable, instead of all
time checking for pair being != NULL.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.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/1354110769-2998-6-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-diff.c |   38 +++++++++++++++++---------------------
 tools/perf/ui/hist.c      |   40 +++++++++++++++++++++++++---------------
 tools/perf/util/hist.h    |    7 ++++---
 3 files changed, 46 insertions(+), 39 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 9fbbc01..342085a 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -146,47 +146,40 @@ static int setup_compute(const struct option *opt, const char *str,
 	return -EINVAL;
 }
 
-static double get_period_percent(struct hist_entry *he, u64 period)
+double perf_diff__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)
+double perf_diff__compute_delta(struct hist_entry *he, struct hist_entry *pair)
 {
-	struct hist_entry *pair = hist_entry__next_pair(he);
-	double new_percent = get_period_percent(he, he->stat.period);
-	double old_percent = pair ? get_period_percent(pair, pair->stat.period) : 0.0;
+	double new_percent = perf_diff__period_percent(he, he->stat.period);
+	double old_percent = perf_diff__period_percent(pair, pair->stat.period);
 
 	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)
+double perf_diff__compute_ratio(struct hist_entry *he, struct hist_entry *pair)
 {
-	struct hist_entry *pair = hist_entry__next_pair(he);
 	double new_period = he->stat.period;
-	double old_period = pair ? pair->stat.period : 0;
+	double old_period = pair->stat.period;
 
 	he->diff.computed = true;
-	he->diff.period_ratio = pair ? (new_period / old_period) : 0;
+	he->diff.period_ratio = new_period / old_period;
 	return he->diff.period_ratio;
 }
 
-s64 perf_diff__compute_wdiff(struct hist_entry *he)
+s64 perf_diff__compute_wdiff(struct hist_entry *he, struct hist_entry *pair)
 {
-	struct hist_entry *pair = hist_entry__next_pair(he);
 	u64 new_period = he->stat.period;
-	u64 old_period = pair ? pair->stat.period : 0;
+	u64 old_period = pair->stat.period;
 
 	he->diff.computed = true;
-
-	if (!pair)
-		he->diff.wdiff = 0;
-	else
-		he->diff.wdiff = new_period * compute_wdiff_w2 -
-				 old_period * compute_wdiff_w1;
+	he->diff.wdiff = new_period * compute_wdiff_w2 -
+			 old_period * compute_wdiff_w1;
 
 	return he->diff.wdiff;
 }
@@ -385,18 +378,21 @@ static void hists__precompute(struct hists *hists)
 
 	while (next != NULL) {
 		struct hist_entry *he = rb_entry(next, struct hist_entry, rb_node);
+		struct hist_entry *pair = hist_entry__next_pair(he);
 
 		next = rb_next(&he->rb_node);
+		if (!pair)
+			continue;
 
 		switch (compute) {
 		case COMPUTE_DELTA:
-			perf_diff__compute_delta(he);
+			perf_diff__compute_delta(he, pair);
 			break;
 		case COMPUTE_RATIO:
-			perf_diff__compute_ratio(he);
+			perf_diff__compute_ratio(he, pair);
 			break;
 		case COMPUTE_WEIGHTED_DIFF:
-			perf_diff__compute_wdiff(he);
+			perf_diff__compute_wdiff(he, pair);
 			break;
 		default:
 			BUG_ON(1);
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 6e639b5..108e5ed 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -268,14 +268,18 @@ 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 = hist_entry__next_pair(he);
 	const char *fmt = symbol_conf.field_sep ? "%s" : "%7.7s";
 	char buf[32] = " ";
-	double diff;
+	double diff = 0.0;
 
-	if (he->diff.computed)
-		diff = he->diff.period_ratio_delta;
-	else
-		diff = perf_diff__compute_delta(he);
+	if (pair) {
+		if (he->diff.computed)
+			diff = he->diff.period_ratio_delta;
+		else
+			diff = perf_diff__compute_delta(he, pair);
+	} else
+		diff = perf_diff__period_percent(he, he->stat.period);
 
 	if (fabs(diff) >= 0.01)
 		scnprintf(buf, sizeof(buf), "%+4.2F%%", diff);
@@ -297,14 +301,17 @@ 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 = hist_entry__next_pair(he);
 	const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
 	char buf[32] = " ";
-	double ratio;
+	double ratio = 0.0;
 
-	if (he->diff.computed)
-		ratio = he->diff.period_ratio;
-	else
-		ratio = perf_diff__compute_ratio(he);
+	if (pair) {
+		if (he->diff.computed)
+			ratio = he->diff.period_ratio;
+		else
+			ratio = perf_diff__compute_ratio(he, pair);
+	}
 
 	if (ratio > 0.0)
 		scnprintf(buf, sizeof(buf), "%+14.6F", ratio);
@@ -326,14 +333,17 @@ static int hpp__width_wdiff(struct perf_hpp *hpp __maybe_unused)
 
 static int hpp__entry_wdiff(struct perf_hpp *hpp, struct hist_entry *he)
 {
+	struct hist_entry *pair = hist_entry__next_pair(he);
 	const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
 	char buf[32] = " ";
-	s64 wdiff;
+	s64 wdiff = 0;
 
-	if (he->diff.computed)
-		wdiff = he->diff.wdiff;
-	else
-		wdiff = perf_diff__compute_wdiff(he);
+	if (pair) {
+		if (he->diff.computed)
+			wdiff = he->diff.wdiff;
+		else
+			wdiff = perf_diff__compute_wdiff(he, pair);
+	}
 
 	if (wdiff != 0)
 		scnprintf(buf, sizeof(buf), "%14ld", wdiff);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index a935a60..235503a 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -226,8 +226,9 @@ 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);
-s64 perf_diff__compute_wdiff(struct hist_entry *he);
+double perf_diff__compute_delta(struct hist_entry *he, struct hist_entry *pair);
+double perf_diff__compute_ratio(struct hist_entry *he, struct hist_entry *pair);
+s64 perf_diff__compute_wdiff(struct hist_entry *he, struct hist_entry *pair);
 int perf_diff__formula(char *buf, size_t size, struct hist_entry *he);
+double perf_diff__period_percent(struct hist_entry *he, u64 period);
 #endif	/* __PERF_HIST_H */
-- 
1.7.9.2.358.g22243


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

* [PATCH 17/37] perf diff: Change formula methods to work with pair directly
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (15 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 16/37] perf diff: Change compute methods to work with pair directly Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 18/37] perf tools: Don't check configuration on make tags Arnaldo Carvalho de Melo
                   ` (20 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

Changing formula methods to operate over hist entry and its pair
directly. This makes the code more obvious and readable, instead of all
time checking for pair being != NULL.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.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/1354110769-2998-7-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-diff.c |   35 +++++++++++++----------------------
 tools/perf/ui/hist.c      |    5 ++++-
 tools/perf/util/hist.h    |    3 ++-
 3 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 342085a..d869029 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -184,13 +184,9 @@ s64 perf_diff__compute_wdiff(struct hist_entry *he, struct hist_entry *pair)
 	return he->diff.wdiff;
 }
 
-static int formula_delta(struct hist_entry *he, char *buf, size_t size)
+static int formula_delta(struct hist_entry *he, struct hist_entry *pair,
+			 char *buf, size_t size)
 {
-	struct hist_entry *pair = hist_entry__next_pair(he);
-
-	if (!pair)
-		return -1;
-
 	return scnprintf(buf, size,
 			 "(%" PRIu64 " * 100 / %" PRIu64 ") - "
 			 "(%" PRIu64 " * 100 / %" PRIu64 ")",
@@ -198,41 +194,36 @@ static int formula_delta(struct hist_entry *he, char *buf, size_t size)
 			  pair->stat.period, pair->hists->stats.total_period);
 }
 
-static int formula_ratio(struct hist_entry *he, char *buf, size_t size)
+static int formula_ratio(struct hist_entry *he, struct hist_entry *pair,
+			 char *buf, size_t size)
 {
-	struct hist_entry *pair = hist_entry__next_pair(he);
 	double new_period = he->stat.period;
-	double old_period = pair ? pair->stat.period : 0;
-
-	if (!pair)
-		return -1;
+	double old_period = pair->stat.period;
 
 	return scnprintf(buf, size, "%.0F / %.0F", new_period, old_period);
 }
 
-static int formula_wdiff(struct hist_entry *he, char *buf, size_t size)
+static int formula_wdiff(struct hist_entry *he, struct hist_entry *pair,
+			 char *buf, size_t size)
 {
-	struct hist_entry *pair = hist_entry__next_pair(he);
 	u64 new_period = he->stat.period;
-	u64 old_period = pair ? pair->stat.period : 0;
-
-	if (!pair)
-		return -1;
+	u64 old_period = pair->stat.period;
 
 	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)
+int perf_diff__formula(struct hist_entry *he, struct hist_entry *pair,
+		       char *buf, size_t size)
 {
 	switch (compute) {
 	case COMPUTE_DELTA:
-		return formula_delta(he, buf, size);
+		return formula_delta(he, pair, buf, size);
 	case COMPUTE_RATIO:
-		return formula_ratio(he, buf, size);
+		return formula_ratio(he, pair, buf, size);
 	case COMPUTE_WEIGHTED_DIFF:
-		return formula_wdiff(he, buf, size);
+		return formula_wdiff(he, pair, buf, size);
 	default:
 		BUG_ON(1);
 	}
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 108e5ed..1785bab 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -389,10 +389,13 @@ static int hpp__width_formula(struct perf_hpp *hpp __maybe_unused)
 
 static int hpp__entry_formula(struct perf_hpp *hpp, struct hist_entry *he)
 {
+	struct hist_entry *pair = hist_entry__next_pair(he);
 	const char *fmt = symbol_conf.field_sep ? "%s" : "%-70s";
 	char buf[96] = " ";
 
-	perf_diff__formula(buf, sizeof(buf), he);
+	if (pair)
+		perf_diff__formula(he, pair, buf, sizeof(buf));
+
 	return scnprintf(hpp->buf, hpp->size, fmt, buf);
 }
 
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 235503a..c1b2fad 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -229,6 +229,7 @@ unsigned int hists__sort_list_width(struct hists *self);
 double perf_diff__compute_delta(struct hist_entry *he, struct hist_entry *pair);
 double perf_diff__compute_ratio(struct hist_entry *he, struct hist_entry *pair);
 s64 perf_diff__compute_wdiff(struct hist_entry *he, struct hist_entry *pair);
-int perf_diff__formula(char *buf, size_t size, struct hist_entry *he);
+int perf_diff__formula(struct hist_entry *he, struct hist_entry *pair,
+		       char *buf, size_t size);
 double perf_diff__period_percent(struct hist_entry *he, u64 period);
 #endif	/* __PERF_HIST_H */
-- 
1.7.9.2.358.g22243


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

* [PATCH 18/37] perf tools: Don't check configuration on make tags
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (16 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 17/37] perf diff: Change formula " Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 19/37] perf tools: Fix TUI helpline output Arnaldo Carvalho de Melo
                   ` (19 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

Doing the same thing done in:

  b059dee: perf tools: Don't check configuration on make clean

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-n2ni4riphpqxw7d6ziv1ndyc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/Makefile |    2 ++
 tools/perf/Makefile               |    4 ++++
 2 files changed, 6 insertions(+)

diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile
index f6e5901..eb30044 100644
--- a/tools/perf/Documentation/Makefile
+++ b/tools/perf/Documentation/Makefile
@@ -223,11 +223,13 @@ install-pdf: pdf
 #	'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
 
 ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(MAKECMDGOALS),tags)
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) $(OUTPUT)PERF-VERSION-FILE
 
 -include $(OUTPUT)PERF-VERSION-FILE
 endif
+endif
 
 #
 # Determine "include::" file references in asciidoc files.
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 08da9fc..2a07b95 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -154,6 +154,7 @@ INSTALL = install
 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 
 ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(MAKECMDGOALS),tags)
 -include config/feature-tests.mak
 
 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
@@ -207,6 +208,7 @@ ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
 	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
 	BASIC_CFLAGS += -I.
 endif
+endif # MAKECMDGOALS != tags
 endif # MAKECMDGOALS != clean
 
 # Guard against environment variables
@@ -525,6 +527,7 @@ PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT)
 # Platform specific tweaks
 #
 ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(MAKECMDGOALS),tags)
 
 # We choose to avoid "if .. else if .. else .. endif endif"
 # because maintaining the nesting to match is a pain.  If
@@ -841,6 +844,7 @@ ifdef ASCIIDOC8
 	export ASCIIDOC8
 endif
 
+endif # MAKECMDGOALS != tags
 endif # MAKECMDGOALS != clean
 
 # Shell quote (do not use $(call) to accommodate ancient setups);
-- 
1.7.9.2.358.g22243


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

* [PATCH 19/37] perf tools: Fix TUI helpline output
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (17 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 18/37] perf tools: Don't check configuration on make tags Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 20/37] perf buildid-list: We need to check if a file is ELF first Arnaldo Carvalho de Melo
                   ` (18 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

In commit e2f4351 "perf ui/helpline: Introduce ui_helpline__vshow()" the
test for the browser used made ui_helpline__vshow() to be called only
for the GTK browser.

The TUI one then was not used and vfprintf(stderr, ...) was used
instead, making the TUI scroll the screen instead of just printing on
the last line.

Fix it by doing the proper check, that is to call ui_helpline__vshow to
be called for both the TUI and GTK browsers.

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-iad0nw09x4orhmn0uzz4ljx3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/debug.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index 391c9a9..399e74c 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -23,7 +23,7 @@ int eprintf(int level, const char *fmt, ...)
 
 	if (verbose >= level) {
 		va_start(args, fmt);
-		if (use_browser > 1)
+		if (use_browser >= 1)
 			ui_helpline__vshow(fmt, args);
 		else
 			ret = vfprintf(stderr, fmt, args);
-- 
1.7.9.2.358.g22243


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

* [PATCH 20/37] perf buildid-list: We need to check if a file is ELF first
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (18 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 19/37] perf tools: Fix TUI helpline output Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 21/37] perf diff: Remove displacement output option Arnaldo Carvalho de Melo
                   ` (17 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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, Robert Richter, Stephane Eranian

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

I.e. before we try to use it as a perf.data file by calling
perf_session__new, otherwise we lose the feature that shows the
build id for the given ELF file, this one:

[root@sandy redhat-perfdata-mtech-15]# perf buildid-list -i /root/.debug/.build-id/97/54896de655b6ac088ec2bf5113b35c06f72709
9754896de655b6ac088ec2bf5113b35c06f72709
[root@sandy redhat-perfdata-mtech-15]# perf buildid-list -i /lib/libc-2.12.so
38adaeff4f7c21899b13b28c1a2e6c199ca4c744
[root@sandy redhat-perfdata-mtech-15]#

Regression introduced in:

efad1415 "perf report: Accept fifos as input 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: Robert Richter <robert.richter@amd.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-3ktgyg83fwpqyfpoj0t2ezp0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-buildid-list.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c
index a82d99f..4c770d2 100644
--- a/tools/perf/builtin-buildid-list.c
+++ b/tools/perf/builtin-buildid-list.c
@@ -49,18 +49,16 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
 	struct perf_session *session;
 
 	symbol__elf_init();
-
-	session = perf_session__new(input_name, O_RDONLY, force, false,
-				    &build_id__mark_dso_hit_ops);
-	if (session == NULL)
-		return -1;
-
 	/*
 	 * See if this is an ELF file first:
 	 */
-	if (filename__fprintf_build_id(session->filename, stdout))
+	if (filename__fprintf_build_id(input_name, stdout))
 		goto out;
 
+	session = perf_session__new(input_name, O_RDONLY, force, false,
+				    &build_id__mark_dso_hit_ops);
+	if (session == NULL)
+		return -1;
 	/*
 	 * in pipe-mode, the only way to get the buildids is to parse
 	 * the record stream. Buildids are stored as RECORD_HEADER_BUILD_ID
@@ -69,8 +67,8 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
 		perf_session__process_events(session, &build_id__mark_dso_hit_ops);
 
 	perf_session__fprintf_dsos_buildid(session, stdout, with_hits);
-out:
 	perf_session__delete(session);
+out:
 	return 0;
 }
 
-- 
1.7.9.2.358.g22243


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

* [PATCH 21/37] perf diff: Remove displacement output option
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (19 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 20/37] perf buildid-list: We need to check if a file is ELF first Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 22/37] perf symbols: Generalize filter in __fprintf_buildid methods Arnaldo Carvalho de Melo
                   ` (16 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Stephane Eranian, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@redhat.com>

It seems not very useful, because it's possible and event more convenient to
lookup related symbol by name. Also the output value for both 'baseline' and
'new' data is quite apparent from diff output.

And above all it complicates hist code factoring ;)

Ditching out PERF_HPP__DISPL column with related output functions.

Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20121206132228.GB1080@krava.brq.redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-diff.txt |    4 ----
 tools/perf/builtin-diff.c              |   29 +++++++----------------------
 tools/perf/ui/hist.c                   |   25 -------------------------
 tools/perf/util/hist.h                 |    1 -
 4 files changed, 7 insertions(+), 52 deletions(-)

diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index 194f37d..5b3123d 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -22,10 +22,6 @@ specified perf.data files.
 
 OPTIONS
 -------
--M::
---displacement::
-        Show position displacement relative to baseline.
-
 -D::
 --dump-raw-trace::
         Dump raw trace in ASCII.
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index d869029..b2e7d39 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -23,7 +23,6 @@ static char const *input_old = "perf.data.old",
 		  *input_new = "perf.data";
 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;
@@ -296,9 +295,8 @@ static void insert_hist_entry_by_name(struct rb_root *root,
 	rb_insert_color(&he->rb_node, root);
 }
 
-static void hists__name_resort(struct hists *self, bool sort)
+static void hists__name_resort(struct hists *self)
 {
-	unsigned long position = 1;
 	struct rb_root tmp = RB_ROOT;
 	struct rb_node *next = rb_first(&self->entries);
 
@@ -306,16 +304,12 @@ static void hists__name_resort(struct hists *self, bool sort)
 		struct hist_entry *n = rb_entry(next, struct hist_entry, rb_node);
 
 		next = rb_next(&n->rb_node);
-		n->position = position++;
 
-		if (sort) {
-			rb_erase(&n->rb_node, &self->entries);
-			insert_hist_entry_by_name(&tmp, n);
-		}
+		rb_erase(&n->rb_node, &self->entries);
+		insert_hist_entry_by_name(&tmp, n);
 	}
 
-	if (sort)
-		self->entries = tmp;
+	self->entries = tmp;
 }
 
 static struct perf_evsel *evsel_match(struct perf_evsel *evsel,
@@ -339,12 +333,8 @@ static void perf_evlist__resort_hists(struct perf_evlist *evlist, bool name)
 
 		hists__output_resort(hists);
 
-		/*
-		 * The hists__name_resort only sets possition
-		 * if name is false.
-		 */
-		if (name || ((!name) && show_displacement))
-			hists__name_resort(hists, name);
+		if (name)
+			hists__name_resort(hists);
 	}
 }
 
@@ -549,8 +539,6 @@ static const char * const diff_usage[] = {
 static const struct option options[] = {
 	OPT_INCR('v', "verbose", &verbose,
 		    "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_CALLBACK('c', "compute", &compute,
@@ -585,7 +573,7 @@ static const struct option options[] = {
 static void ui_init(void)
 {
 	/*
-	 * Display baseline/delta/ratio/displacement/
+	 * Display baseline/delta/ratio
 	 * formula/periods columns.
 	 */
 	perf_hpp__column_enable(PERF_HPP__BASELINE);
@@ -604,9 +592,6 @@ static void ui_init(void)
 		BUG_ON(1);
 	};
 
-	if (show_displacement)
-		perf_hpp__column_enable(PERF_HPP__DISPL);
-
 	if (show_formula)
 		perf_hpp__column_enable(PERF_HPP__FORMULA);
 
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 1785bab..1889c12 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -351,30 +351,6 @@ static int hpp__entry_wdiff(struct perf_hpp *hpp, struct hist_entry *he)
 	return scnprintf(hpp->buf, hpp->size, fmt, buf);
 }
 
-static int hpp__header_displ(struct perf_hpp *hpp)
-{
-	return scnprintf(hpp->buf, hpp->size, "Displ.");
-}
-
-static int hpp__width_displ(struct perf_hpp *hpp __maybe_unused)
-{
-	return 6;
-}
-
-static int hpp__entry_displ(struct perf_hpp *hpp,
-			    struct hist_entry *he)
-{
-	struct hist_entry *pair = hist_entry__next_pair(he);
-	long displacement = pair ? pair->position - he->position : 0;
-	const char *fmt = symbol_conf.field_sep ? "%s" : "%6.6s";
-	char buf[32] = " ";
-
-	if (displacement)
-		scnprintf(buf, sizeof(buf), "%+4ld", displacement);
-
-	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";
@@ -427,7 +403,6 @@ struct perf_hpp_fmt perf_hpp__format[] = {
 	HPP__PRINT_FNS(delta),
 	HPP__PRINT_FNS(ratio),
 	HPP__PRINT_FNS(wdiff),
-	HPP__PRINT_FNS(displ),
 	HPP__PRINT_FNS(formula)
 };
 
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index c1b2fad..5b3b007 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -154,7 +154,6 @@ enum {
 	PERF_HPP__DELTA,
 	PERF_HPP__RATIO,
 	PERF_HPP__WEIGHTED_DIFF,
-	PERF_HPP__DISPL,
 	PERF_HPP__FORMULA,
 
 	PERF_HPP__MAX_INDEX
-- 
1.7.9.2.358.g22243


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

* [PATCH 22/37] perf symbols: Generalize filter in __fprintf_buildid methods
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (20 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 21/37] perf diff: Remove displacement output option Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 23/37] perf buildid-cache: Add option to show build ids that are missing in the cache Arnaldo Carvalho de Melo
                   ` (15 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

We had that 'with_hits' filter to show just the build ids for DSOs that
had samples, make that generic so that we can use it in the upcoming
buildid-cache --missing feature, to show just the build ids that are not
in the cache.

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-9nfesdfpnx7zp96yn3tmfbx0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-buildid-list.c |    7 ++++++-
 tools/perf/util/dso.c             |    4 ++--
 tools/perf/util/dso.h             |    2 +-
 tools/perf/util/machine.h         |    8 ++++----
 tools/perf/util/session.c         |    6 +++---
 tools/perf/util/session.h         |    4 ++--
 tools/perf/util/symbol.c          |   12 ++++++------
 7 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c
index 4c770d2..e74366a 100644
--- a/tools/perf/builtin-buildid-list.c
+++ b/tools/perf/builtin-buildid-list.c
@@ -44,6 +44,11 @@ static int filename__fprintf_build_id(const char *name, FILE *fp)
 	return fprintf(fp, "%s\n", sbuild_id);
 }
 
+static bool dso__skip_buildid(struct dso *dso, int with_hits)
+{
+	return with_hits && !dso->hit;
+}
+
 static int perf_session__list_build_ids(bool force, bool with_hits)
 {
 	struct perf_session *session;
@@ -66,7 +71,7 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
 	if (with_hits || session->fd_pipe)
 		perf_session__process_events(session, &build_id__mark_dso_hit_ops);
 
-	perf_session__fprintf_dsos_buildid(session, stdout, with_hits);
+	perf_session__fprintf_dsos_buildid(session, stdout, dso__skip_buildid, with_hits);
 	perf_session__delete(session);
 out:
 	return 0;
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index be43785..6f7d5a9 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -539,13 +539,13 @@ struct dso *__dsos__findnew(struct list_head *head, const char *name)
 }
 
 size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp,
-			       bool with_hits)
+			       bool (skip)(struct dso *dso, int parm), int parm)
 {
 	struct dso *pos;
 	size_t ret = 0;
 
 	list_for_each_entry(pos, head, node) {
-		if (with_hits && !pos->hit)
+		if (skip && skip(pos, parm))
 			continue;
 		ret += dso__fprintf_buildid(pos, fp);
 		ret += fprintf(fp, " %s\n", pos->long_name);
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index e032769..450199a 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -138,7 +138,7 @@ struct dso *__dsos__findnew(struct list_head *head, const char *name);
 bool __dsos__read_build_ids(struct list_head *head, bool with_hits);
 
 size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp,
-			       bool with_hits);
+			       bool (skip)(struct dso *dso, int parm), int parm);
 size_t __dsos__fprintf(struct list_head *head, FILE *fp);
 
 size_t dso__fprintf_buildid(struct dso *dso, FILE *fp);
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
index b7cde74..646ad13 100644
--- a/tools/perf/util/machine.h
+++ b/tools/perf/util/machine.h
@@ -129,11 +129,11 @@ int machine__load_kallsyms(struct machine *machine, const char *filename,
 int machine__load_vmlinux_path(struct machine *machine, enum map_type type,
 			       symbol_filter_t filter);
 
-size_t machine__fprintf_dsos_buildid(struct machine *machine,
-				     FILE *fp, bool with_hits);
+size_t machine__fprintf_dsos_buildid(struct machine *machine, FILE *fp,
+				     bool (skip)(struct dso *dso, int parm), int parm);
 size_t machines__fprintf_dsos(struct rb_root *machines, FILE *fp);
-size_t machines__fprintf_dsos_buildid(struct rb_root *machines,
-				      FILE *fp, bool with_hits);
+size_t machines__fprintf_dsos_buildid(struct rb_root *machines, FILE *fp,
+				     bool (skip)(struct dso *dso, int parm), int parm);
 
 void machine__destroy_kernel_maps(struct machine *machine);
 int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel);
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index aa5e582..8d04dfb 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1552,10 +1552,10 @@ size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp)
 }
 
 size_t perf_session__fprintf_dsos_buildid(struct perf_session *self, FILE *fp,
-					  bool with_hits)
+					  bool (skip)(struct dso *dso, int parm), int parm)
 {
-	size_t ret = machine__fprintf_dsos_buildid(&self->host_machine, fp, with_hits);
-	return ret + machines__fprintf_dsos_buildid(&self->machines, fp, with_hits);
+	size_t ret = machine__fprintf_dsos_buildid(&self->host_machine, fp, skip, parm);
+	return ret + machines__fprintf_dsos_buildid(&self->machines, fp, skip, parm);
 }
 
 size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp)
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index c18fabd..8c23025 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -115,8 +115,8 @@ size_t perf_session__fprintf(struct perf_session *self, FILE *fp);
 
 size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp);
 
-size_t perf_session__fprintf_dsos_buildid(struct perf_session *self,
-					  FILE *fp, bool with_hits);
+size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp,
+					  bool (fn)(struct dso *dso, int parm), int parm);
 
 size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp);
 
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 295f8d4..e5ba984 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1315,21 +1315,21 @@ size_t machines__fprintf_dsos(struct rb_root *machines, FILE *fp)
 }
 
 size_t machine__fprintf_dsos_buildid(struct machine *machine, FILE *fp,
-				     bool with_hits)
+				     bool (skip)(struct dso *dso, int parm), int parm)
 {
-	return __dsos__fprintf_buildid(&machine->kernel_dsos, fp, with_hits) +
-	       __dsos__fprintf_buildid(&machine->user_dsos, fp, with_hits);
+	return __dsos__fprintf_buildid(&machine->kernel_dsos, fp, skip, parm) +
+	       __dsos__fprintf_buildid(&machine->user_dsos, fp, skip, parm);
 }
 
-size_t machines__fprintf_dsos_buildid(struct rb_root *machines,
-				      FILE *fp, bool with_hits)
+size_t machines__fprintf_dsos_buildid(struct rb_root *machines, FILE *fp,
+				     bool (skip)(struct dso *dso, int parm), int parm)
 {
 	struct rb_node *nd;
 	size_t ret = 0;
 
 	for (nd = rb_first(machines); nd; nd = rb_next(nd)) {
 		struct machine *pos = rb_entry(nd, struct machine, rb_node);
-		ret += machine__fprintf_dsos_buildid(pos, fp, with_hits);
+		ret += machine__fprintf_dsos_buildid(pos, fp, skip, parm);
 	}
 	return ret;
 }
-- 
1.7.9.2.358.g22243


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

* [PATCH 23/37] perf buildid-cache: Add option to show build ids that are missing in the cache
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (21 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 22/37] perf symbols: Generalize filter in __fprintf_buildid methods Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 24/37] perf machine: Move more machine methods to machine.c Arnaldo Carvalho de Melo
                   ` (14 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern, Frank Eigler,
	Frederic Weisbecker, Jiri Olsa, Kushal Das, Mark Wielaard,
	Mike Galbraith, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

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

This will allow to connect with services being put in place by distros such as
Fedora, where one can retrieve DSOs by their build-id.

Example usage:

	for buildid in $(perf buildid-cache --missing perf.data | cut -d' ' -f1) ; do
		echo "trying to get $buildid"
		wget -q https://darkserver.fedoraproject.org/buildids/$buildid
		cat $buildid ; echo
		rm -f $buildid
	done

Now its just a matter of some porcelain to get the details provided by such a
service, retrieve the file and use 'perf buildid-cache --add $FILE' to insert
it in the cache, then use 'perf report' or 'annotate' that will find the
required files in the cache.

More information about the darkserver service at:

	https://darkserver.fedoraproject.org/

Cc: David Ahern <dsahern@gmail.com>
Cc: Frank Eigler <fche@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kushal Das <kdas@redhat.com>
Cc: Mark Wielaard <mjw@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-6fuktuiyjn4jykxmt7c9f7xq@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-buildid-cache.txt |    3 ++
 tools/perf/builtin-buildid-cache.c              |   48 ++++++++++++++++++++++-
 2 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-buildid-cache.txt b/tools/perf/Documentation/perf-buildid-cache.txt
index c105770..8e798ba 100644
--- a/tools/perf/Documentation/perf-buildid-cache.txt
+++ b/tools/perf/Documentation/perf-buildid-cache.txt
@@ -24,6 +24,9 @@ OPTIONS
 -r::
 --remove=::
         Remove specified file from the cache.
+-M::
+--missing=:: 
+	List missing build ids in the cache for the specified file.
 -v::
 --verbose::
 	Be more verbose.
diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c
index fae8b25..a336014 100644
--- a/tools/perf/builtin-buildid-cache.c
+++ b/tools/perf/builtin-buildid-cache.c
@@ -14,6 +14,7 @@
 #include "util/parse-options.h"
 #include "util/strlist.h"
 #include "util/build-id.h"
+#include "util/session.h"
 #include "util/symbol.h"
 
 static int build_id_cache__add_file(const char *filename, const char *debugdir)
@@ -58,19 +59,59 @@ static int build_id_cache__remove_file(const char *filename,
 	return err;
 }
 
+static bool dso__missing_buildid_cache(struct dso *dso, int parm __maybe_unused)
+{
+	char filename[PATH_MAX];
+	u8 build_id[BUILD_ID_SIZE];
+
+	if (dso__build_id_filename(dso, filename, sizeof(filename)) &&
+	    filename__read_build_id(filename, build_id,
+				    sizeof(build_id)) != sizeof(build_id)) {
+		if (errno == ENOENT)
+			return false;
+
+		pr_warning("Problems with %s file, consider removing it from the cache\n", 
+			   filename);
+	} else if (memcmp(dso->build_id, build_id, sizeof(dso->build_id))) {
+		pr_warning("Problems with %s file, consider removing it from the cache\n", 
+			   filename);
+	}
+
+	return true;
+}
+
+static int build_id_cache__fprintf_missing(const char *filename, bool force, FILE *fp)
+{
+	struct perf_session *session = perf_session__new(filename, O_RDONLY,
+							 force, false, NULL);
+	if (session == NULL)
+		return -1;
+
+	perf_session__fprintf_dsos_buildid(session, fp, dso__missing_buildid_cache, 0);
+	perf_session__delete(session);
+
+	return 0;
+}
+
 int cmd_buildid_cache(int argc, const char **argv,
 		      const char *prefix __maybe_unused)
 {
 	struct strlist *list;
 	struct str_node *pos;
+	int ret = 0;
+	bool force = false;
 	char debugdir[PATH_MAX];
 	char const *add_name_list_str = NULL,
-		   *remove_name_list_str = NULL;
+		   *remove_name_list_str = NULL,
+		   *missing_filename = NULL;
 	const struct option buildid_cache_options[] = {
 	OPT_STRING('a', "add", &add_name_list_str,
 		   "file list", "file(s) to add"),
 	OPT_STRING('r', "remove", &remove_name_list_str, "file list",
 		    "file(s) to remove"),
+	OPT_STRING('M', "missing", &missing_filename, "file",
+		   "to find missing build ids in the cache"),
+	OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
 	OPT_INCR('v', "verbose", &verbose, "be more verbose"),
 	OPT_END()
 	};
@@ -125,5 +166,8 @@ int cmd_buildid_cache(int argc, const char **argv,
 		}
 	}
 
-	return 0;
+	if (missing_filename)
+		ret = build_id_cache__fprintf_missing(missing_filename, force, stdout);
+
+	return ret;
 }
-- 
1.7.9.2.358.g22243


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

* [PATCH 24/37] perf machine: Move more machine methods to machine.c
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (22 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 23/37] perf buildid-cache: Add option to show build ids that are missing in the cache Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 25/37] perf evsel: Update sample_size when setting sample_type bits Arnaldo Carvalho de Melo
                   ` (13 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

Mechanical, no functional changes.

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-9ib6qtqge1jmms2luwu4udbx@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/machine.c |  742 +++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/machine.h |    3 +-
 tools/perf/util/session.c |  210 -------------
 tools/perf/util/symbol.c  |  522 +------------------------------
 tools/perf/util/symbol.h  |    4 +
 tools/perf/util/thread.c  |   20 +-
 tools/perf/util/thread.h  |    1 +
 7 files changed, 756 insertions(+), 746 deletions(-)

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 1f09d05..71fa903 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1,10 +1,15 @@
+#include "callchain.h"
 #include "debug.h"
 #include "event.h"
+#include "evsel.h"
+#include "hist.h"
 #include "machine.h"
 #include "map.h"
+#include "sort.h"
 #include "strlist.h"
 #include "thread.h"
 #include <stdbool.h>
+#include "unwind.h"
 
 int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
 {
@@ -48,6 +53,29 @@ static void dsos__delete(struct list_head *dsos)
 	}
 }
 
+void machine__delete_dead_threads(struct machine *machine)
+{
+	struct thread *n, *t;
+
+	list_for_each_entry_safe(t, n, &machine->dead_threads, node) {
+		list_del(&t->node);
+		thread__delete(t);
+	}
+}
+
+void machine__delete_threads(struct machine *machine)
+{
+	struct rb_node *nd = rb_first(&machine->threads);
+
+	while (nd) {
+		struct thread *t = rb_entry(nd, struct thread, rb_node);
+
+		rb_erase(&t->rb_node, &machine->threads);
+		nd = rb_next(nd);
+		thread__delete(t);
+	}
+}
+
 void machine__exit(struct machine *machine)
 {
 	map_groups__exit(&machine->kmaps);
@@ -264,6 +292,534 @@ int machine__process_lost_event(struct machine *machine __maybe_unused,
 	return 0;
 }
 
+struct map *machine__new_module(struct machine *machine, u64 start,
+				const char *filename)
+{
+	struct map *map;
+	struct dso *dso = __dsos__findnew(&machine->kernel_dsos, filename);
+
+	if (dso == NULL)
+		return NULL;
+
+	map = map__new2(start, dso, MAP__FUNCTION);
+	if (map == NULL)
+		return NULL;
+
+	if (machine__is_host(machine))
+		dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE;
+	else
+		dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE;
+	map_groups__insert(&machine->kmaps, map);
+	return map;
+}
+
+size_t machines__fprintf_dsos(struct rb_root *machines, FILE *fp)
+{
+	struct rb_node *nd;
+	size_t ret = 0;
+
+	for (nd = rb_first(machines); nd; nd = rb_next(nd)) {
+		struct machine *pos = rb_entry(nd, struct machine, rb_node);
+		ret += __dsos__fprintf(&pos->kernel_dsos, fp);
+		ret += __dsos__fprintf(&pos->user_dsos, fp);
+	}
+
+	return ret;
+}
+
+size_t machine__fprintf_dsos_buildid(struct machine *machine, FILE *fp,
+				     bool (skip)(struct dso *dso, int parm), int parm)
+{
+	return __dsos__fprintf_buildid(&machine->kernel_dsos, fp, skip, parm) +
+	       __dsos__fprintf_buildid(&machine->user_dsos, fp, skip, parm);
+}
+
+size_t machines__fprintf_dsos_buildid(struct rb_root *machines, FILE *fp,
+				     bool (skip)(struct dso *dso, int parm), int parm)
+{
+	struct rb_node *nd;
+	size_t ret = 0;
+
+	for (nd = rb_first(machines); nd; nd = rb_next(nd)) {
+		struct machine *pos = rb_entry(nd, struct machine, rb_node);
+		ret += machine__fprintf_dsos_buildid(pos, fp, skip, parm);
+	}
+	return ret;
+}
+
+size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp)
+{
+	int i;
+	size_t printed = 0;
+	struct dso *kdso = machine->vmlinux_maps[MAP__FUNCTION]->dso;
+
+	if (kdso->has_build_id) {
+		char filename[PATH_MAX];
+		if (dso__build_id_filename(kdso, filename, sizeof(filename)))
+			printed += fprintf(fp, "[0] %s\n", filename);
+	}
+
+	for (i = 0; i < vmlinux_path__nr_entries; ++i)
+		printed += fprintf(fp, "[%d] %s\n",
+				   i + kdso->has_build_id, vmlinux_path[i]);
+
+	return printed;
+}
+
+size_t machine__fprintf(struct machine *machine, FILE *fp)
+{
+	size_t ret = 0;
+	struct rb_node *nd;
+
+	for (nd = rb_first(&machine->threads); nd; nd = rb_next(nd)) {
+		struct thread *pos = rb_entry(nd, struct thread, rb_node);
+
+		ret += thread__fprintf(pos, fp);
+	}
+
+	return ret;
+}
+
+static struct dso *machine__get_kernel(struct machine *machine)
+{
+	const char *vmlinux_name = NULL;
+	struct dso *kernel;
+
+	if (machine__is_host(machine)) {
+		vmlinux_name = symbol_conf.vmlinux_name;
+		if (!vmlinux_name)
+			vmlinux_name = "[kernel.kallsyms]";
+
+		kernel = dso__kernel_findnew(machine, vmlinux_name,
+					     "[kernel]",
+					     DSO_TYPE_KERNEL);
+	} else {
+		char bf[PATH_MAX];
+
+		if (machine__is_default_guest(machine))
+			vmlinux_name = symbol_conf.default_guest_vmlinux_name;
+		if (!vmlinux_name)
+			vmlinux_name = machine__mmap_name(machine, bf,
+							  sizeof(bf));
+
+		kernel = dso__kernel_findnew(machine, vmlinux_name,
+					     "[guest.kernel]",
+					     DSO_TYPE_GUEST_KERNEL);
+	}
+
+	if (kernel != NULL && (!kernel->has_build_id))
+		dso__read_running_kernel_build_id(kernel, machine);
+
+	return kernel;
+}
+
+struct process_args {
+	u64 start;
+};
+
+static int symbol__in_kernel(void *arg, const char *name,
+			     char type __maybe_unused, u64 start)
+{
+	struct process_args *args = arg;
+
+	if (strchr(name, '['))
+		return 0;
+
+	args->start = start;
+	return 1;
+}
+
+/* Figure out the start address of kernel map from /proc/kallsyms */
+static u64 machine__get_kernel_start_addr(struct machine *machine)
+{
+	const char *filename;
+	char path[PATH_MAX];
+	struct process_args args;
+
+	if (machine__is_host(machine)) {
+		filename = "/proc/kallsyms";
+	} else {
+		if (machine__is_default_guest(machine))
+			filename = (char *)symbol_conf.default_guest_kallsyms;
+		else {
+			sprintf(path, "%s/proc/kallsyms", machine->root_dir);
+			filename = path;
+		}
+	}
+
+	if (symbol__restricted_filename(filename, "/proc/kallsyms"))
+		return 0;
+
+	if (kallsyms__parse(filename, &args, symbol__in_kernel) <= 0)
+		return 0;
+
+	return args.start;
+}
+
+int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel)
+{
+	enum map_type type;
+	u64 start = machine__get_kernel_start_addr(machine);
+
+	for (type = 0; type < MAP__NR_TYPES; ++type) {
+		struct kmap *kmap;
+
+		machine->vmlinux_maps[type] = map__new2(start, kernel, type);
+		if (machine->vmlinux_maps[type] == NULL)
+			return -1;
+
+		machine->vmlinux_maps[type]->map_ip =
+			machine->vmlinux_maps[type]->unmap_ip =
+				identity__map_ip;
+		kmap = map__kmap(machine->vmlinux_maps[type]);
+		kmap->kmaps = &machine->kmaps;
+		map_groups__insert(&machine->kmaps,
+				   machine->vmlinux_maps[type]);
+	}
+
+	return 0;
+}
+
+void machine__destroy_kernel_maps(struct machine *machine)
+{
+	enum map_type type;
+
+	for (type = 0; type < MAP__NR_TYPES; ++type) {
+		struct kmap *kmap;
+
+		if (machine->vmlinux_maps[type] == NULL)
+			continue;
+
+		kmap = map__kmap(machine->vmlinux_maps[type]);
+		map_groups__remove(&machine->kmaps,
+				   machine->vmlinux_maps[type]);
+		if (kmap->ref_reloc_sym) {
+			/*
+			 * ref_reloc_sym is shared among all maps, so free just
+			 * on one of them.
+			 */
+			if (type == MAP__FUNCTION) {
+				free((char *)kmap->ref_reloc_sym->name);
+				kmap->ref_reloc_sym->name = NULL;
+				free(kmap->ref_reloc_sym);
+			}
+			kmap->ref_reloc_sym = NULL;
+		}
+
+		map__delete(machine->vmlinux_maps[type]);
+		machine->vmlinux_maps[type] = NULL;
+	}
+}
+
+int machines__create_guest_kernel_maps(struct rb_root *machines)
+{
+	int ret = 0;
+	struct dirent **namelist = NULL;
+	int i, items = 0;
+	char path[PATH_MAX];
+	pid_t pid;
+	char *endp;
+
+	if (symbol_conf.default_guest_vmlinux_name ||
+	    symbol_conf.default_guest_modules ||
+	    symbol_conf.default_guest_kallsyms) {
+		machines__create_kernel_maps(machines, DEFAULT_GUEST_KERNEL_ID);
+	}
+
+	if (symbol_conf.guestmount) {
+		items = scandir(symbol_conf.guestmount, &namelist, NULL, NULL);
+		if (items <= 0)
+			return -ENOENT;
+		for (i = 0; i < items; i++) {
+			if (!isdigit(namelist[i]->d_name[0])) {
+				/* Filter out . and .. */
+				continue;
+			}
+			pid = (pid_t)strtol(namelist[i]->d_name, &endp, 10);
+			if ((*endp != '\0') ||
+			    (endp == namelist[i]->d_name) ||
+			    (errno == ERANGE)) {
+				pr_debug("invalid directory (%s). Skipping.\n",
+					 namelist[i]->d_name);
+				continue;
+			}
+			sprintf(path, "%s/%s/proc/kallsyms",
+				symbol_conf.guestmount,
+				namelist[i]->d_name);
+			ret = access(path, R_OK);
+			if (ret) {
+				pr_debug("Can't access file %s\n", path);
+				goto failure;
+			}
+			machines__create_kernel_maps(machines, pid);
+		}
+failure:
+		free(namelist);
+	}
+
+	return ret;
+}
+
+void machines__destroy_guest_kernel_maps(struct rb_root *machines)
+{
+	struct rb_node *next = rb_first(machines);
+
+	while (next) {
+		struct machine *pos = rb_entry(next, struct machine, rb_node);
+
+		next = rb_next(&pos->rb_node);
+		rb_erase(&pos->rb_node, machines);
+		machine__delete(pos);
+	}
+}
+
+int machines__create_kernel_maps(struct rb_root *machines, pid_t pid)
+{
+	struct machine *machine = machines__findnew(machines, pid);
+
+	if (machine == NULL)
+		return -1;
+
+	return machine__create_kernel_maps(machine);
+}
+
+int machine__load_kallsyms(struct machine *machine, const char *filename,
+			   enum map_type type, symbol_filter_t filter)
+{
+	struct map *map = machine->vmlinux_maps[type];
+	int ret = dso__load_kallsyms(map->dso, filename, map, filter);
+
+	if (ret > 0) {
+		dso__set_loaded(map->dso, type);
+		/*
+		 * Since /proc/kallsyms will have multiple sessions for the
+		 * kernel, with modules between them, fixup the end of all
+		 * sections.
+		 */
+		__map_groups__fixup_end(&machine->kmaps, type);
+	}
+
+	return ret;
+}
+
+int machine__load_vmlinux_path(struct machine *machine, enum map_type type,
+			       symbol_filter_t filter)
+{
+	struct map *map = machine->vmlinux_maps[type];
+	int ret = dso__load_vmlinux_path(map->dso, map, filter);
+
+	if (ret > 0) {
+		dso__set_loaded(map->dso, type);
+		map__reloc_vmlinux(map);
+	}
+
+	return ret;
+}
+
+static void map_groups__fixup_end(struct map_groups *mg)
+{
+	int i;
+	for (i = 0; i < MAP__NR_TYPES; ++i)
+		__map_groups__fixup_end(mg, i);
+}
+
+static char *get_kernel_version(const char *root_dir)
+{
+	char version[PATH_MAX];
+	FILE *file;
+	char *name, *tmp;
+	const char *prefix = "Linux version ";
+
+	sprintf(version, "%s/proc/version", root_dir);
+	file = fopen(version, "r");
+	if (!file)
+		return NULL;
+
+	version[0] = '\0';
+	tmp = fgets(version, sizeof(version), file);
+	fclose(file);
+
+	name = strstr(version, prefix);
+	if (!name)
+		return NULL;
+	name += strlen(prefix);
+	tmp = strchr(name, ' ');
+	if (tmp)
+		*tmp = '\0';
+
+	return strdup(name);
+}
+
+static int map_groups__set_modules_path_dir(struct map_groups *mg,
+				const char *dir_name)
+{
+	struct dirent *dent;
+	DIR *dir = opendir(dir_name);
+	int ret = 0;
+
+	if (!dir) {
+		pr_debug("%s: cannot open %s dir\n", __func__, dir_name);
+		return -1;
+	}
+
+	while ((dent = readdir(dir)) != NULL) {
+		char path[PATH_MAX];
+		struct stat st;
+
+		/*sshfs might return bad dent->d_type, so we have to stat*/
+		snprintf(path, sizeof(path), "%s/%s", dir_name, dent->d_name);
+		if (stat(path, &st))
+			continue;
+
+		if (S_ISDIR(st.st_mode)) {
+			if (!strcmp(dent->d_name, ".") ||
+			    !strcmp(dent->d_name, ".."))
+				continue;
+
+			ret = map_groups__set_modules_path_dir(mg, path);
+			if (ret < 0)
+				goto out;
+		} else {
+			char *dot = strrchr(dent->d_name, '.'),
+			     dso_name[PATH_MAX];
+			struct map *map;
+			char *long_name;
+
+			if (dot == NULL || strcmp(dot, ".ko"))
+				continue;
+			snprintf(dso_name, sizeof(dso_name), "[%.*s]",
+				 (int)(dot - dent->d_name), dent->d_name);
+
+			strxfrchar(dso_name, '-', '_');
+			map = map_groups__find_by_name(mg, MAP__FUNCTION,
+						       dso_name);
+			if (map == NULL)
+				continue;
+
+			long_name = strdup(path);
+			if (long_name == NULL) {
+				ret = -1;
+				goto out;
+			}
+			dso__set_long_name(map->dso, long_name);
+			map->dso->lname_alloc = 1;
+			dso__kernel_module_get_build_id(map->dso, "");
+		}
+	}
+
+out:
+	closedir(dir);
+	return ret;
+}
+
+static int machine__set_modules_path(struct machine *machine)
+{
+	char *version;
+	char modules_path[PATH_MAX];
+
+	version = get_kernel_version(machine->root_dir);
+	if (!version)
+		return -1;
+
+	snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel",
+		 machine->root_dir, version);
+	free(version);
+
+	return map_groups__set_modules_path_dir(&machine->kmaps, modules_path);
+}
+
+static int machine__create_modules(struct machine *machine)
+{
+	char *line = NULL;
+	size_t n;
+	FILE *file;
+	struct map *map;
+	const char *modules;
+	char path[PATH_MAX];
+
+	if (machine__is_default_guest(machine))
+		modules = symbol_conf.default_guest_modules;
+	else {
+		sprintf(path, "%s/proc/modules", machine->root_dir);
+		modules = path;
+	}
+
+	if (symbol__restricted_filename(path, "/proc/modules"))
+		return -1;
+
+	file = fopen(modules, "r");
+	if (file == NULL)
+		return -1;
+
+	while (!feof(file)) {
+		char name[PATH_MAX];
+		u64 start;
+		char *sep;
+		int line_len;
+
+		line_len = getline(&line, &n, file);
+		if (line_len < 0)
+			break;
+
+		if (!line)
+			goto out_failure;
+
+		line[--line_len] = '\0'; /* \n */
+
+		sep = strrchr(line, 'x');
+		if (sep == NULL)
+			continue;
+
+		hex2u64(sep + 1, &start);
+
+		sep = strchr(line, ' ');
+		if (sep == NULL)
+			continue;
+
+		*sep = '\0';
+
+		snprintf(name, sizeof(name), "[%s]", line);
+		map = machine__new_module(machine, start, name);
+		if (map == NULL)
+			goto out_delete_line;
+		dso__kernel_module_get_build_id(map->dso, machine->root_dir);
+	}
+
+	free(line);
+	fclose(file);
+
+	return machine__set_modules_path(machine);
+
+out_delete_line:
+	free(line);
+out_failure:
+	return -1;
+}
+
+int machine__create_kernel_maps(struct machine *machine)
+{
+	struct dso *kernel = machine__get_kernel(machine);
+
+	if (kernel == NULL ||
+	    __machine__create_kernel_maps(machine, kernel) < 0)
+		return -1;
+
+	if (symbol_conf.use_modules && machine__create_modules(machine) < 0) {
+		if (machine__is_host(machine))
+			pr_debug("Problems creating module maps, "
+				 "continuing anyway...\n");
+		else
+			pr_debug("Problems creating module maps for guest %d, "
+				 "continuing anyway...\n", machine->pid);
+	}
+
+	/*
+	 * Now that we have all the maps created, just set the ->end of them:
+	 */
+	map_groups__fixup_end(&machine->kmaps);
+	return 0;
+}
+
 static void machine__set_kernel_mmap_len(struct machine *machine,
 					 union perf_event *event)
 {
@@ -462,3 +1018,189 @@ int machine__process_event(struct machine *machine, union perf_event *event)
 
 	return ret;
 }
+
+void machine__remove_thread(struct machine *machine, struct thread *th)
+{
+	machine->last_match = NULL;
+	rb_erase(&th->rb_node, &machine->threads);
+	/*
+	 * We may have references to this thread, for instance in some hist_entry
+	 * instances, so just move them to a separate list.
+	 */
+	list_add_tail(&th->node, &machine->dead_threads);
+}
+
+static bool symbol__match_parent_regex(struct symbol *sym)
+{
+	if (sym->name && !regexec(&parent_regex, sym->name, 0, NULL, 0))
+		return 1;
+
+	return 0;
+}
+
+static const u8 cpumodes[] = {
+	PERF_RECORD_MISC_USER,
+	PERF_RECORD_MISC_KERNEL,
+	PERF_RECORD_MISC_GUEST_USER,
+	PERF_RECORD_MISC_GUEST_KERNEL
+};
+#define NCPUMODES (sizeof(cpumodes)/sizeof(u8))
+
+static void ip__resolve_ams(struct machine *machine, struct thread *thread,
+			    struct addr_map_symbol *ams,
+			    u64 ip)
+{
+	struct addr_location al;
+	size_t i;
+	u8 m;
+
+	memset(&al, 0, sizeof(al));
+
+	for (i = 0; i < NCPUMODES; i++) {
+		m = cpumodes[i];
+		/*
+		 * We cannot use the header.misc hint to determine whether a
+		 * branch stack address is user, kernel, guest, hypervisor.
+		 * Branches may straddle the kernel/user/hypervisor boundaries.
+		 * Thus, we have to try consecutively until we find a match
+		 * or else, the symbol is unknown
+		 */
+		thread__find_addr_location(thread, machine, m, MAP__FUNCTION,
+				ip, &al, NULL);
+		if (al.sym)
+			goto found;
+	}
+found:
+	ams->addr = ip;
+	ams->al_addr = al.addr;
+	ams->sym = al.sym;
+	ams->map = al.map;
+}
+
+struct branch_info *machine__resolve_bstack(struct machine *machine,
+					    struct thread *thr,
+					    struct branch_stack *bs)
+{
+	struct branch_info *bi;
+	unsigned int i;
+
+	bi = calloc(bs->nr, sizeof(struct branch_info));
+	if (!bi)
+		return NULL;
+
+	for (i = 0; i < bs->nr; i++) {
+		ip__resolve_ams(machine, thr, &bi[i].to, bs->entries[i].to);
+		ip__resolve_ams(machine, thr, &bi[i].from, bs->entries[i].from);
+		bi[i].flags = bs->entries[i].flags;
+	}
+	return bi;
+}
+
+static int machine__resolve_callchain_sample(struct machine *machine,
+					     struct thread *thread,
+					     struct ip_callchain *chain,
+					     struct symbol **parent)
+
+{
+	u8 cpumode = PERF_RECORD_MISC_USER;
+	unsigned int i;
+	int err;
+
+	callchain_cursor_reset(&callchain_cursor);
+
+	if (chain->nr > PERF_MAX_STACK_DEPTH) {
+		pr_warning("corrupted callchain. skipping...\n");
+		return 0;
+	}
+
+	for (i = 0; i < chain->nr; i++) {
+		u64 ip;
+		struct addr_location al;
+
+		if (callchain_param.order == ORDER_CALLEE)
+			ip = chain->ips[i];
+		else
+			ip = chain->ips[chain->nr - i - 1];
+
+		if (ip >= PERF_CONTEXT_MAX) {
+			switch (ip) {
+			case PERF_CONTEXT_HV:
+				cpumode = PERF_RECORD_MISC_HYPERVISOR;
+				break;
+			case PERF_CONTEXT_KERNEL:
+				cpumode = PERF_RECORD_MISC_KERNEL;
+				break;
+			case PERF_CONTEXT_USER:
+				cpumode = PERF_RECORD_MISC_USER;
+				break;
+			default:
+				pr_debug("invalid callchain context: "
+					 "%"PRId64"\n", (s64) ip);
+				/*
+				 * It seems the callchain is corrupted.
+				 * Discard all.
+				 */
+				callchain_cursor_reset(&callchain_cursor);
+				return 0;
+			}
+			continue;
+		}
+
+		al.filtered = false;
+		thread__find_addr_location(thread, machine, cpumode,
+					   MAP__FUNCTION, ip, &al, NULL);
+		if (al.sym != NULL) {
+			if (sort__has_parent && !*parent &&
+			    symbol__match_parent_regex(al.sym))
+				*parent = al.sym;
+			if (!symbol_conf.use_callchain)
+				break;
+		}
+
+		err = callchain_cursor_append(&callchain_cursor,
+					      ip, al.map, al.sym);
+		if (err)
+			return err;
+	}
+
+	return 0;
+}
+
+static int unwind_entry(struct unwind_entry *entry, void *arg)
+{
+	struct callchain_cursor *cursor = arg;
+	return callchain_cursor_append(cursor, entry->ip,
+				       entry->map, entry->sym);
+}
+
+int machine__resolve_callchain(struct machine *machine,
+			       struct perf_evsel *evsel,
+			       struct thread *thread,
+			       struct perf_sample *sample,
+			       struct symbol **parent)
+
+{
+	int ret;
+
+	callchain_cursor_reset(&callchain_cursor);
+
+	ret = machine__resolve_callchain_sample(machine, thread,
+						sample->callchain, parent);
+	if (ret)
+		return ret;
+
+	/* Can we do dwarf post unwind? */
+	if (!((evsel->attr.sample_type & PERF_SAMPLE_REGS_USER) &&
+	      (evsel->attr.sample_type & PERF_SAMPLE_STACK_USER)))
+		return 0;
+
+	/* Bail out if nothing was captured. */
+	if ((!sample->user_regs.regs) ||
+	    (!sample->user_stack.size))
+		return 0;
+
+	return unwind__get_entries(unwind_entry, &callchain_cursor, machine,
+				   thread, evsel->attr.sample_regs_user,
+				   sample);
+
+}
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h
index 646ad13..e112368 100644
--- a/tools/perf/util/machine.h
+++ b/tools/perf/util/machine.h
@@ -61,9 +61,10 @@ char *machine__mmap_name(struct machine *machine, char *bf, size_t size);
 
 int machine__init(struct machine *machine, const char *root_dir, pid_t pid);
 void machine__exit(struct machine *machine);
+void machine__delete_dead_threads(struct machine *machine);
+void machine__delete_threads(struct machine *machine);
 void machine__delete(struct machine *machine);
 
-
 struct branch_info *machine__resolve_bstack(struct machine *machine,
 					    struct thread *thread,
 					    struct branch_stack *bs);
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 8d04dfb..76d6e25 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -16,7 +16,6 @@
 #include "cpumap.h"
 #include "event-parse.h"
 #include "perf_regs.h"
-#include "unwind.h"
 #include "vdso.h"
 
 static int perf_session__open(struct perf_session *self, bool force)
@@ -162,34 +161,11 @@ out_delete:
 	return NULL;
 }
 
-static void machine__delete_dead_threads(struct machine *machine)
-{
-	struct thread *n, *t;
-
-	list_for_each_entry_safe(t, n, &machine->dead_threads, node) {
-		list_del(&t->node);
-		thread__delete(t);
-	}
-}
-
 static void perf_session__delete_dead_threads(struct perf_session *session)
 {
 	machine__delete_dead_threads(&session->host_machine);
 }
 
-static void machine__delete_threads(struct machine *self)
-{
-	struct rb_node *nd = rb_first(&self->threads);
-
-	while (nd) {
-		struct thread *t = rb_entry(nd, struct thread, rb_node);
-
-		rb_erase(&t->rb_node, &self->threads);
-		nd = rb_next(nd);
-		thread__delete(t);
-	}
-}
-
 static void perf_session__delete_threads(struct perf_session *session)
 {
 	machine__delete_threads(&session->host_machine);
@@ -223,192 +199,6 @@ void perf_session__delete(struct perf_session *self)
 	vdso__exit();
 }
 
-void machine__remove_thread(struct machine *self, struct thread *th)
-{
-	self->last_match = NULL;
-	rb_erase(&th->rb_node, &self->threads);
-	/*
-	 * We may have references to this thread, for instance in some hist_entry
-	 * instances, so just move them to a separate list.
-	 */
-	list_add_tail(&th->node, &self->dead_threads);
-}
-
-static bool symbol__match_parent_regex(struct symbol *sym)
-{
-	if (sym->name && !regexec(&parent_regex, sym->name, 0, NULL, 0))
-		return 1;
-
-	return 0;
-}
-
-static const u8 cpumodes[] = {
-	PERF_RECORD_MISC_USER,
-	PERF_RECORD_MISC_KERNEL,
-	PERF_RECORD_MISC_GUEST_USER,
-	PERF_RECORD_MISC_GUEST_KERNEL
-};
-#define NCPUMODES (sizeof(cpumodes)/sizeof(u8))
-
-static void ip__resolve_ams(struct machine *self, struct thread *thread,
-			    struct addr_map_symbol *ams,
-			    u64 ip)
-{
-	struct addr_location al;
-	size_t i;
-	u8 m;
-
-	memset(&al, 0, sizeof(al));
-
-	for (i = 0; i < NCPUMODES; i++) {
-		m = cpumodes[i];
-		/*
-		 * We cannot use the header.misc hint to determine whether a
-		 * branch stack address is user, kernel, guest, hypervisor.
-		 * Branches may straddle the kernel/user/hypervisor boundaries.
-		 * Thus, we have to try consecutively until we find a match
-		 * or else, the symbol is unknown
-		 */
-		thread__find_addr_location(thread, self, m, MAP__FUNCTION,
-				ip, &al, NULL);
-		if (al.sym)
-			goto found;
-	}
-found:
-	ams->addr = ip;
-	ams->al_addr = al.addr;
-	ams->sym = al.sym;
-	ams->map = al.map;
-}
-
-struct branch_info *machine__resolve_bstack(struct machine *self,
-					    struct thread *thr,
-					    struct branch_stack *bs)
-{
-	struct branch_info *bi;
-	unsigned int i;
-
-	bi = calloc(bs->nr, sizeof(struct branch_info));
-	if (!bi)
-		return NULL;
-
-	for (i = 0; i < bs->nr; i++) {
-		ip__resolve_ams(self, thr, &bi[i].to, bs->entries[i].to);
-		ip__resolve_ams(self, thr, &bi[i].from, bs->entries[i].from);
-		bi[i].flags = bs->entries[i].flags;
-	}
-	return bi;
-}
-
-static int machine__resolve_callchain_sample(struct machine *machine,
-					     struct thread *thread,
-					     struct ip_callchain *chain,
-					     struct symbol **parent)
-
-{
-	u8 cpumode = PERF_RECORD_MISC_USER;
-	unsigned int i;
-	int err;
-
-	callchain_cursor_reset(&callchain_cursor);
-
-	if (chain->nr > PERF_MAX_STACK_DEPTH) {
-		pr_warning("corrupted callchain. skipping...\n");
-		return 0;
-	}
-
-	for (i = 0; i < chain->nr; i++) {
-		u64 ip;
-		struct addr_location al;
-
-		if (callchain_param.order == ORDER_CALLEE)
-			ip = chain->ips[i];
-		else
-			ip = chain->ips[chain->nr - i - 1];
-
-		if (ip >= PERF_CONTEXT_MAX) {
-			switch (ip) {
-			case PERF_CONTEXT_HV:
-				cpumode = PERF_RECORD_MISC_HYPERVISOR;
-				break;
-			case PERF_CONTEXT_KERNEL:
-				cpumode = PERF_RECORD_MISC_KERNEL;
-				break;
-			case PERF_CONTEXT_USER:
-				cpumode = PERF_RECORD_MISC_USER;
-				break;
-			default:
-				pr_debug("invalid callchain context: "
-					 "%"PRId64"\n", (s64) ip);
-				/*
-				 * It seems the callchain is corrupted.
-				 * Discard all.
-				 */
-				callchain_cursor_reset(&callchain_cursor);
-				return 0;
-			}
-			continue;
-		}
-
-		al.filtered = false;
-		thread__find_addr_location(thread, machine, cpumode,
-					   MAP__FUNCTION, ip, &al, NULL);
-		if (al.sym != NULL) {
-			if (sort__has_parent && !*parent &&
-			    symbol__match_parent_regex(al.sym))
-				*parent = al.sym;
-			if (!symbol_conf.use_callchain)
-				break;
-		}
-
-		err = callchain_cursor_append(&callchain_cursor,
-					      ip, al.map, al.sym);
-		if (err)
-			return err;
-	}
-
-	return 0;
-}
-
-static int unwind_entry(struct unwind_entry *entry, void *arg)
-{
-	struct callchain_cursor *cursor = arg;
-	return callchain_cursor_append(cursor, entry->ip,
-				       entry->map, entry->sym);
-}
-
-int machine__resolve_callchain(struct machine *machine,
-			       struct perf_evsel *evsel,
-			       struct thread *thread,
-			       struct perf_sample *sample,
-			       struct symbol **parent)
-
-{
-	int ret;
-
-	callchain_cursor_reset(&callchain_cursor);
-
-	ret = machine__resolve_callchain_sample(machine, thread,
-						sample->callchain, parent);
-	if (ret)
-		return ret;
-
-	/* Can we do dwarf post unwind? */
-	if (!((evsel->attr.sample_type & PERF_SAMPLE_REGS_USER) &&
-	      (evsel->attr.sample_type & PERF_SAMPLE_STACK_USER)))
-		return 0;
-
-	/* Bail out if nothing was captured. */
-	if ((!sample->user_regs.regs) ||
-	    (!sample->user_stack.size))
-		return 0;
-
-	return unwind__get_entries(unwind_entry, &callchain_cursor, machine,
-				   thread, evsel->attr.sample_regs_user,
-				   sample);
-
-}
-
 static int process_event_synth_tracing_data_stub(union perf_event *event
 						 __maybe_unused,
 						 struct perf_session *session
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index e5ba984..2960284 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -28,8 +28,8 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map,
 				symbol_filter_t filter);
 static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map,
 			symbol_filter_t filter);
-static int vmlinux_path__nr_entries;
-static char **vmlinux_path;
+int vmlinux_path__nr_entries;
+char **vmlinux_path;
 
 struct symbol_conf symbol_conf = {
 	.exclude_other	  = true,
@@ -202,13 +202,6 @@ void __map_groups__fixup_end(struct map_groups *mg, enum map_type type)
 	curr->end = ~0ULL;
 }
 
-static void map_groups__fixup_end(struct map_groups *mg)
-{
-	int i;
-	for (i = 0; i < MAP__NR_TYPES; ++i)
-		__map_groups__fixup_end(mg, i);
-}
-
 struct symbol *symbol__new(u64 start, u64 len, u8 binding, const char *name)
 {
 	size_t namelen = strlen(name) + 1;
@@ -652,8 +645,8 @@ discard_symbol:		rb_erase(&pos->rb_node, root);
 	return count + moved;
 }
 
-static bool symbol__restricted_filename(const char *filename,
-					const char *restricted_filename)
+bool symbol__restricted_filename(const char *filename,
+				 const char *restricted_filename)
 {
 	bool restricted = false;
 
@@ -887,200 +880,6 @@ struct map *map_groups__find_by_name(struct map_groups *mg,
 	return NULL;
 }
 
-static int map_groups__set_modules_path_dir(struct map_groups *mg,
-				const char *dir_name)
-{
-	struct dirent *dent;
-	DIR *dir = opendir(dir_name);
-	int ret = 0;
-
-	if (!dir) {
-		pr_debug("%s: cannot open %s dir\n", __func__, dir_name);
-		return -1;
-	}
-
-	while ((dent = readdir(dir)) != NULL) {
-		char path[PATH_MAX];
-		struct stat st;
-
-		/*sshfs might return bad dent->d_type, so we have to stat*/
-		snprintf(path, sizeof(path), "%s/%s", dir_name, dent->d_name);
-		if (stat(path, &st))
-			continue;
-
-		if (S_ISDIR(st.st_mode)) {
-			if (!strcmp(dent->d_name, ".") ||
-			    !strcmp(dent->d_name, ".."))
-				continue;
-
-			ret = map_groups__set_modules_path_dir(mg, path);
-			if (ret < 0)
-				goto out;
-		} else {
-			char *dot = strrchr(dent->d_name, '.'),
-			     dso_name[PATH_MAX];
-			struct map *map;
-			char *long_name;
-
-			if (dot == NULL || strcmp(dot, ".ko"))
-				continue;
-			snprintf(dso_name, sizeof(dso_name), "[%.*s]",
-				 (int)(dot - dent->d_name), dent->d_name);
-
-			strxfrchar(dso_name, '-', '_');
-			map = map_groups__find_by_name(mg, MAP__FUNCTION,
-						       dso_name);
-			if (map == NULL)
-				continue;
-
-			long_name = strdup(path);
-			if (long_name == NULL) {
-				ret = -1;
-				goto out;
-			}
-			dso__set_long_name(map->dso, long_name);
-			map->dso->lname_alloc = 1;
-			dso__kernel_module_get_build_id(map->dso, "");
-		}
-	}
-
-out:
-	closedir(dir);
-	return ret;
-}
-
-static char *get_kernel_version(const char *root_dir)
-{
-	char version[PATH_MAX];
-	FILE *file;
-	char *name, *tmp;
-	const char *prefix = "Linux version ";
-
-	sprintf(version, "%s/proc/version", root_dir);
-	file = fopen(version, "r");
-	if (!file)
-		return NULL;
-
-	version[0] = '\0';
-	tmp = fgets(version, sizeof(version), file);
-	fclose(file);
-
-	name = strstr(version, prefix);
-	if (!name)
-		return NULL;
-	name += strlen(prefix);
-	tmp = strchr(name, ' ');
-	if (tmp)
-		*tmp = '\0';
-
-	return strdup(name);
-}
-
-static int machine__set_modules_path(struct machine *machine)
-{
-	char *version;
-	char modules_path[PATH_MAX];
-
-	version = get_kernel_version(machine->root_dir);
-	if (!version)
-		return -1;
-
-	snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel",
-		 machine->root_dir, version);
-	free(version);
-
-	return map_groups__set_modules_path_dir(&machine->kmaps, modules_path);
-}
-
-struct map *machine__new_module(struct machine *machine, u64 start,
-				const char *filename)
-{
-	struct map *map;
-	struct dso *dso = __dsos__findnew(&machine->kernel_dsos, filename);
-
-	if (dso == NULL)
-		return NULL;
-
-	map = map__new2(start, dso, MAP__FUNCTION);
-	if (map == NULL)
-		return NULL;
-
-	if (machine__is_host(machine))
-		dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE;
-	else
-		dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE;
-	map_groups__insert(&machine->kmaps, map);
-	return map;
-}
-
-static int machine__create_modules(struct machine *machine)
-{
-	char *line = NULL;
-	size_t n;
-	FILE *file;
-	struct map *map;
-	const char *modules;
-	char path[PATH_MAX];
-
-	if (machine__is_default_guest(machine))
-		modules = symbol_conf.default_guest_modules;
-	else {
-		sprintf(path, "%s/proc/modules", machine->root_dir);
-		modules = path;
-	}
-
-	if (symbol__restricted_filename(path, "/proc/modules"))
-		return -1;
-
-	file = fopen(modules, "r");
-	if (file == NULL)
-		return -1;
-
-	while (!feof(file)) {
-		char name[PATH_MAX];
-		u64 start;
-		char *sep;
-		int line_len;
-
-		line_len = getline(&line, &n, file);
-		if (line_len < 0)
-			break;
-
-		if (!line)
-			goto out_failure;
-
-		line[--line_len] = '\0'; /* \n */
-
-		sep = strrchr(line, 'x');
-		if (sep == NULL)
-			continue;
-
-		hex2u64(sep + 1, &start);
-
-		sep = strchr(line, ' ');
-		if (sep == NULL)
-			continue;
-
-		*sep = '\0';
-
-		snprintf(name, sizeof(name), "[%s]", line);
-		map = machine__new_module(machine, start, name);
-		if (map == NULL)
-			goto out_delete_line;
-		dso__kernel_module_get_build_id(map->dso, machine->root_dir);
-	}
-
-	free(line);
-	fclose(file);
-
-	return machine__set_modules_path(machine);
-
-out_delete_line:
-	free(line);
-out_failure:
-	return -1;
-}
-
 int dso__load_vmlinux(struct dso *dso, struct map *map,
 		      const char *vmlinux, symbol_filter_t filter)
 {
@@ -1300,195 +1099,6 @@ out_try_fixup:
 	return err;
 }
 
-size_t machines__fprintf_dsos(struct rb_root *machines, FILE *fp)
-{
-	struct rb_node *nd;
-	size_t ret = 0;
-
-	for (nd = rb_first(machines); nd; nd = rb_next(nd)) {
-		struct machine *pos = rb_entry(nd, struct machine, rb_node);
-		ret += __dsos__fprintf(&pos->kernel_dsos, fp);
-		ret += __dsos__fprintf(&pos->user_dsos, fp);
-	}
-
-	return ret;
-}
-
-size_t machine__fprintf_dsos_buildid(struct machine *machine, FILE *fp,
-				     bool (skip)(struct dso *dso, int parm), int parm)
-{
-	return __dsos__fprintf_buildid(&machine->kernel_dsos, fp, skip, parm) +
-	       __dsos__fprintf_buildid(&machine->user_dsos, fp, skip, parm);
-}
-
-size_t machines__fprintf_dsos_buildid(struct rb_root *machines, FILE *fp,
-				     bool (skip)(struct dso *dso, int parm), int parm)
-{
-	struct rb_node *nd;
-	size_t ret = 0;
-
-	for (nd = rb_first(machines); nd; nd = rb_next(nd)) {
-		struct machine *pos = rb_entry(nd, struct machine, rb_node);
-		ret += machine__fprintf_dsos_buildid(pos, fp, skip, parm);
-	}
-	return ret;
-}
-
-static struct dso *machine__get_kernel(struct machine *machine)
-{
-	const char *vmlinux_name = NULL;
-	struct dso *kernel;
-
-	if (machine__is_host(machine)) {
-		vmlinux_name = symbol_conf.vmlinux_name;
-		if (!vmlinux_name)
-			vmlinux_name = "[kernel.kallsyms]";
-
-		kernel = dso__kernel_findnew(machine, vmlinux_name,
-					     "[kernel]",
-					     DSO_TYPE_KERNEL);
-	} else {
-		char bf[PATH_MAX];
-
-		if (machine__is_default_guest(machine))
-			vmlinux_name = symbol_conf.default_guest_vmlinux_name;
-		if (!vmlinux_name)
-			vmlinux_name = machine__mmap_name(machine, bf,
-							  sizeof(bf));
-
-		kernel = dso__kernel_findnew(machine, vmlinux_name,
-					     "[guest.kernel]",
-					     DSO_TYPE_GUEST_KERNEL);
-	}
-
-	if (kernel != NULL && (!kernel->has_build_id))
-		dso__read_running_kernel_build_id(kernel, machine);
-
-	return kernel;
-}
-
-struct process_args {
-	u64 start;
-};
-
-static int symbol__in_kernel(void *arg, const char *name,
-			     char type __maybe_unused, u64 start)
-{
-	struct process_args *args = arg;
-
-	if (strchr(name, '['))
-		return 0;
-
-	args->start = start;
-	return 1;
-}
-
-/* Figure out the start address of kernel map from /proc/kallsyms */
-static u64 machine__get_kernel_start_addr(struct machine *machine)
-{
-	const char *filename;
-	char path[PATH_MAX];
-	struct process_args args;
-
-	if (machine__is_host(machine)) {
-		filename = "/proc/kallsyms";
-	} else {
-		if (machine__is_default_guest(machine))
-			filename = (char *)symbol_conf.default_guest_kallsyms;
-		else {
-			sprintf(path, "%s/proc/kallsyms", machine->root_dir);
-			filename = path;
-		}
-	}
-
-	if (symbol__restricted_filename(filename, "/proc/kallsyms"))
-		return 0;
-
-	if (kallsyms__parse(filename, &args, symbol__in_kernel) <= 0)
-		return 0;
-
-	return args.start;
-}
-
-int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel)
-{
-	enum map_type type;
-	u64 start = machine__get_kernel_start_addr(machine);
-
-	for (type = 0; type < MAP__NR_TYPES; ++type) {
-		struct kmap *kmap;
-
-		machine->vmlinux_maps[type] = map__new2(start, kernel, type);
-		if (machine->vmlinux_maps[type] == NULL)
-			return -1;
-
-		machine->vmlinux_maps[type]->map_ip =
-			machine->vmlinux_maps[type]->unmap_ip =
-				identity__map_ip;
-		kmap = map__kmap(machine->vmlinux_maps[type]);
-		kmap->kmaps = &machine->kmaps;
-		map_groups__insert(&machine->kmaps,
-				   machine->vmlinux_maps[type]);
-	}
-
-	return 0;
-}
-
-void machine__destroy_kernel_maps(struct machine *machine)
-{
-	enum map_type type;
-
-	for (type = 0; type < MAP__NR_TYPES; ++type) {
-		struct kmap *kmap;
-
-		if (machine->vmlinux_maps[type] == NULL)
-			continue;
-
-		kmap = map__kmap(machine->vmlinux_maps[type]);
-		map_groups__remove(&machine->kmaps,
-				   machine->vmlinux_maps[type]);
-		if (kmap->ref_reloc_sym) {
-			/*
-			 * ref_reloc_sym is shared among all maps, so free just
-			 * on one of them.
-			 */
-			if (type == MAP__FUNCTION) {
-				free((char *)kmap->ref_reloc_sym->name);
-				kmap->ref_reloc_sym->name = NULL;
-				free(kmap->ref_reloc_sym);
-			}
-			kmap->ref_reloc_sym = NULL;
-		}
-
-		map__delete(machine->vmlinux_maps[type]);
-		machine->vmlinux_maps[type] = NULL;
-	}
-}
-
-int machine__create_kernel_maps(struct machine *machine)
-{
-	struct dso *kernel = machine__get_kernel(machine);
-
-	if (kernel == NULL ||
-	    __machine__create_kernel_maps(machine, kernel) < 0)
-		return -1;
-
-	if (symbol_conf.use_modules && machine__create_modules(machine) < 0) {
-		if (machine__is_host(machine))
-			pr_debug("Problems creating module maps, "
-				 "continuing anyway...\n");
-		else
-			pr_debug("Problems creating module maps for guest %d, "
-				 "continuing anyway...\n", machine->pid);
-	}
-
-	/*
-	 * Now that we have all the maps created, just set the ->end of them:
-	 */
-	map_groups__fixup_end(&machine->kmaps);
-	return 0;
-}
-
 static void vmlinux_path__exit(void)
 {
 	while (--vmlinux_path__nr_entries >= 0) {
@@ -1549,25 +1159,6 @@ out_fail:
 	return -1;
 }
 
-size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp)
-{
-	int i;
-	size_t printed = 0;
-	struct dso *kdso = machine->vmlinux_maps[MAP__FUNCTION]->dso;
-
-	if (kdso->has_build_id) {
-		char filename[PATH_MAX];
-		if (dso__build_id_filename(kdso, filename, sizeof(filename)))
-			printed += fprintf(fp, "[0] %s\n", filename);
-	}
-
-	for (i = 0; i < vmlinux_path__nr_entries; ++i)
-		printed += fprintf(fp, "[%d] %s\n",
-				   i + kdso->has_build_id, vmlinux_path[i]);
-
-	return printed;
-}
-
 static int setup_list(struct strlist **list, const char *list_str,
 		      const char *list_name)
 {
@@ -1671,108 +1262,3 @@ void symbol__exit(void)
 	symbol_conf.sym_list = symbol_conf.dso_list = symbol_conf.comm_list = NULL;
 	symbol_conf.initialized = false;
 }
-
-int machines__create_kernel_maps(struct rb_root *machines, pid_t pid)
-{
-	struct machine *machine = machines__findnew(machines, pid);
-
-	if (machine == NULL)
-		return -1;
-
-	return machine__create_kernel_maps(machine);
-}
-
-int machines__create_guest_kernel_maps(struct rb_root *machines)
-{
-	int ret = 0;
-	struct dirent **namelist = NULL;
-	int i, items = 0;
-	char path[PATH_MAX];
-	pid_t pid;
-	char *endp;
-
-	if (symbol_conf.default_guest_vmlinux_name ||
-	    symbol_conf.default_guest_modules ||
-	    symbol_conf.default_guest_kallsyms) {
-		machines__create_kernel_maps(machines, DEFAULT_GUEST_KERNEL_ID);
-	}
-
-	if (symbol_conf.guestmount) {
-		items = scandir(symbol_conf.guestmount, &namelist, NULL, NULL);
-		if (items <= 0)
-			return -ENOENT;
-		for (i = 0; i < items; i++) {
-			if (!isdigit(namelist[i]->d_name[0])) {
-				/* Filter out . and .. */
-				continue;
-			}
-			pid = (pid_t)strtol(namelist[i]->d_name, &endp, 10);
-			if ((*endp != '\0') ||
-			    (endp == namelist[i]->d_name) ||
-			    (errno == ERANGE)) {
-				pr_debug("invalid directory (%s). Skipping.\n",
-					 namelist[i]->d_name);
-				continue;
-			}
-			sprintf(path, "%s/%s/proc/kallsyms",
-				symbol_conf.guestmount,
-				namelist[i]->d_name);
-			ret = access(path, R_OK);
-			if (ret) {
-				pr_debug("Can't access file %s\n", path);
-				goto failure;
-			}
-			machines__create_kernel_maps(machines, pid);
-		}
-failure:
-		free(namelist);
-	}
-
-	return ret;
-}
-
-void machines__destroy_guest_kernel_maps(struct rb_root *machines)
-{
-	struct rb_node *next = rb_first(machines);
-
-	while (next) {
-		struct machine *pos = rb_entry(next, struct machine, rb_node);
-
-		next = rb_next(&pos->rb_node);
-		rb_erase(&pos->rb_node, machines);
-		machine__delete(pos);
-	}
-}
-
-int machine__load_kallsyms(struct machine *machine, const char *filename,
-			   enum map_type type, symbol_filter_t filter)
-{
-	struct map *map = machine->vmlinux_maps[type];
-	int ret = dso__load_kallsyms(map->dso, filename, map, filter);
-
-	if (ret > 0) {
-		dso__set_loaded(map->dso, type);
-		/*
-		 * Since /proc/kallsyms will have multiple sessions for the
-		 * kernel, with modules between them, fixup the end of all
-		 * sections.
-		 */
-		__map_groups__fixup_end(&machine->kmaps, type);
-	}
-
-	return ret;
-}
-
-int machine__load_vmlinux_path(struct machine *machine, enum map_type type,
-			       symbol_filter_t filter)
-{
-	struct map *map = machine->vmlinux_maps[type];
-	int ret = dso__load_vmlinux_path(map->dso, map, filter);
-
-	if (ret > 0) {
-		dso__set_loaded(map->dso, type);
-		map__reloc_vmlinux(map);
-	}
-
-	return ret;
-}
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index de68f98..ec7b240 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -120,6 +120,8 @@ struct symbol_conf {
 };
 
 extern struct symbol_conf symbol_conf;
+extern int vmlinux_path__nr_entries;
+extern char **vmlinux_path;
 
 static inline void *symbol__priv(struct symbol *sym)
 {
@@ -223,6 +225,8 @@ size_t symbol__fprintf_symname_offs(const struct symbol *sym,
 size_t symbol__fprintf_symname(const struct symbol *sym, FILE *fp);
 size_t symbol__fprintf(struct symbol *sym, FILE *fp);
 bool symbol_type__is_a(char symbol_type, enum map_type map_type);
+bool symbol__restricted_filename(const char *filename,
+				 const char *restricted_filename);
 
 int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
 		  struct symsrc *runtime_ss, symbol_filter_t filter,
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index df59623..632e40e 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -54,10 +54,10 @@ int thread__comm_len(struct thread *self)
 	return self->comm_len;
 }
 
-static size_t thread__fprintf(struct thread *self, FILE *fp)
+size_t thread__fprintf(struct thread *thread, FILE *fp)
 {
-	return fprintf(fp, "Thread %d %s\n", self->pid, self->comm) +
-	       map_groups__fprintf(&self->mg, verbose, fp);
+	return fprintf(fp, "Thread %d %s\n", thread->pid, thread->comm) +
+	       map_groups__fprintf(&thread->mg, verbose, fp);
 }
 
 void thread__insert_map(struct thread *self, struct map *map)
@@ -84,17 +84,3 @@ int thread__fork(struct thread *self, struct thread *parent)
 			return -ENOMEM;
 	return 0;
 }
-
-size_t machine__fprintf(struct machine *machine, FILE *fp)
-{
-	size_t ret = 0;
-	struct rb_node *nd;
-
-	for (nd = rb_first(&machine->threads); nd; nd = rb_next(nd)) {
-		struct thread *pos = rb_entry(nd, struct thread, rb_node);
-
-		ret += thread__fprintf(pos, fp);
-	}
-
-	return ret;
-}
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index f2fa17c..5ad2664 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -30,6 +30,7 @@ int thread__set_comm(struct thread *self, const char *comm);
 int thread__comm_len(struct thread *self);
 void thread__insert_map(struct thread *self, struct map *map);
 int thread__fork(struct thread *self, struct thread *parent);
+size_t thread__fprintf(struct thread *thread, FILE *fp);
 
 static inline struct map *thread__find_map(struct thread *self,
 					   enum map_type type, u64 addr)
-- 
1.7.9.2.358.g22243


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

* [PATCH 25/37] perf evsel: Update sample_size when setting sample_type bits
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (23 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 24/37] perf machine: Move more machine methods to machine.c Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 26/37] perf test: Fixup error reporting in basic mmap test Arnaldo Carvalho de Melo
                   ` (12 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

We use evsel->sample_size to detect underflows in
perf_evsel__parse_sample, but we were failing to update it after
perf_evsel__init(), i.e. when we decide, after creating an evsel, that
we want some extra field bit set.

Fix it by introducing methods to set a bit that will take care of
correctly adjusting evsel->sample_size.

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-2ny5pzsing0dcth7hws48x9c@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c    |    2 +-
 tools/perf/builtin-top.c       |   11 +++++-----
 tools/perf/tests/perf-record.c |    6 +++---
 tools/perf/util/evlist.c       |    2 +-
 tools/perf/util/evsel.c        |   45 ++++++++++++++++++++++++++++------------
 tools/perf/util/evsel.h        |   11 ++++++++++
 6 files changed, 54 insertions(+), 23 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index f3151d3..0be6605 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -286,7 +286,7 @@ try_again:
 					 */
 					opts->sample_id_all_missing = true;
 					if (!opts->sample_time && !opts->raw_samples && !time_needed)
-						attr->sample_type &= ~PERF_SAMPLE_TIME;
+						perf_evsel__reset_sample_bit(pos, TIME);
 
 					goto retry_sample_id;
 				}
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 987e1b8..31a7c51 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -901,24 +901,25 @@ static void perf_top__start_counters(struct perf_top *top)
 	list_for_each_entry(counter, &evlist->entries, node) {
 		struct perf_event_attr *attr = &counter->attr;
 
-		attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
+		perf_evsel__set_sample_bit(counter, IP);
+		perf_evsel__set_sample_bit(counter, TID);
 
 		if (top->freq) {
-			attr->sample_type |= PERF_SAMPLE_PERIOD;
+			perf_evsel__set_sample_bit(counter, PERIOD);
 			attr->freq	  = 1;
 			attr->sample_freq = top->freq;
 		}
 
 		if (evlist->nr_entries > 1) {
-			attr->sample_type |= PERF_SAMPLE_ID;
+			perf_evsel__set_sample_bit(counter, ID);
 			attr->read_format |= PERF_FORMAT_ID;
 		}
 
 		if (perf_target__has_cpu(&top->target))
-			attr->sample_type |= PERF_SAMPLE_CPU;
+			perf_evsel__set_sample_bit(counter, CPU);
 
 		if (symbol_conf.use_callchain)
-			attr->sample_type |= PERF_SAMPLE_CALLCHAIN;
+			perf_evsel__set_sample_bit(counter, CALLCHAIN);
 
 		attr->mmap = 1;
 		attr->comm = 1;
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index 70e0d44..5902772 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -103,9 +103,9 @@ int test__PERF_RECORD(void)
 	 * Config the evsels, setting attr->comm on the first one, etc.
 	 */
 	evsel = perf_evlist__first(evlist);
-	evsel->attr.sample_type |= PERF_SAMPLE_CPU;
-	evsel->attr.sample_type |= PERF_SAMPLE_TID;
-	evsel->attr.sample_type |= PERF_SAMPLE_TIME;
+	perf_evsel__set_sample_bit(evsel, CPU);
+	perf_evsel__set_sample_bit(evsel, TID);
+	perf_evsel__set_sample_bit(evsel, TIME);
 	perf_evlist__config_attrs(evlist, &opts);
 
 	err = sched__get_first_possible_cpu(evlist->workload.pid, &cpu_mask);
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index d0e1e82..2655659 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -61,7 +61,7 @@ void perf_evlist__config_attrs(struct perf_evlist *evlist,
 		perf_evsel__config(evsel, opts);
 
 		if (evlist->nr_entries > 1)
-			evsel->attr.sample_type |= PERF_SAMPLE_ID;
+			perf_evsel__set_sample_bit(evsel, ID);
 	}
 }
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index bb58b05..fc80f5a 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -50,6 +50,24 @@ void hists__init(struct hists *hists)
 	pthread_mutex_init(&hists->lock, NULL);
 }
 
+void __perf_evsel__set_sample_bit(struct perf_evsel *evsel,
+				  enum perf_event_sample_format bit)
+{
+	if (!(evsel->attr.sample_type & bit)) {
+		evsel->attr.sample_type |= bit;
+		evsel->sample_size += sizeof(u64);
+	}
+}
+
+void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel,
+				    enum perf_event_sample_format bit)
+{
+	if (evsel->attr.sample_type & bit) {
+		evsel->attr.sample_type &= ~bit;
+		evsel->sample_size -= sizeof(u64);
+	}
+}
+
 void perf_evsel__init(struct perf_evsel *evsel,
 		      struct perf_event_attr *attr, int idx)
 {
@@ -445,7 +463,8 @@ void perf_evsel__config(struct perf_evsel *evsel,
 			      PERF_FORMAT_TOTAL_TIME_RUNNING |
 			      PERF_FORMAT_ID;
 
-	attr->sample_type  |= PERF_SAMPLE_IP | PERF_SAMPLE_TID;
+	perf_evsel__set_sample_bit(evsel, IP);
+	perf_evsel__set_sample_bit(evsel, TID);
 
 	/*
 	 * We default some events to a 1 default interval. But keep
@@ -454,7 +473,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
 	if (!attr->sample_period || (opts->user_freq != UINT_MAX &&
 				     opts->user_interval != ULLONG_MAX)) {
 		if (opts->freq) {
-			attr->sample_type	|= PERF_SAMPLE_PERIOD;
+			perf_evsel__set_sample_bit(evsel, PERIOD);
 			attr->freq		= 1;
 			attr->sample_freq	= opts->freq;
 		} else {
@@ -469,16 +488,16 @@ void perf_evsel__config(struct perf_evsel *evsel,
 		attr->inherit_stat = 1;
 
 	if (opts->sample_address) {
-		attr->sample_type	|= PERF_SAMPLE_ADDR;
+		perf_evsel__set_sample_bit(evsel, ADDR);
 		attr->mmap_data = track;
 	}
 
 	if (opts->call_graph) {
-		attr->sample_type	|= PERF_SAMPLE_CALLCHAIN;
+		perf_evsel__set_sample_bit(evsel, CALLCHAIN);
 
 		if (opts->call_graph == CALLCHAIN_DWARF) {
-			attr->sample_type |= PERF_SAMPLE_REGS_USER |
-					     PERF_SAMPLE_STACK_USER;
+			perf_evsel__set_sample_bit(evsel, REGS_USER);
+			perf_evsel__set_sample_bit(evsel, STACK_USER);
 			attr->sample_regs_user = PERF_REGS_MASK;
 			attr->sample_stack_user = opts->stack_dump_size;
 			attr->exclude_callchain_user = 1;
@@ -486,20 +505,20 @@ void perf_evsel__config(struct perf_evsel *evsel,
 	}
 
 	if (perf_target__has_cpu(&opts->target))
-		attr->sample_type	|= PERF_SAMPLE_CPU;
+		perf_evsel__set_sample_bit(evsel, CPU);
 
 	if (opts->period)
-		attr->sample_type	|= PERF_SAMPLE_PERIOD;
+		perf_evsel__set_sample_bit(evsel, PERIOD);
 
 	if (!opts->sample_id_all_missing &&
 	    (opts->sample_time || !opts->no_inherit ||
 	     perf_target__has_cpu(&opts->target)))
-		attr->sample_type	|= PERF_SAMPLE_TIME;
+		perf_evsel__set_sample_bit(evsel, TIME);
 
 	if (opts->raw_samples) {
-		attr->sample_type	|= PERF_SAMPLE_TIME;
-		attr->sample_type	|= PERF_SAMPLE_RAW;
-		attr->sample_type	|= PERF_SAMPLE_CPU;
+		perf_evsel__set_sample_bit(evsel, TIME);
+		perf_evsel__set_sample_bit(evsel, RAW);
+		perf_evsel__set_sample_bit(evsel, CPU);
 	}
 
 	if (opts->no_delay) {
@@ -507,7 +526,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
 		attr->wakeup_events = 1;
 	}
 	if (opts->branch_stack) {
-		attr->sample_type	|= PERF_SAMPLE_BRANCH_STACK;
+		perf_evsel__set_sample_bit(evsel, BRANCH_STACK);
 		attr->branch_sample_type = opts->branch_stack;
 	}
 
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 3f7ff47..7398539 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -118,6 +118,17 @@ void perf_evsel__free_fd(struct perf_evsel *evsel);
 void perf_evsel__free_id(struct perf_evsel *evsel);
 void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
 
+void __perf_evsel__set_sample_bit(struct perf_evsel *evsel,
+				  enum perf_event_sample_format bit);
+void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel,
+				    enum perf_event_sample_format bit);
+
+#define perf_evsel__set_sample_bit(evsel, bit) \
+	__perf_evsel__set_sample_bit(evsel, PERF_SAMPLE_##bit)
+
+#define perf_evsel__reset_sample_bit(evsel, bit) \
+	__perf_evsel__reset_sample_bit(evsel, PERF_SAMPLE_##bit)
+
 int perf_evsel__set_filter(struct perf_evsel *evsel, int ncpus, int nthreads,
 			   const char *filter);
 
-- 
1.7.9.2.358.g22243


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

* [PATCH 26/37] perf test: Fixup error reporting in basic mmap test
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (24 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 25/37] perf evsel: Update sample_size when setting sample_type bits Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 27/37] perf test: Use perf_evsel__newtp constructor in the tracepoint tests Arnaldo Carvalho de Melo
                   ` (11 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

In two cases this test could detect an error, bail out but return zero.
Fix it by reporting -1 for failure.

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-tjhs9v6nqpofmxv3gs5lnu2c@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/mmap-basic.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index e174681..8682ecf 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -128,6 +128,7 @@ int test__basic_mmap(void)
 			goto out_munmap;
 		}
 
+		err = -1;
 		evsel = perf_evlist__id2evsel(evlist, sample.id);
 		if (evsel == NULL) {
 			pr_debug("event with id %" PRIu64
@@ -137,16 +138,17 @@ int test__basic_mmap(void)
 		nr_events[evsel->idx]++;
 	}
 
+	err = 0;
 	list_for_each_entry(evsel, &evlist->entries, node) {
 		if (nr_events[evsel->idx] != expected_nr_events[evsel->idx]) {
 			pr_debug("expected %d %s events, got %d\n",
 				 expected_nr_events[evsel->idx],
 				 perf_evsel__name(evsel), nr_events[evsel->idx]);
+			err = -1;
 			goto out_munmap;
 		}
 	}
 
-	err = 0;
 out_munmap:
 	perf_evlist__munmap(evlist);
 out_close_fd:
-- 
1.7.9.2.358.g22243


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

* [PATCH 27/37] perf test: Use perf_evsel__newtp constructor in the tracepoint tests
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (25 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 26/37] perf test: Fixup error reporting in basic mmap test Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 28/37] perf evsel: Introduce method to request IDs be used Arnaldo Carvalho de Melo
                   ` (10 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

Removing one trace_event__id function, not used anymore.

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-13p2ov2rg166y73j9uazukma@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile                      |    1 -
 tools/perf/tests/mmap-basic.c            |   37 +++++++++---------------------
 tools/perf/tests/open-syscall-all-cpus.c |   18 +++------------
 tools/perf/tests/open-syscall.c          |   17 +++-----------
 tools/perf/tests/tests.h                 |    3 ---
 tools/perf/tests/util.c                  |   30 ------------------------
 6 files changed, 17 insertions(+), 89 deletions(-)
 delete mode 100644 tools/perf/tests/util.c

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 2a07b95..10aa24c 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -487,7 +487,6 @@ LIB_OBJS += $(OUTPUT)tests/rdpmc.o
 LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
 LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
 LIB_OBJS += $(OUTPUT)tests/pmu.o
-LIB_OBJS += $(OUTPUT)tests/util.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index 8682ecf..4743b6d 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -22,36 +22,16 @@ int test__basic_mmap(void)
 	struct thread_map *threads;
 	struct cpu_map *cpus;
 	struct perf_evlist *evlist;
-	struct perf_event_attr attr = {
-		.type		= PERF_TYPE_TRACEPOINT,
-		.read_format	= PERF_FORMAT_ID,
-		.sample_type	= PERF_SAMPLE_ID,
-		.watermark	= 0,
-	};
 	cpu_set_t cpu_set;
 	const char *syscall_names[] = { "getsid", "getppid", "getpgrp",
 					"getpgid", };
 	pid_t (*syscalls[])(void) = { (void *)getsid, getppid, getpgrp,
 				      (void*)getpgid };
 #define nsyscalls ARRAY_SIZE(syscall_names)
-	int ids[nsyscalls];
 	unsigned int nr_events[nsyscalls],
 		     expected_nr_events[nsyscalls], i, j;
 	struct perf_evsel *evsels[nsyscalls], *evsel;
 
-	for (i = 0; i < nsyscalls; ++i) {
-		char name[64];
-
-		snprintf(name, sizeof(name), "sys_enter_%s", syscall_names[i]);
-		ids[i] = trace_event__id(name);
-		if (ids[i] < 0) {
-			pr_debug("Is debugfs mounted on /sys/kernel/debug?\n");
-			return -1;
-		}
-		nr_events[i] = 0;
-		expected_nr_events[i] = random() % 257;
-	}
-
 	threads = thread_map__new(-1, getpid(), UINT_MAX);
 	if (threads == NULL) {
 		pr_debug("thread_map__new\n");
@@ -79,18 +59,20 @@ int test__basic_mmap(void)
 		goto out_free_cpus;
 	}
 
-	/* anonymous union fields, can't be initialized above */
-	attr.wakeup_events = 1;
-	attr.sample_period = 1;
-
 	for (i = 0; i < nsyscalls; ++i) {
-		attr.config = ids[i];
-		evsels[i] = perf_evsel__new(&attr, i);
+		char name[64];
+
+		snprintf(name, sizeof(name), "sys_enter_%s", syscall_names[i]);
+		evsels[i] = perf_evsel__newtp("syscalls", name, i);
 		if (evsels[i] == NULL) {
 			pr_debug("perf_evsel__new\n");
 			goto out_free_evlist;
 		}
 
+		evsels[i]->attr.wakeup_events = 1;
+		evsels[i]->attr.read_format |= PERF_FORMAT_ID;
+		perf_evsel__set_sample_bit(evsels[i], ID);
+
 		perf_evlist__add(evlist, evsels[i]);
 
 		if (perf_evsel__open(evsels[i], cpus, threads) < 0) {
@@ -99,6 +81,9 @@ int test__basic_mmap(void)
 				 strerror(errno));
 			goto out_close_fd;
 		}
+
+		nr_events[i] = 0;
+		expected_nr_events[i] = 1 + rand() % 127;
 	}
 
 	if (perf_evlist__mmap(evlist, 128, true) < 0) {
diff --git a/tools/perf/tests/open-syscall-all-cpus.c b/tools/perf/tests/open-syscall-all-cpus.c
index 31072ab..9b920a0 100644
--- a/tools/perf/tests/open-syscall-all-cpus.c
+++ b/tools/perf/tests/open-syscall-all-cpus.c
@@ -7,20 +7,12 @@
 int test__open_syscall_event_on_all_cpus(void)
 {
 	int err = -1, fd, cpu;
-	struct thread_map *threads;
 	struct cpu_map *cpus;
 	struct perf_evsel *evsel;
-	struct perf_event_attr attr;
 	unsigned int nr_open_calls = 111, i;
 	cpu_set_t cpu_set;
-	int id = trace_event__id("sys_enter_open");
+	struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
 
-	if (id < 0) {
-		pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
-		return -1;
-	}
-
-	threads = thread_map__new(-1, getpid(), UINT_MAX);
 	if (threads == NULL) {
 		pr_debug("thread_map__new\n");
 		return -1;
@@ -32,15 +24,11 @@ int test__open_syscall_event_on_all_cpus(void)
 		goto out_thread_map_delete;
 	}
 
-
 	CPU_ZERO(&cpu_set);
 
-	memset(&attr, 0, sizeof(attr));
-	attr.type = PERF_TYPE_TRACEPOINT;
-	attr.config = id;
-	evsel = perf_evsel__new(&attr, 0);
+	evsel = perf_evsel__newtp("syscalls", "sys_enter_open", 0);
 	if (evsel == NULL) {
-		pr_debug("perf_evsel__new\n");
+		pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
 		goto out_thread_map_delete;
 	}
 
diff --git a/tools/perf/tests/open-syscall.c b/tools/perf/tests/open-syscall.c
index 98be8b5..befc067 100644
--- a/tools/perf/tests/open-syscall.c
+++ b/tools/perf/tests/open-syscall.c
@@ -6,29 +6,18 @@
 int test__open_syscall_event(void)
 {
 	int err = -1, fd;
-	struct thread_map *threads;
 	struct perf_evsel *evsel;
-	struct perf_event_attr attr;
 	unsigned int nr_open_calls = 111, i;
-	int id = trace_event__id("sys_enter_open");
+	struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
 
-	if (id < 0) {
-		pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
-		return -1;
-	}
-
-	threads = thread_map__new(-1, getpid(), UINT_MAX);
 	if (threads == NULL) {
 		pr_debug("thread_map__new\n");
 		return -1;
 	}
 
-	memset(&attr, 0, sizeof(attr));
-	attr.type = PERF_TYPE_TRACEPOINT;
-	attr.config = id;
-	evsel = perf_evsel__new(&attr, 0);
+	evsel = perf_evsel__newtp("syscalls", "sys_enter_open", 0);
 	if (evsel == NULL) {
-		pr_debug("perf_evsel__new\n");
+		pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
 		goto out_thread_map_delete;
 	}
 
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index fc121ed..0fd94657 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -16,7 +16,4 @@ int test__attr(void);
 int test__dso_data(void);
 int test__parse_events(void);
 
-/* Util */
-int trace_event__id(const char *evname);
-
 #endif /* TESTS_H */
diff --git a/tools/perf/tests/util.c b/tools/perf/tests/util.c
deleted file mode 100644
index 748f2e8..0000000
--- a/tools/perf/tests/util.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include "tests.h"
-#include "debugfs.h"
-
-int trace_event__id(const char *evname)
-{
-	char *filename;
-	int err = -1, fd;
-
-	if (asprintf(&filename,
-		     "%s/syscalls/%s/id",
-		     tracing_events_path, evname) < 0)
-		return -1;
-
-	fd = open(filename, O_RDONLY);
-	if (fd >= 0) {
-		char id[16];
-		if (read(fd, id, sizeof(id)) > 0)
-			err = atoi(id);
-		close(fd);
-	}
-
-	free(filename);
-	return err;
-}
-- 
1.7.9.2.358.g22243


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

* [PATCH 28/37] perf evsel: Introduce method to request IDs be used
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (26 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 27/37] perf test: Use perf_evsel__newtp constructor in the tracepoint tests Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 29/37] perf evsel: No need to always ask for PERF_FORMAT_ID in read_format Arnaldo Carvalho de Melo
                   ` (9 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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 mmaping multiple events we need to find the right evsel that
matches an event in the ring buffer.

For that we need to set the PERF_FORMAT_ID bit in
perf_event_attr.read_format so that when we read the event fds we get
that id to then hash it and be able later to use perf_evlist__id2evsel
to find the right evsel.

We also need to set the PERF_SAMPLE_ID bit in
perf_event_attr.sample_type to ask for that id to be stashed in each
sample, so that we can demux it.

So add a perf_evsel__set_sample_id() method to do those two things in
one operation.

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-1z4xcmbud30lamklfe80oopu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c      |    6 ++----
 tools/perf/tests/mmap-basic.c |    3 +--
 tools/perf/util/evsel.c       |    6 ++++++
 tools/perf/util/evsel.h       |    2 ++
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 31a7c51..a306474 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -910,10 +910,8 @@ static void perf_top__start_counters(struct perf_top *top)
 			attr->sample_freq = top->freq;
 		}
 
-		if (evlist->nr_entries > 1) {
-			perf_evsel__set_sample_bit(counter, ID);
-			attr->read_format |= PERF_FORMAT_ID;
-		}
+		if (evlist->nr_entries > 1)
+			perf_evsel__set_sample_id(counter);
 
 		if (perf_target__has_cpu(&top->target))
 			perf_evsel__set_sample_bit(counter, CPU);
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index 4743b6d..cdd5075 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -70,8 +70,7 @@ int test__basic_mmap(void)
 		}
 
 		evsels[i]->attr.wakeup_events = 1;
-		evsels[i]->attr.read_format |= PERF_FORMAT_ID;
-		perf_evsel__set_sample_bit(evsels[i], ID);
+		perf_evsel__set_sample_id(evsels[i]);
 
 		perf_evlist__add(evlist, evsels[i]);
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index fc80f5a..9dde7e9 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -68,6 +68,12 @@ void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel,
 	}
 }
 
+void perf_evsel__set_sample_id(struct perf_evsel *evsel)
+{
+	perf_evsel__set_sample_bit(evsel, ID);
+	evsel->attr.read_format |= PERF_FORMAT_ID;
+}
+
 void perf_evsel__init(struct perf_evsel *evsel,
 		      struct perf_event_attr *attr, int idx)
 {
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 7398539..5c08977 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -129,6 +129,8 @@ void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel,
 #define perf_evsel__reset_sample_bit(evsel, bit) \
 	__perf_evsel__reset_sample_bit(evsel, PERF_SAMPLE_##bit)
 
+void perf_evsel__set_sample_id(struct perf_evsel *evsel);
+
 int perf_evsel__set_filter(struct perf_evsel *evsel, int ncpus, int nthreads,
 			   const char *filter);
 
-- 
1.7.9.2.358.g22243


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

* [PATCH 29/37] perf evsel: No need to always ask for PERF_FORMAT_ID in read_format
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (27 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 28/37] perf evsel: Introduce method to request IDs be used Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 30/37] perf evsel: No need to always ask for PERF_FORMAT_TOTAL_TIME_{ENABLED,RUNNING} Arnaldo Carvalho de Melo
                   ` (8 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

Instead make perf_evlist__confir_attrs use perf_evsel__set_sample_id()
when having more than one event, that way only if we have multiple
events we'll ask to have the event ids returned when we read its file
descriptors.

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-xuho5hrrxy2ky0cjpr80hyfp@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr/base-record        |    2 +-
 tools/perf/tests/attr/test-record-group  |    2 ++
 tools/perf/tests/attr/test-record-group1 |    2 ++
 tools/perf/util/evlist.c                 |    2 +-
 tools/perf/util/evsel.c                  |    3 +--
 5 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index f1485d8..f9d0464 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -7,7 +7,7 @@ size=96
 config=0
 sample_period=4000
 sample_type=263
-read_format=7
+read_format=3
 disabled=1
 inherit=1
 pinned=0
diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
index a6599e9..0df34ca 100644
--- a/tools/perf/tests/attr/test-record-group
+++ b/tools/perf/tests/attr/test-record-group
@@ -6,12 +6,14 @@ args    = --group -e cycles,instructions kill >/dev/null 2>&1
 fd=1
 group_fd=-1
 sample_type=327
+read_format=7
 
 [event-2:base-record]
 fd=2
 group_fd=1
 config=1
 sample_type=327
+read_format=7
 mmap=0
 comm=0
 enable_on_exec=0
diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
index 5a8359d..18bd926 100644
--- a/tools/perf/tests/attr/test-record-group1
+++ b/tools/perf/tests/attr/test-record-group1
@@ -6,6 +6,7 @@ args    = -e '{cycles,instructions}' kill >/tmp/krava 2>&1
 fd=1
 group_fd=-1
 sample_type=327
+read_format=7
 
 [event-2:base-record]
 fd=2
@@ -13,6 +14,7 @@ group_fd=1
 type=0
 config=1
 sample_type=327
+read_format=7
 mmap=0
 comm=0
 enable_on_exec=0
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 2655659..5a0878d 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -61,7 +61,7 @@ void perf_evlist__config_attrs(struct perf_evlist *evlist,
 		perf_evsel__config(evsel, opts);
 
 		if (evlist->nr_entries > 1)
-			perf_evsel__set_sample_bit(evsel, ID);
+			perf_evsel__set_sample_id(evsel);
 	}
 }
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 9dde7e9..e62d3ae 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -466,8 +466,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
 	attr->sample_id_all = opts->sample_id_all_missing ? 0 : 1;
 	attr->inherit	    = !opts->no_inherit;
 	attr->read_format   = PERF_FORMAT_TOTAL_TIME_ENABLED |
-			      PERF_FORMAT_TOTAL_TIME_RUNNING |
-			      PERF_FORMAT_ID;
+			      PERF_FORMAT_TOTAL_TIME_RUNNING;
 
 	perf_evsel__set_sample_bit(evsel, IP);
 	perf_evsel__set_sample_bit(evsel, TID);
-- 
1.7.9.2.358.g22243


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

* [PATCH 30/37] perf evsel: No need to always ask for PERF_FORMAT_TOTAL_TIME_{ENABLED,RUNNING}
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (28 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 29/37] perf evsel: No need to always ask for PERF_FORMAT_ID in read_format Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 31/37] perf evlist: Set the leader in the perf_evlist__config method Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

This is needed, so far, just in 'perf stat', to scale counters, so don't
unconditionally ask for them in the perf_evsel__config() method.

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-ujpujgscq2f2oodxuso5nobc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/attr/base-record        |    2 +-
 tools/perf/tests/attr/test-record-group  |    4 ++--
 tools/perf/tests/attr/test-record-group1 |    4 ++--
 tools/perf/util/evsel.c                  |    2 --
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index f9d0464..5bc3880 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -7,7 +7,7 @@ size=96
 config=0
 sample_period=4000
 sample_type=263
-read_format=3
+read_format=0
 disabled=1
 inherit=1
 pinned=0
diff --git a/tools/perf/tests/attr/test-record-group b/tools/perf/tests/attr/test-record-group
index 0df34ca..57739ca 100644
--- a/tools/perf/tests/attr/test-record-group
+++ b/tools/perf/tests/attr/test-record-group
@@ -6,14 +6,14 @@ args    = --group -e cycles,instructions kill >/dev/null 2>&1
 fd=1
 group_fd=-1
 sample_type=327
-read_format=7
+read_format=4
 
 [event-2:base-record]
 fd=2
 group_fd=1
 config=1
 sample_type=327
-read_format=7
+read_format=4
 mmap=0
 comm=0
 enable_on_exec=0
diff --git a/tools/perf/tests/attr/test-record-group1 b/tools/perf/tests/attr/test-record-group1
index 18bd926..4d688a1 100644
--- a/tools/perf/tests/attr/test-record-group1
+++ b/tools/perf/tests/attr/test-record-group1
@@ -6,7 +6,7 @@ args    = -e '{cycles,instructions}' kill >/tmp/krava 2>&1
 fd=1
 group_fd=-1
 sample_type=327
-read_format=7
+read_format=4
 
 [event-2:base-record]
 fd=2
@@ -14,7 +14,7 @@ group_fd=1
 type=0
 config=1
 sample_type=327
-read_format=7
+read_format=4
 mmap=0
 comm=0
 enable_on_exec=0
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index e62d3ae..2492d32 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -465,8 +465,6 @@ void perf_evsel__config(struct perf_evsel *evsel,
 
 	attr->sample_id_all = opts->sample_id_all_missing ? 0 : 1;
 	attr->inherit	    = !opts->no_inherit;
-	attr->read_format   = PERF_FORMAT_TOTAL_TIME_ENABLED |
-			      PERF_FORMAT_TOTAL_TIME_RUNNING;
 
 	perf_evsel__set_sample_bit(evsel, IP);
 	perf_evsel__set_sample_bit(evsel, TID);
-- 
1.7.9.2.358.g22243


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

* [PATCH 31/37] perf evlist: Set the leader in the perf_evlist__config method
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (29 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 30/37] perf evsel: No need to always ask for PERF_FORMAT_TOTAL_TIME_{ENABLED,RUNNING} Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 32/37] perf evsel: Adopt fprintf routine from 'perf evlist' Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

Since we need to ensure the leader is set before configuring the
evsel perf_event_attrs.

Reducing the boilerplate needed by tools, helping, for instance,
'perf trace', that wasn't setting the leader.

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-22shm0ptkch2kgl7rtqlligx@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c    |    9 +--------
 tools/perf/builtin-trace.c     |    2 +-
 tools/perf/tests/perf-record.c |    2 +-
 tools/perf/util/evlist.c       |   10 ++++++++--
 tools/perf/util/evlist.h       |    4 ++--
 5 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 0be6605..fc4f080 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -230,14 +230,7 @@ static int perf_record__open(struct perf_record *rec)
 	struct perf_record_opts *opts = &rec->opts;
 	int rc = 0;
 
-	/*
-	 * Set the evsel leader links before we configure attributes,
-	 * since some might depend on this info.
-	 */
-	if (opts->group)
-		perf_evlist__set_leader(evlist);
-
-	perf_evlist__config_attrs(evlist, opts);
+	perf_evlist__config(evlist, opts);
 
 	list_for_each_entry(pos, &evlist->entries, node) {
 		struct perf_event_attr *attr = &pos->attr;
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 7932ffa..d222d7f 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -455,7 +455,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
 		goto out_delete_evlist;
 	}
 
-	perf_evlist__config_attrs(evlist, &trace->opts);
+	perf_evlist__config(evlist, &trace->opts);
 
 	signal(SIGCHLD, sig_handler);
 	signal(SIGINT, sig_handler);
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index 5902772..6ea66cf 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -106,7 +106,7 @@ int test__PERF_RECORD(void)
 	perf_evsel__set_sample_bit(evsel, CPU);
 	perf_evsel__set_sample_bit(evsel, TID);
 	perf_evsel__set_sample_bit(evsel, TIME);
-	perf_evlist__config_attrs(evlist, &opts);
+	perf_evlist__config(evlist, &opts);
 
 	err = sched__get_first_possible_cpu(evlist->workload.pid, &cpu_mask);
 	if (err < 0) {
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 5a0878d..dc8aee9 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -49,10 +49,16 @@ struct perf_evlist *perf_evlist__new(struct cpu_map *cpus,
 	return evlist;
 }
 
-void perf_evlist__config_attrs(struct perf_evlist *evlist,
-			       struct perf_record_opts *opts)
+void perf_evlist__config(struct perf_evlist *evlist,
+			struct perf_record_opts *opts)
 {
 	struct perf_evsel *evsel;
+	/*
+	 * Set the evsel leader links before we configure attributes,
+	 * since some might depend on this info.
+	 */
+	if (opts->group)
+		perf_evlist__set_leader(evlist);
 
 	if (evlist->cpus->map[0] < 0)
 		opts->no_inherit = true;
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 56003f7..457e235 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -76,8 +76,8 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *self, int idx);
 
 int perf_evlist__open(struct perf_evlist *evlist);
 
-void perf_evlist__config_attrs(struct perf_evlist *evlist,
-			       struct perf_record_opts *opts);
+void perf_evlist__config(struct perf_evlist *evlist,
+			 struct perf_record_opts *opts);
 
 int perf_evlist__prepare_workload(struct perf_evlist *evlist,
 				  struct perf_record_opts *opts,
-- 
1.7.9.2.358.g22243


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

* [PATCH 32/37] perf evsel: Adopt fprintf routine from 'perf evlist'
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (30 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 31/37] perf evlist: Set the leader in the perf_evlist__config method Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 33/37] perf tools: Add install-bin Makefile target Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

So that we can print all the details when debugging other tools,
when we have just evlists and evsels, not a perf.data 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-mktq5fy2h5z7jyeqvvf5mbc8@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-evlist.c |   81 ++-----------------------------------------
 tools/perf/util/evsel.c     |   77 ++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/evsel.h     |    8 +++++
 3 files changed, 87 insertions(+), 79 deletions(-)

diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c
index c20f1dc..1312a5e 100644
--- a/tools/perf/builtin-evlist.c
+++ b/tools/perf/builtin-evlist.c
@@ -15,39 +15,6 @@
 #include "util/parse-options.h"
 #include "util/session.h"
 
-struct perf_attr_details {
-	bool freq;
-	bool verbose;
-};
-
-static int comma_printf(bool *first, const char *fmt, ...)
-{
-	va_list args;
-	int ret = 0;
-
-	if (!*first) {
-		ret += printf(",");
-	} else {
-		ret += printf(":");
-		*first = false;
-	}
-
-	va_start(args, fmt);
-	ret += vprintf(fmt, args);
-	va_end(args);
-	return ret;
-}
-
-static int __if_print(bool *first, const char *field, u64 value)
-{
-	if (value == 0)
-		return 0;
-
-	return comma_printf(first, " %s: %" PRIu64, field, value);
-}
-
-#define if_print(field) __if_print(&first, #field, pos->attr.field)
-
 static int __cmd_evlist(const char *file_name, struct perf_attr_details *details)
 {
 	struct perf_session *session;
@@ -57,52 +24,8 @@ static int __cmd_evlist(const char *file_name, struct perf_attr_details *details
 	if (session == NULL)
 		return -ENOMEM;
 
-	list_for_each_entry(pos, &session->evlist->entries, node) {
-		bool first = true;
-
-		printf("%s", perf_evsel__name(pos));
-
-		if (details->verbose || details->freq) {
-			comma_printf(&first, " sample_freq=%" PRIu64,
-				     (u64)pos->attr.sample_freq);
-		}
-
-		if (details->verbose) {
-			if_print(type);
-			if_print(config);
-			if_print(config1);
-			if_print(config2);
-			if_print(size);
-			if_print(sample_type);
-			if_print(read_format);
-			if_print(disabled);
-			if_print(inherit);
-			if_print(pinned);
-			if_print(exclusive);
-			if_print(exclude_user);
-			if_print(exclude_kernel);
-			if_print(exclude_hv);
-			if_print(exclude_idle);
-			if_print(mmap);
-			if_print(comm);
-			if_print(freq);
-			if_print(inherit_stat);
-			if_print(enable_on_exec);
-			if_print(task);
-			if_print(watermark);
-			if_print(precise_ip);
-			if_print(mmap_data);
-			if_print(sample_id_all);
-			if_print(exclude_host);
-			if_print(exclude_guest);
-			if_print(__reserved_1);
-			if_print(wakeup_events);
-			if_print(bp_type);
-			if_print(branch_sample_type);
-		}
-
-		putchar('\n');
-	}
+	list_for_each_entry(pos, &session->evlist->entries, node)
+		perf_evsel__fprintf(pos, details, stdout);
 
 	perf_session__delete(session);
 	return 0;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 2492d32..643df4b 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1228,3 +1228,80 @@ u64 perf_evsel__intval(struct perf_evsel *evsel, struct perf_sample *sample,
 
 	return 0;
 }
+
+static int comma_fprintf(FILE *fp, bool *first, const char *fmt, ...)
+{
+	va_list args;
+	int ret = 0;
+
+	if (!*first) {
+		ret += fprintf(fp, ",");
+	} else {
+		ret += fprintf(fp, ":");
+		*first = false;
+	}
+
+	va_start(args, fmt);
+	ret += vfprintf(fp, fmt, args);
+	va_end(args);
+	return ret;
+}
+
+static int __if_fprintf(FILE *fp, bool *first, const char *field, u64 value)
+{
+	if (value == 0)
+		return 0;
+
+	return comma_fprintf(fp, first, " %s: %" PRIu64, field, value);
+}
+
+#define if_print(field) printed += __if_fprintf(fp, &first, #field, evsel->attr.field)
+
+int perf_evsel__fprintf(struct perf_evsel *evsel,
+			struct perf_attr_details *details, FILE *fp)
+{
+	bool first = true;
+	int printed = fprintf(fp, "%s", perf_evsel__name(evsel));
+
+	if (details->verbose || details->freq) {
+		printed += comma_fprintf(fp, &first, " sample_freq=%" PRIu64,
+					 (u64)evsel->attr.sample_freq);
+	}
+
+	if (details->verbose) {
+		if_print(type);
+		if_print(config);
+		if_print(config1);
+		if_print(config2);
+		if_print(size);
+		if_print(sample_type);
+		if_print(read_format);
+		if_print(disabled);
+		if_print(inherit);
+		if_print(pinned);
+		if_print(exclusive);
+		if_print(exclude_user);
+		if_print(exclude_kernel);
+		if_print(exclude_hv);
+		if_print(exclude_idle);
+		if_print(mmap);
+		if_print(comm);
+		if_print(freq);
+		if_print(inherit_stat);
+		if_print(enable_on_exec);
+		if_print(task);
+		if_print(watermark);
+		if_print(precise_ip);
+		if_print(mmap_data);
+		if_print(sample_id_all);
+		if_print(exclude_host);
+		if_print(exclude_guest);
+		if_print(__reserved_1);
+		if_print(wakeup_events);
+		if_print(bp_type);
+		if_print(branch_sample_type);
+	}
+
+	fputc('\n', fp);
+	return ++printed;
+}
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 5c08977..9cb8a02 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -243,4 +243,12 @@ static inline bool perf_evsel__is_group_leader(const struct perf_evsel *evsel)
 {
 	return evsel->leader == evsel;
 }
+
+struct perf_attr_details {
+	bool freq;
+	bool verbose;
+};
+
+int perf_evsel__fprintf(struct perf_evsel *evsel,
+			struct perf_attr_details *details, FILE *fp);
 #endif /* __PERF_EVSEL_H */
-- 
1.7.9.2.358.g22243


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

* [PATCH 33/37] perf tools: Add install-bin Makefile target
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (31 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 32/37] perf evsel: Adopt fprintf routine from 'perf evlist' Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 34/37] perf evsel: Decode read_format and sample_type in perf_evsel__fprintf Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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 too annoying to go over the Documentation install target while
developing the tools.

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-cfzcxj8sp727h0sgfcvvwva1@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 10aa24c..317766e 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -1102,7 +1102,7 @@ perfexec_instdir = $(prefix)/$(perfexecdir)
 endif
 perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir))
 
-install: all try-install-man
+install-bin: all
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
 	$(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
@@ -1123,6 +1123,8 @@ install: all try-install-man
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
 	$(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
 
+install: install-bin try-install-man
+
 install-python_ext:
 	$(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
 
-- 
1.7.9.2.358.g22243


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

* [PATCH 34/37] perf evsel: Decode read_format and sample_type in perf_evsel__fprintf
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (32 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 33/37] perf tools: Add install-bin Makefile target Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 35/37] perf record: Pass perf_record_opts to the callchain cmdline parsing callback Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

Before those fields showed just a number, now it decodes each bit:

[root@sandy linux]# perf evlist -v
cycles: sample_freq=4000, size: 96, sample_type: IP|TID|TIME|CPU|PERIOD, read_format: TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING|ID, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, sample_id_all: 1, exclude_guest: 1

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-64ezdtiijolgti08ae3phxyj@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.c |   52 +++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 50 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 643df4b..7a2a3dc 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1257,6 +1257,53 @@ static int __if_fprintf(FILE *fp, bool *first, const char *field, u64 value)
 
 #define if_print(field) printed += __if_fprintf(fp, &first, #field, evsel->attr.field)
 
+struct bit_names {
+	int bit;
+	const char *name;
+};
+
+static int bits__fprintf(FILE *fp, const char *field, u64 value,
+			 struct bit_names *bits, bool *first)
+{
+	int i = 0, printed = comma_fprintf(fp, first, " %s: ", field);
+	bool first_bit = true;
+
+	do {
+		if (value & bits[i].bit) {
+			printed += fprintf(fp, "%s%s", first_bit ? "" : "|", bits[i].name);
+			first_bit = false;
+		}
+	} while (bits[++i].name != NULL);
+
+	return printed;
+}
+
+static int sample_type__fprintf(FILE *fp, bool *first, u64 value)
+{
+#define bit_name(n) { PERF_SAMPLE_##n, #n }
+	struct bit_names bits[] = {
+		bit_name(IP), bit_name(TID), bit_name(TIME), bit_name(ADDR),
+		bit_name(READ), bit_name(CALLCHAIN), bit_name(ID), bit_name(CPU),
+		bit_name(PERIOD), bit_name(STREAM_ID), bit_name(RAW),
+		bit_name(BRANCH_STACK), bit_name(REGS_USER), bit_name(STACK_USER),
+		{ .name = NULL, }
+	};
+#undef bit_name
+	return bits__fprintf(fp, "sample_type", value, bits, first);
+}
+
+static int read_format__fprintf(FILE *fp, bool *first, u64 value)
+{
+#define bit_name(n) { PERF_FORMAT_##n, #n }
+	struct bit_names bits[] = {
+		bit_name(TOTAL_TIME_ENABLED), bit_name(TOTAL_TIME_RUNNING),
+		bit_name(ID), bit_name(GROUP),
+		{ .name = NULL, }
+	};
+#undef bit_name
+	return bits__fprintf(fp, "read_format", value, bits, first);
+}
+
 int perf_evsel__fprintf(struct perf_evsel *evsel,
 			struct perf_attr_details *details, FILE *fp)
 {
@@ -1274,8 +1321,9 @@ int perf_evsel__fprintf(struct perf_evsel *evsel,
 		if_print(config1);
 		if_print(config2);
 		if_print(size);
-		if_print(sample_type);
-		if_print(read_format);
+		printed += sample_type__fprintf(fp, &first, evsel->attr.sample_type);
+		if (evsel->attr.read_format)
+			printed += read_format__fprintf(fp, &first, evsel->attr.read_format);
 		if_print(disabled);
 		if_print(inherit);
 		if_print(pinned);
-- 
1.7.9.2.358.g22243


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

* [PATCH 35/37] perf record: Pass perf_record_opts to the callchain cmdline parsing callback
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (33 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 34/37] perf evsel: Decode read_format and sample_type in perf_evsel__fprintf Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 36/37] perf record: Export the callchain parsing routine and help Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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 all it uses and makes the parsing callback suitable for use by
'perf top', which will happen in a followup 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-wb9eti78bk2jd7wpasro8hsz@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |   24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index fc4f080..d035040 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -868,11 +868,9 @@ static int get_stack_size(char *str, unsigned long *_size)
 }
 #endif /* LIBUNWIND_SUPPORT */
 
-static int
-parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg,
-		    int unset)
+static int parse_callchain_opt(const struct option *opt, const char *arg, int unset)
 {
-	struct perf_record *rec = (struct perf_record *)opt->value;
+	struct perf_record_opts *opts = opt->value;
 	char *tok, *name, *saveptr = NULL;
 	char *buf;
 	int ret = -1;
@@ -898,7 +896,7 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg,
 		/* Framepointer style */
 		if (!strncmp(name, "fp", sizeof("fp"))) {
 			if (!strtok_r(NULL, ",", &saveptr)) {
-				rec->opts.call_graph = CALLCHAIN_FP;
+				opts->call_graph = CALLCHAIN_FP;
 				ret = 0;
 			} else
 				pr_err("callchain: No more arguments "
@@ -911,20 +909,20 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg,
 			const unsigned long default_stack_dump_size = 8192;
 
 			ret = 0;
-			rec->opts.call_graph = CALLCHAIN_DWARF;
-			rec->opts.stack_dump_size = default_stack_dump_size;
+			opts->call_graph = CALLCHAIN_DWARF;
+			opts->stack_dump_size = default_stack_dump_size;
 
 			tok = strtok_r(NULL, ",", &saveptr);
 			if (tok) {
 				unsigned long size = 0;
 
 				ret = get_stack_size(tok, &size);
-				rec->opts.stack_dump_size = size;
+				opts->stack_dump_size = size;
 			}
 
 			if (!ret)
 				pr_debug("callchain: stack dump size %d\n",
-					 rec->opts.stack_dump_size);
+					 opts->stack_dump_size);
 #endif /* LIBUNWIND_SUPPORT */
 		} else {
 			pr_err("callchain: Unknown -g option "
@@ -937,7 +935,7 @@ parse_callchain_opt(const struct option *opt __maybe_unused, const char *arg,
 	free(buf);
 
 	if (!ret)
-		pr_debug("callchain: type %d\n", rec->opts.call_graph);
+		pr_debug("callchain: type %d\n", opts->call_graph);
 
 	return ret;
 }
@@ -1021,9 +1019,9 @@ const struct option record_options[] = {
 		     "number of mmap data pages"),
 	OPT_BOOLEAN(0, "group", &record.opts.group,
 		    "put the counters into a counter group"),
-	OPT_CALLBACK_DEFAULT('g', "call-graph", &record, "mode[,dump_size]",
-			     callchain_help, &parse_callchain_opt,
-			     "fp"),
+	OPT_CALLBACK_DEFAULT('g', "call-graph", &record.opts,
+			     "mode[,dump_size]", callchain_help,
+			     &parse_callchain_opt, "fp"),
 	OPT_INCR('v', "verbose", &verbose,
 		    "be more verbose (show counter open errors, etc)"),
 	OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"),
-- 
1.7.9.2.358.g22243


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

* [PATCH 36/37] perf record: Export the callchain parsing routine and help
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (34 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 35/37] perf record: Pass perf_record_opts to the callchain cmdline parsing callback Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2012-12-11 22:48 ` [PATCH 37/37] perf top: Use perf_evlist__config() Arnaldo Carvalho de Melo
  2013-01-24 15:32 ` [GIT PULL 00/37] perf/core improvements and fixes Ingo Molnar
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

Will be used by perf top, that will first setup the symbol system to
deal with callchains and then call these routines to ask the kernel
for callchains.

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-jg0dh8rmlx7x11e7u7mnasvd@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |   11 ++++++-----
 tools/perf/util/callchain.h |    5 +++++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d035040..028de72 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -868,7 +868,8 @@ static int get_stack_size(char *str, unsigned long *_size)
 }
 #endif /* LIBUNWIND_SUPPORT */
 
-static int parse_callchain_opt(const struct option *opt, const char *arg, int unset)
+int record_parse_callchain_opt(const struct option *opt,
+			       const char *arg, int unset)
 {
 	struct perf_record_opts *opts = opt->value;
 	char *tok, *name, *saveptr = NULL;
@@ -973,9 +974,9 @@ static struct perf_record record = {
 #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
 
 #ifdef LIBUNWIND_SUPPORT
-static const char callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
+const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
 #else
-static const char callchain_help[] = CALLCHAIN_HELP "[fp]";
+const char record_callchain_help[] = CALLCHAIN_HELP "[fp]";
 #endif
 
 /*
@@ -1020,8 +1021,8 @@ const struct option record_options[] = {
 	OPT_BOOLEAN(0, "group", &record.opts.group,
 		    "put the counters into a counter group"),
 	OPT_CALLBACK_DEFAULT('g', "call-graph", &record.opts,
-			     "mode[,dump_size]", callchain_help,
-			     &parse_callchain_opt, "fp"),
+			     "mode[,dump_size]", record_callchain_help,
+			     &record_parse_callchain_opt, "fp"),
 	OPT_INCR('v', "verbose", &verbose,
 		    "be more verbose (show counter open errors, etc)"),
 	OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"),
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index eb34057..3ee9f67 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -143,4 +143,9 @@ static inline void callchain_cursor_advance(struct callchain_cursor *cursor)
 	cursor->curr = cursor->curr->next;
 	cursor->pos++;
 }
+
+struct option;
+
+int record_parse_callchain_opt(const struct option *opt, const char *arg, int unset);
+extern const char record_callchain_help[];
 #endif	/* __PERF_CALLCHAIN_H */
-- 
1.7.9.2.358.g22243


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

* [PATCH 37/37] perf top: Use perf_evlist__config()
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (35 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 36/37] perf record: Export the callchain parsing routine and help Arnaldo Carvalho de Melo
@ 2012-12-11 22:48 ` Arnaldo Carvalho de Melo
  2013-01-24 15:32 ` [GIT PULL 00/37] perf/core improvements and fixes Ingo Molnar
  37 siblings, 0 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-12-11 22:48 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>

Using struct perf_record_opts to specify how to configure the evsel
perf_event_attrs.

This gets top closer to record in the way it sets up evsels, with the
aim of sharing more and more to the point that both will be a single
utility.

In this direction top now uses the same callchain option parsing as
record and that brings DWARF callchains to top, something that was
already available for record.

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-u03o0bsrqcjgskciso3pvsjr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-top.txt |    2 +-
 tools/perf/builtin-top.c              |  204 +++++++++++----------------------
 tools/perf/util/top.c                 |   22 ++--
 tools/perf/util/top.h                 |    8 +-
 4 files changed, 79 insertions(+), 157 deletions(-)

diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index 5b80d84..a414bc9 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -60,7 +60,7 @@ Default is to monitor all CPUS.
 
 -i::
 --inherit::
-	Child tasks inherit counters, only makes sens with -p option.
+	Child tasks do not inherit counters.
 
 -k <path>::
 --vmlinux=<path>::
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index a306474..b7d2ea6 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -596,7 +596,7 @@ static void *display_thread_tui(void *arg)
 	 * via --uid.
 	 */
 	list_for_each_entry(pos, &top->evlist->entries, node)
-		pos->hists.uid_filter_str = top->target.uid_str;
+		pos->hists.uid_filter_str = top->record_opts.target.uid_str;
 
 	perf_evlist__tui_browse_hists(top->evlist, help, &hbt,
 				      &top->session->header.env);
@@ -894,34 +894,13 @@ static void perf_top__start_counters(struct perf_top *top)
 {
 	struct perf_evsel *counter;
 	struct perf_evlist *evlist = top->evlist;
+	struct perf_record_opts *opts = &top->record_opts;
 
-	if (top->group)
-		perf_evlist__set_leader(evlist);
+	perf_evlist__config(evlist, opts);
 
 	list_for_each_entry(counter, &evlist->entries, node) {
 		struct perf_event_attr *attr = &counter->attr;
 
-		perf_evsel__set_sample_bit(counter, IP);
-		perf_evsel__set_sample_bit(counter, TID);
-
-		if (top->freq) {
-			perf_evsel__set_sample_bit(counter, PERIOD);
-			attr->freq	  = 1;
-			attr->sample_freq = top->freq;
-		}
-
-		if (evlist->nr_entries > 1)
-			perf_evsel__set_sample_id(counter);
-
-		if (perf_target__has_cpu(&top->target))
-			perf_evsel__set_sample_bit(counter, CPU);
-
-		if (symbol_conf.use_callchain)
-			perf_evsel__set_sample_bit(counter, CALLCHAIN);
-
-		attr->mmap = 1;
-		attr->comm = 1;
-		attr->inherit = top->inherit;
 fallback_missing_features:
 		if (top->exclude_guest_missing)
 			attr->exclude_guest = attr->exclude_host = 0;
@@ -995,7 +974,7 @@ try_again:
 		}
 	}
 
-	if (perf_evlist__mmap(evlist, top->mmap_pages, false) < 0) {
+	if (perf_evlist__mmap(evlist, opts->mmap_pages, false) < 0) {
 		ui__error("Failed to mmap with %d (%s)\n",
 			    errno, strerror(errno));
 		goto out_err;
@@ -1015,7 +994,7 @@ static int perf_top__setup_sample_type(struct perf_top *top)
 			ui__error("Selected -g but \"sym\" not present in --sort/-s.");
 			return -EINVAL;
 		}
-	} else if (!top->dont_use_callchains && callchain_param.mode != CHAIN_NONE) {
+	} else if (callchain_param.mode != CHAIN_NONE) {
 		if (callchain_register_param(&callchain_param) < 0) {
 			ui__error("Can't register callchain params.\n");
 			return -EINVAL;
@@ -1027,6 +1006,7 @@ static int perf_top__setup_sample_type(struct perf_top *top)
 
 static int __cmd_top(struct perf_top *top)
 {
+	struct perf_record_opts *opts = &top->record_opts;
 	pthread_t thread;
 	int ret;
 	/*
@@ -1041,7 +1021,7 @@ static int __cmd_top(struct perf_top *top)
 	if (ret)
 		goto out_delete;
 
-	if (perf_target__has_task(&top->target))
+	if (perf_target__has_task(&opts->target))
 		perf_event__synthesize_thread_map(&top->tool, top->evlist->threads,
 						  perf_event__process,
 						  &top->session->host_machine);
@@ -1052,6 +1032,17 @@ static int __cmd_top(struct perf_top *top)
 	top->session->evlist = top->evlist;
 	perf_session__set_id_hdr_size(top->session);
 
+	/*
+	 * When perf is starting the traced process, all the events (apart from
+	 * group members) have enable_on_exec=1 set, so don't spoil it by
+	 * prematurely enabling them.
+	 *
+	 * XXX 'top' still doesn't start workloads like record, trace, but should,
+	 * so leave the check here.
+	 */
+        if (!perf_target__none(&opts->target))
+                perf_evlist__enable(top->evlist);
+
 	/* Wait for a minimal set of events before starting the snapshot */
 	poll(top->evlist->pollfd, top->evlist->nr_fds, 100);
 
@@ -1092,116 +1083,56 @@ out_delete:
 static int
 parse_callchain_opt(const struct option *opt, const char *arg, int unset)
 {
-	struct perf_top *top = (struct perf_top *)opt->value;
-	char *tok, *tok2;
-	char *endptr;
-
 	/*
 	 * --no-call-graph
 	 */
-	if (unset) {
-		top->dont_use_callchains = true;
+	if (unset)
 		return 0;
-	}
 
 	symbol_conf.use_callchain = true;
 
-	if (!arg)
-		return 0;
-
-	tok = strtok((char *)arg, ",");
-	if (!tok)
-		return -1;
-
-	/* get the output mode */
-	if (!strncmp(tok, "graph", strlen(arg)))
-		callchain_param.mode = CHAIN_GRAPH_ABS;
-
-	else if (!strncmp(tok, "flat", strlen(arg)))
-		callchain_param.mode = CHAIN_FLAT;
-
-	else if (!strncmp(tok, "fractal", strlen(arg)))
-		callchain_param.mode = CHAIN_GRAPH_REL;
-
-	else if (!strncmp(tok, "none", strlen(arg))) {
-		callchain_param.mode = CHAIN_NONE;
-		symbol_conf.use_callchain = false;
-
-		return 0;
-	} else
-		return -1;
-
-	/* get the min percentage */
-	tok = strtok(NULL, ",");
-	if (!tok)
-		goto setup;
-
-	callchain_param.min_percent = strtod(tok, &endptr);
-	if (tok == endptr)
-		return -1;
-
-	/* get the print limit */
-	tok2 = strtok(NULL, ",");
-	if (!tok2)
-		goto setup;
-
-	if (tok2[0] != 'c') {
-		callchain_param.print_limit = strtod(tok2, &endptr);
-		tok2 = strtok(NULL, ",");
-		if (!tok2)
-			goto setup;
-	}
-
-	/* get the call chain order */
-	if (!strcmp(tok2, "caller"))
-		callchain_param.order = ORDER_CALLER;
-	else if (!strcmp(tok2, "callee"))
-		callchain_param.order = ORDER_CALLEE;
-	else
-		return -1;
-setup:
-	if (callchain_register_param(&callchain_param) < 0) {
-		fprintf(stderr, "Can't register callchain params\n");
-		return -1;
-	}
-	return 0;
+	return record_parse_callchain_opt(opt, arg, unset);
 }
 
 int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 {
-	struct perf_evsel *pos;
 	int status;
 	char errbuf[BUFSIZ];
 	struct perf_top top = {
 		.count_filter	     = 5,
 		.delay_secs	     = 2,
-		.freq		     = 4000, /* 4 KHz */
-		.mmap_pages	     = 128,
-		.sym_pcnt_filter     = 5,
-		.target		     = {
-			.uses_mmap   = true,
+		.record_opts = {
+			.mmap_pages	= UINT_MAX,
+			.user_freq	= UINT_MAX,
+			.user_interval	= ULLONG_MAX,
+			.freq		= 4000, /* 4 KHz */
+			.target		     = {
+				.uses_mmap   = true,
+			},
 		},
+		.sym_pcnt_filter     = 5,
 	};
-	char callchain_default_opt[] = "fractal,0.5,callee";
+	struct perf_record_opts *opts = &top.record_opts;
+	struct perf_target *target = &opts->target;
 	const struct option options[] = {
 	OPT_CALLBACK('e', "event", &top.evlist, "event",
 		     "event selector. use 'perf list' to list available events",
 		     parse_events_option),
-	OPT_INTEGER('c', "count", &top.default_interval,
-		    "event period to sample"),
-	OPT_STRING('p', "pid", &top.target.pid, "pid",
+	OPT_U64('c', "count", &opts->user_interval, "event period to sample"),
+	OPT_STRING('p', "pid", &target->pid, "pid",
 		    "profile events on existing process id"),
-	OPT_STRING('t', "tid", &top.target.tid, "tid",
+	OPT_STRING('t', "tid", &target->tid, "tid",
 		    "profile events on existing thread id"),
-	OPT_BOOLEAN('a', "all-cpus", &top.target.system_wide,
+	OPT_BOOLEAN('a', "all-cpus", &target->system_wide,
 			    "system-wide collection from all CPUs"),
-	OPT_STRING('C', "cpu", &top.target.cpu_list, "cpu",
+	OPT_STRING('C', "cpu", &target->cpu_list, "cpu",
 		    "list of cpus to monitor"),
 	OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
 		   "file", "vmlinux pathname"),
 	OPT_BOOLEAN('K', "hide_kernel_symbols", &top.hide_kernel_symbols,
 		    "hide kernel symbols"),
-	OPT_UINTEGER('m', "mmap-pages", &top.mmap_pages, "number of mmap data pages"),
+	OPT_UINTEGER('m', "mmap-pages", &opts->mmap_pages,
+		     "number of mmap data pages"),
 	OPT_INTEGER('r', "realtime", &top.realtime_prio,
 		    "collect data with this RT SCHED_FIFO priority"),
 	OPT_INTEGER('d', "delay", &top.delay_secs,
@@ -1210,16 +1141,14 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 			    "dump the symbol table used for profiling"),
 	OPT_INTEGER('f', "count-filter", &top.count_filter,
 		    "only display functions with more events than this"),
-	OPT_BOOLEAN('g', "group", &top.group,
+	OPT_BOOLEAN('g', "group", &opts->group,
 			    "put the counters into a counter group"),
-	OPT_BOOLEAN('i', "inherit", &top.inherit,
-		    "child tasks inherit counters"),
+	OPT_BOOLEAN('i', "no-inherit", &opts->no_inherit,
+		    "child tasks do not inherit counters"),
 	OPT_STRING(0, "sym-annotate", &top.sym_filter, "symbol name",
 		    "symbol to annotate"),
-	OPT_BOOLEAN('z', "zero", &top.zero,
-		    "zero history across updates"),
-	OPT_INTEGER('F', "freq", &top.freq,
-		    "profile at this frequency"),
+	OPT_BOOLEAN('z', "zero", &top.zero, "zero history across updates"),
+	OPT_UINTEGER('F', "freq", &opts->user_freq, "profile at this frequency"),
 	OPT_INTEGER('E', "entries", &top.print_entries,
 		    "display this many functions"),
 	OPT_BOOLEAN('U', "hide_user_symbols", &top.hide_user_symbols,
@@ -1232,10 +1161,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 		   "sort by key(s): pid, comm, dso, symbol, parent"),
 	OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
 		    "Show a column with the number of samples"),
-	OPT_CALLBACK_DEFAULT('G', "call-graph", &top, "output_type,min_percent, call_order",
-		     "Display callchains using output_type (graph, flat, fractal, or none), min percent threshold and callchain order. "
-		     "Default: fractal,0.5,callee", &parse_callchain_opt,
-		     callchain_default_opt),
+	OPT_CALLBACK_DEFAULT('G', "call-graph", &top.record_opts,
+			     "mode[,dump_size]", record_callchain_help,
+			     &parse_callchain_opt, "fp"),
 	OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
 		    "Show a column with the sum of periods"),
 	OPT_STRING(0, "dsos", &symbol_conf.dso_list_str, "dso[,dso...]",
@@ -1250,7 +1178,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 		    "Display raw encoding of assembly instructions (default)"),
 	OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
 		   "Specify disassembler style (e.g. -M intel for intel syntax)"),
-	OPT_STRING('u', "uid", &top.target.uid_str, "user", "user to profile"),
+	OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"),
 	OPT_END()
 	};
 	const char * const top_usage[] = {
@@ -1280,27 +1208,27 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	setup_browser(false);
 
-	status = perf_target__validate(&top.target);
+	status = perf_target__validate(target);
 	if (status) {
-		perf_target__strerror(&top.target, status, errbuf, BUFSIZ);
+		perf_target__strerror(target, status, errbuf, BUFSIZ);
 		ui__warning("%s", errbuf);
 	}
 
-	status = perf_target__parse_uid(&top.target);
+	status = perf_target__parse_uid(target);
 	if (status) {
 		int saved_errno = errno;
 
-		perf_target__strerror(&top.target, status, errbuf, BUFSIZ);
+		perf_target__strerror(target, status, errbuf, BUFSIZ);
 		ui__error("%s", errbuf);
 
 		status = -saved_errno;
 		goto out_delete_evlist;
 	}
 
-	if (perf_target__none(&top.target))
-		top.target.system_wide = true;
+	if (perf_target__none(target))
+		target->system_wide = true;
 
-	if (perf_evlist__create_maps(top.evlist, &top.target) < 0)
+	if (perf_evlist__create_maps(top.evlist, target) < 0)
 		usage_with_options(top_usage, options);
 
 	if (!top.evlist->nr_entries &&
@@ -1314,24 +1242,22 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 	if (top.delay_secs < 1)
 		top.delay_secs = 1;
 
+	if (opts->user_interval != ULLONG_MAX)
+		opts->default_interval = opts->user_interval;
+	if (opts->user_freq != UINT_MAX)
+		opts->freq = opts->user_freq;
+
 	/*
 	 * User specified count overrides default frequency.
 	 */
-	if (top.default_interval)
-		top.freq = 0;
-	else if (top.freq) {
-		top.default_interval = top.freq;
+	if (opts->default_interval)
+		opts->freq = 0;
+	else if (opts->freq) {
+		opts->default_interval = opts->freq;
 	} else {
 		ui__error("frequency and count are zero, aborting\n");
-		exit(EXIT_FAILURE);
-	}
-
-	list_for_each_entry(pos, &top.evlist->entries, node) {
-		/*
-		 * Fill in the ones not specifically initialized via -c:
-		 */
-		if (!pos->attr.sample_period)
-			pos->attr.sample_period = top.default_interval;
+		status = -EINVAL;
+		goto out_delete_evlist;
 	}
 
 	top.sym_evsel = perf_evlist__first(top.evlist);
diff --git a/tools/perf/util/top.c b/tools/perf/util/top.c
index 884dde9..54d37a4 100644
--- a/tools/perf/util/top.c
+++ b/tools/perf/util/top.c
@@ -26,6 +26,8 @@ size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size)
 	float samples_per_sec = top->samples / top->delay_secs;
 	float ksamples_per_sec = top->kernel_samples / top->delay_secs;
 	float esamples_percent = (100.0 * top->exact_samples) / top->samples;
+	struct perf_record_opts *opts = &top->record_opts;
+	struct perf_target *target = &opts->target;
 	size_t ret = 0;
 
 	if (!perf_guest) {
@@ -61,31 +63,31 @@ size_t perf_top__header_snprintf(struct perf_top *top, char *bf, size_t size)
 		struct perf_evsel *first = perf_evlist__first(top->evlist);
 		ret += SNPRINTF(bf + ret, size - ret, "%" PRIu64 "%s ",
 				(uint64_t)first->attr.sample_period,
-				top->freq ? "Hz" : "");
+				opts->freq ? "Hz" : "");
 	}
 
 	ret += SNPRINTF(bf + ret, size - ret, "%s", perf_evsel__name(top->sym_evsel));
 
 	ret += SNPRINTF(bf + ret, size - ret, "], ");
 
-	if (top->target.pid)
+	if (target->pid)
 		ret += SNPRINTF(bf + ret, size - ret, " (target_pid: %s",
-				top->target.pid);
-	else if (top->target.tid)
+				target->pid);
+	else if (target->tid)
 		ret += SNPRINTF(bf + ret, size - ret, " (target_tid: %s",
-				top->target.tid);
-	else if (top->target.uid_str != NULL)
+				target->tid);
+	else if (target->uid_str != NULL)
 		ret += SNPRINTF(bf + ret, size - ret, " (uid: %s",
-				top->target.uid_str);
+				target->uid_str);
 	else
 		ret += SNPRINTF(bf + ret, size - ret, " (all");
 
-	if (top->target.cpu_list)
+	if (target->cpu_list)
 		ret += SNPRINTF(bf + ret, size - ret, ", CPU%s: %s)",
 				top->evlist->cpus->nr > 1 ? "s" : "",
-				top->target.cpu_list);
+				target->cpu_list);
 	else {
-		if (top->target.tid)
+		if (target->tid)
 			ret += SNPRINTF(bf + ret, size - ret, ")");
 		else
 			ret += SNPRINTF(bf + ret, size - ret, ", %d CPU%s)",
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h
index 86ff1b1..927c229 100644
--- a/tools/perf/util/top.h
+++ b/tools/perf/util/top.h
@@ -14,7 +14,7 @@ struct perf_session;
 struct perf_top {
 	struct perf_tool   tool;
 	struct perf_evlist *evlist;
-	struct perf_target target;
+	struct perf_record_opts record_opts;
 	/*
 	 * Symbols will be added here in perf_event__process_sample and will
 	 * get out after decayed.
@@ -24,15 +24,11 @@ struct perf_top {
 	u64		   exact_samples;
 	u64		   guest_us_samples, guest_kernel_samples;
 	int		   print_entries, count_filter, delay_secs;
-	int		   freq;
 	bool		   hide_kernel_symbols, hide_user_symbols, zero;
 	bool		   use_tui, use_stdio;
 	bool		   sort_has_symbols;
-	bool		   dont_use_callchains;
 	bool		   kptr_restrict_warned;
 	bool		   vmlinux_warned;
-	bool		   inherit;
-	bool		   group;
 	bool		   sample_id_all_missing;
 	bool		   exclude_guest_missing;
 	bool		   dump_symtab;
@@ -40,8 +36,6 @@ struct perf_top {
 	struct perf_evsel  *sym_evsel;
 	struct perf_session *session;
 	struct winsize	   winsize;
-	unsigned int	   mmap_pages;
-	int		   default_interval;
 	int		   realtime_prio;
 	int		   sym_pcnt_filter;
 	const char	   *sym_filter;
-- 
1.7.9.2.358.g22243


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

* Re: [GIT PULL 00/37] perf/core improvements and fixes
  2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (36 preceding siblings ...)
  2012-12-11 22:48 ` [PATCH 37/37] perf top: Use perf_evlist__config() Arnaldo Carvalho de Melo
@ 2013-01-24 15:32 ` Ingo Molnar
  37 siblings, 0 replies; 53+ messages in thread
From: Ingo Molnar @ 2013-01-24 15:32 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Andi Kleen, Corey Ashford, David Ahern,
	David S. Miller, Feng Tang, Frank Eigler, Frederic Weisbecker,
	Jiri Olsa, Kushal Das, Mark Wielaard, Mike Galbraith,
	Namhyung Kim, Paul Mackerras, Pekka Enberg, Peter Zijlstra,
	Robert Richter, Stephane Eranian, Steven Rostedt, acme,
	Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Please consider pulling.
> 
> 	Jiri, tomorrow I'll go over the hists patches as I think you're fully
> ok with Namhyung latest patchset.
> 
> Regards,
> 
> - Arnaldo
> 
> The following changes since commit cc1b39dbf9f55a438e8a21a694394c20e6a17129:
> 
>   Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core (2012-12-08 15:54:35 +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 2376c67a7bbc7849b806688ba2efb8520c21c458:
> 
>   perf top: Use perf_evlist__config() (2012-12-11 17:22:39 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes
> 
> . perf build-id cache now can show DSOs present in a perf.data file that are
>   not in the cache, to integrate with build-id servers being put in place by
>   organizations such as Fedora.
> 
> . perf buildid-list -i an-elf-file-instead-of-a-perf.data is back showing its
>   build-id.
> 
> . No need to do feature checks when doing a 'make tags'
> 
> . Fix some 'perf test' errors and make them use the tracepoint evsel constructor.
> 
> . perf top now shares more of the evsel config/creation routines with 'record',
>   paving the way for further integration like 'top' snapshots, etc.
> 
> . perf top now supports DWARF callchains.
> 
> . perf evlist decodes sample_type and read_format, helping diagnose problems.
> 
> . Fix mmap limitations on 32-bit, fix from David Miller.
> 
> . perf diff fixes from Jiri Olsa.
> 
> . Ignore ABS symbols when loading data maps, fix from Namhyung Kim
> 
> . Hists improvements from Namhyung Kim
> 
> . Don't check configuration on make clean, from Namhyung Kim
> 
> . Fix dso__fprintf() print statement, from Stephane Eranian.
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (20):
>       perf top: Add missing newline on pr_err call
>       perf tools: Don't check configuration on make tags
>       perf tools: Fix TUI helpline output
>       perf buildid-list: We need to check if a file is ELF first
>       perf symbols: Generalize filter in __fprintf_buildid methods
>       perf buildid-cache: Add option to show build ids that are missing in the cache
>       perf machine: Move more machine methods to machine.c
>       perf evsel: Update sample_size when setting sample_type bits
>       perf test: Fixup error reporting in basic mmap test
>       perf test: Use perf_evsel__newtp constructor in the tracepoint tests
>       perf evsel: Introduce method to request IDs be used
>       perf evsel: No need to always ask for PERF_FORMAT_ID in read_format
>       perf evsel: No need to always ask for PERF_FORMAT_TOTAL_TIME_{ENABLED,RUNNING}
>       perf evlist: Set the leader in the perf_evlist__config method
>       perf evsel: Adopt fprintf routine from 'perf evlist'
>       perf tools: Add install-bin Makefile target
>       perf evsel: Decode read_format and sample_type in perf_evsel__fprintf
>       perf record: Pass perf_record_opts to the callchain cmdline parsing callback
>       perf record: Export the callchain parsing routine and help
>       perf top: Use perf_evlist__config()
> 
> David Miller (1):
>       perf tools: Fix mmap limitations on 32-bit
> 
> Jiri Olsa (6):
>       perf hists: Introduce perf_hpp__list for period related columns
>       perf hists: Fix period symbol_conf.field_sep display
>       perf diff: Remove displacement from struct hist_entry_diff
>       perf diff: Change compute methods to work with pair directly
>       perf diff: Change formula methods to work with pair directly
>       perf diff: Remove displacement output option
> 
> Namhyung Kim (9):
>       perf ui: Always compile error printing code
>       perf ui/helpline: Introduce ui_helpline__vshow()
>       perf tools: Don't check configuration on make clean
>       perf session: Free environment information when deleting session
>       perf symbols: Ignore ABS symbols when loading data maps
>       perf hists: Fix typo on hist__entry_add_pair
>       perf hists: Link hist entry pairs to leader
>       perf evsel: Set leader evsel's ->leader to itself
>       perf evsel: Convert to _is_group_leader method
> 
> Stephane Eranian (1):
>       perf symbols: Fix dso__fprintf() print statement
> 
>  tools/perf/Documentation/Makefile               |    4 +
>  tools/perf/Documentation/perf-buildid-cache.txt |    3 +
>  tools/perf/Documentation/perf-diff.txt          |    4 -
>  tools/perf/Documentation/perf-top.txt           |    2 +-
>  tools/perf/Makefile                             |   51 +-
>  tools/perf/builtin-buildid-cache.c              |   48 +-
>  tools/perf/builtin-buildid-list.c               |   21 +-
>  tools/perf/builtin-diff.c                       |  121 ++--
>  tools/perf/builtin-evlist.c                     |   81 +--
>  tools/perf/builtin-record.c                     |   40 +-
>  tools/perf/builtin-report.c                     |    1 +
>  tools/perf/builtin-stat.c                       |    2 +-
>  tools/perf/builtin-top.c                        |  207 ++-----
>  tools/perf/builtin-trace.c                      |    2 +-
>  tools/perf/tests/attr/base-record               |    2 +-
>  tools/perf/tests/attr/test-record-group         |    2 +
>  tools/perf/tests/attr/test-record-group1        |    2 +
>  tools/perf/tests/mmap-basic.c                   |   40 +-
>  tools/perf/tests/open-syscall-all-cpus.c        |   18 +-
>  tools/perf/tests/open-syscall.c                 |   17 +-
>  tools/perf/tests/parse-events.c                 |   20 +-
>  tools/perf/tests/perf-record.c                  |    8 +-
>  tools/perf/tests/tests.h                        |    3 -
>  tools/perf/tests/util.c                         |   30 -
>  tools/perf/ui/browsers/hists.c                  |   20 +-
>  tools/perf/ui/gtk/browser.c                     |   30 +-
>  tools/perf/ui/gtk/helpline.c                    |   23 +-
>  tools/perf/ui/helpline.c                        |   12 +
>  tools/perf/ui/helpline.h                        |   22 +-
>  tools/perf/ui/hist.c                            |  170 +++---
>  tools/perf/ui/setup.c                           |    1 +
>  tools/perf/ui/stdio/hist.c                      |   17 +-
>  tools/perf/ui/tui/helpline.c                    |   29 +-
>  tools/perf/ui/util.c                            |   10 +
>  tools/perf/util/callchain.h                     |    5 +
>  tools/perf/util/debug.c                         |   28 +-
>  tools/perf/util/debug.h                         |   33 +-
>  tools/perf/util/dso.c                           |    6 +-
>  tools/perf/util/dso.h                           |    2 +-
>  tools/perf/util/evlist.c                        |   17 +-
>  tools/perf/util/evlist.h                        |    4 +-
>  tools/perf/util/evsel.c                         |  186 +++++-
>  tools/perf/util/evsel.h                         |   25 +-
>  tools/perf/util/hist.c                          |    4 +-
>  tools/perf/util/hist.h                          |   22 +-
>  tools/perf/util/machine.c                       |  742 +++++++++++++++++++++++
>  tools/perf/util/machine.h                       |   11 +-
>  tools/perf/util/session.c                       |  256 +-------
>  tools/perf/util/session.h                       |    5 +-
>  tools/perf/util/sort.h                          |    5 +-
>  tools/perf/util/symbol-elf.c                    |   11 +
>  tools/perf/util/symbol.c                        |  522 +---------------
>  tools/perf/util/symbol.h                        |    4 +
>  tools/perf/util/thread.c                        |   20 +-
>  tools/perf/util/thread.h                        |    1 +
>  tools/perf/util/top.c                           |   22 +-
>  tools/perf/util/top.h                           |    8 +-
>  57 files changed, 1483 insertions(+), 1519 deletions(-)
>  delete mode 100644 tools/perf/tests/util.c

Pulled, thanks a lot Arnaldo!

	Ingo

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

* [GIT PULL 00/37] perf/core improvements and fixes
@ 2015-05-26 16:47 Arnaldo Carvalho de Melo
  2015-05-27  7:38 ` Ingo Molnar
  0 siblings, 1 reply; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-05-26 16:47 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, Namhyung Kim, Nam T . Nguyen, Paul Mackerras,
	Peter Zijlstra, Simon Que, Stephane Eranian,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Test built on Fedora21 x86_64, RHEL (5.11 with NO_AUXTRACE=1
NO_LIBPERL=1 NO_LIBNUMA=1, 6.6 and 7.1) all x86_64.

	Please consider applying,

- Arnaldo

The following changes since commit d499c106843afa0703a68c64662bf42a16421aec:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-05-20 13:23:55 +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 264ed8843fe2e4c24422ff61de1e3db609106445:

  perf tools: Put itrace options into an asciidoc include (2015-05-26 13:21:08 -0300)

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

New features:

- Intel PT support, should be complete now and possible to test it with what we
  already have in the kernel, go, test it and report problems on lkml, I'm sure
  Adrian will chime in if something doesn't work as documented. (Adrian Hunter)

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

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 (19):
      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
      perf auxtrace: Add Intel PT as an AUX area tracing type
      perf tools: Add Intel PT packet decoder
      perf tools: Add Intel PT instruction decoder
      perf tools: Add Intel PT log
      perf tools: Add Intel PT decoder
      perf tools: Add Intel PT support
      perf tools: Take Intel PT into use
      perf tools: Allow auxtrace data alignment
      perf tools: Add Intel BTS support
      perf tools: Output sample flags and insn_len from intel_pt
      perf tools: Output sample flags and insn_len from intel_bts
      perf tools: Intel PT to always update thread stack trace number
      perf tools: Intel BTS to always update thread stack trace number
      perf tools: Put itrace options into an asciidoc include

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

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/build/Makefile.build                         |    2 +
 tools/perf/.gitignore                              |    2 +
 tools/perf/Documentation/intel-bts.txt             |   69 +
 tools/perf/Documentation/intel-pt.txt              |  467 +++++
 tools/perf/Documentation/itrace.txt                |   22 +
 tools/perf/Documentation/perf-inject.txt           |   23 +-
 tools/perf/Documentation/perf-report.txt           |   23 +-
 tools/perf/Documentation/perf-script.txt           |   23 +-
 tools/perf/Makefile.perf                           |   18 +-
 tools/perf/arch/common.c                           |    2 +-
 tools/perf/arch/x86/util/Build                     |    5 +
 tools/perf/arch/x86/util/auxtrace.c                |   83 +
 tools/perf/arch/x86/util/intel-bts.c               |  458 +++++
 tools/perf/arch/x86/util/intel-pt.c                |  752 ++++++++
 tools/perf/arch/x86/util/pmu.c                     |   18 +
 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/Build                              |    3 +
 tools/perf/util/auxtrace.c                         |   16 +-
 tools/perf/util/auxtrace.h                         |    3 +
 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/intel-bts.c                        |  921 ++++++++++
 tools/perf/util/intel-bts.h                        |   43 +
 tools/perf/util/intel-pt-decoder/Build             |   14 +
 .../perf/util/intel-pt-decoder/intel-pt-decoder.c  | 1758 ++++++++++++++++++
 .../perf/util/intel-pt-decoder/intel-pt-decoder.h  |  102 ++
 .../util/intel-pt-decoder/intel-pt-insn-decoder.c  |  246 +++
 .../util/intel-pt-decoder/intel-pt-insn-decoder.h  |   65 +
 tools/perf/util/intel-pt-decoder/intel-pt-log.c    |  155 ++
 tools/perf/util/intel-pt-decoder/intel-pt-log.h    |   52 +
 .../util/intel-pt-decoder/intel-pt-pkt-decoder.c   |  400 +++++
 .../util/intel-pt-decoder/intel-pt-pkt-decoder.h   |   64 +
 tools/perf/util/intel-pt.c                         | 1895 ++++++++++++++++++++
 tools/perf/util/intel-pt.h                         |   51 +
 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/probe-event.c                      |    9 +-
 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 +-
 60 files changed, 7977 insertions(+), 243 deletions(-)
 create mode 100644 tools/perf/Documentation/intel-bts.txt
 create mode 100644 tools/perf/Documentation/intel-pt.txt
 create mode 100644 tools/perf/Documentation/itrace.txt
 create mode 100644 tools/perf/arch/x86/util/auxtrace.c
 create mode 100644 tools/perf/arch/x86/util/intel-bts.c
 create mode 100644 tools/perf/arch/x86/util/intel-pt.c
 create mode 100644 tools/perf/arch/x86/util/pmu.c
 create mode 100644 tools/perf/util/intel-bts.c
 create mode 100644 tools/perf/util/intel-bts.h
 create mode 100644 tools/perf/util/intel-pt-decoder/Build
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-decoder.h
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.h
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-log.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-log.h
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.h
 create mode 100644 tools/perf/util/intel-pt.c
 create mode 100644 tools/perf/util/intel-pt.h

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

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


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

> Hi Ingo,
> 
> 	Test built on Fedora21 x86_64, RHEL (5.11 with NO_AUXTRACE=1
> NO_LIBPERL=1 NO_LIBNUMA=1, 6.6 and 7.1) all x86_64.
> 
> 	Please consider applying,
> 
> - Arnaldo
> 
> The following changes since commit d499c106843afa0703a68c64662bf42a16421aec:
> 
>   Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-05-20 13:23:55 +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 264ed8843fe2e4c24422ff61de1e3db609106445:
> 
>   perf tools: Put itrace options into an asciidoc include (2015-05-26 13:21:08 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> New features:
> 
> - Intel PT support, should be complete now and possible to test it with what we
>   already have in the kernel, go, test it and report problems on lkml, I'm sure
>   Adrian will chime in if something doesn't work as documented. (Adrian Hunter)

So how can people follow your request?

The changelogs are minimal, sometimes they only say:

  From 7a84d68975f34c912cb6ec8adb3c1869c15b5c36 Mon Sep 17 00:00:00 2001
  From: Adrian Hunter <adrian.hunter@intel.com>
  Date: Fri, 22 May 2015 14:54:04 +0300
  Subject: [PATCH] perf tools: Add Intel PT support

  Add support for Intel Processor Trace.

there's almost zero comments added by these commits.

This commit:

  928541b6f51f perf tools: Take Intel PT into use

adds 'some documentation' under ./Documentation/intel-pt.txt, but that text 
doesn't actually give any high level description, it doesn't give _any_ way for a 
user to discover Intel PT support on his own - unless he already knows it, which 
is kind of circular.

It doesn't describe which CPUs support Intel PT, what it is, how are people 
supposed to use it, what the high level capabilities and limitations are, etc. 
etc.

So this stuff is user and developer hostile at the moment. We can push this 
towards Linus only if this becomes _much_ more user and developer friendly. Near 
zero documentation and near zero comments in the code don't cut it really.

Thanks,

	Ingo


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

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

Em Wed, May 27, 2015 at 09:38:47AM +0200, Ingo Molnar escreveu:
> * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> > New features:

> > - Intel PT support, should be complete now and possible to test it with what we
> >   already have in the kernel, go, test it and report problems on lkml, I'm sure
> >   Adrian will chime in if something doesn't work as documented. (Adrian Hunter)
 
> So how can people follow your request?

First by having access to a machine with these hardware features, which,
for one, I have no easy access to right now :-\
 
> The changelogs are minimal, sometimes they only say:

They improved over time, over the many resubmits Adrian made, so some
progress was made on this front.
 
>   From 7a84d68975f34c912cb6ec8adb3c1869c15b5c36 Mon Sep 17 00:00:00 2001
>   From: Adrian Hunter <adrian.hunter@intel.com>
>   Date: Fri, 22 May 2015 14:54:04 +0300
>   Subject: [PATCH] perf tools: Add Intel PT support

>   Add support for Intel Processor Trace.
 
> there's almost zero comments added by these commits.

I shouldn't have let some pass, granted.
 
> This commit:
> 
>   928541b6f51f perf tools: Take Intel PT into use
> 
> adds 'some documentation' under ./Documentation/intel-pt.txt, but that text 
> doesn't actually give any high level description, it doesn't give _any_ way for a 
> user to discover Intel PT support on his own - unless he already knows it, which 
> is kind of circular.

> It doesn't describe which CPUs support Intel PT, what it is, how are people 
> supposed to use it, what the high level capabilities and limitations are, etc. 
> etc.
 
> So this stuff is user and developer hostile at the moment. We can push this 
> towards Linus only if this becomes _much_ more user and developer friendly. Near 
> zero documentation and near zero comments in the code don't cut it really.

Adrian, can you try to address this further, please?

Something like a handholding session, so that we don't have to dig thru
all the csets or patch series cover letters, telling:

1. What hardware one has to have to be able to test it

2. First command to use

3. What will be generated, how much space (a lot?) it will use on the
   perf.data file, etc.

5. What commands have to be used on this perf.data file and what to
   expect from it.

I.e. a HOWTO that starts with a as short as possible description on how
 to use it for the very first time, for people never exposed to Intel PT
but that can benefit from using it.

Ingo, so I'll move these csets to a separate branch from where I can
work with Adrian and others to then try again to resubmit, but only on a
branch exclusively for this.

Will resubmit a perf/core branch with the remaining bits soon.

- Arnaldo

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

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

On 27/05/15 15:35, Arnaldo Carvalho de Melo wrote:
> Em Wed, May 27, 2015 at 09:38:47AM +0200, Ingo Molnar escreveu:
>> * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>>> New features:
> 
>>> - Intel PT support, should be complete now and possible to test it with what we
>>>   already have in the kernel, go, test it and report problems on lkml, I'm sure
>>>   Adrian will chime in if something doesn't work as documented. (Adrian Hunter)
>  
>> So how can people follow your request?
> 
> First by having access to a machine with these hardware features, which,
> for one, I have no easy access to right now :-\
>  
>> The changelogs are minimal, sometimes they only say:
> 
> They improved over time, over the many resubmits Adrian made, so some
> progress was made on this front.
>  
>>   From 7a84d68975f34c912cb6ec8adb3c1869c15b5c36 Mon Sep 17 00:00:00 2001
>>   From: Adrian Hunter <adrian.hunter@intel.com>
>>   Date: Fri, 22 May 2015 14:54:04 +0300
>>   Subject: [PATCH] perf tools: Add Intel PT support
> 
>>   Add support for Intel Processor Trace.
>  
>> there's almost zero comments added by these commits.
> 
> I shouldn't have let some pass, granted.
>  
>> This commit:
>>
>>   928541b6f51f perf tools: Take Intel PT into use
>>
>> adds 'some documentation' under ./Documentation/intel-pt.txt, but that text 
>> doesn't actually give any high level description, it doesn't give _any_ way for a 
>> user to discover Intel PT support on his own - unless he already knows it, which 
>> is kind of circular.
> 
>> It doesn't describe which CPUs support Intel PT, what it is, how are people 
>> supposed to use it, what the high level capabilities and limitations are, etc. 
>> etc.
>  
>> So this stuff is user and developer hostile at the moment. We can push this 
>> towards Linus only if this becomes _much_ more user and developer friendly. Near 
>> zero documentation and near zero comments in the code don't cut it really.
> 
> Adrian, can you try to address this further, please?

Yes, I will mainly expand the information in
tools/perf/Documentation/intel-pt.txt unless you have any other ideas.

> 
> Something like a handholding session, so that we don't have to dig thru
> all the csets or patch series cover letters, telling:
> 
> 1. What hardware one has to have to be able to test it
> 
> 2. First command to use
> 
> 3. What will be generated, how much space (a lot?) it will use on the
>    perf.data file, etc.
> 
> 5. What commands have to be used on this perf.data file and what to
>    expect from it.
> 
> I.e. a HOWTO that starts with a as short as possible description on how
>  to use it for the very first time, for people never exposed to Intel PT
> but that can benefit from using it.
> 
> Ingo, so I'll move these csets to a separate branch from where I can
> work with Adrian and others to then try again to resubmit, but only on a
> branch exclusively for this.
> 
> Will resubmit a perf/core branch with the remaining bits soon.
> 
> - Arnaldo
> 
> 


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

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


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

> Adrian, can you try to address this further, please?
> 
> Something like a handholding session, so that we don't have to dig thru all the 
> csets or patch series cover letters, telling:
> 
> 1. What hardware one has to have to be able to test it
> 
> 2. First command to use
> 
> 3. What will be generated, how much space (a lot?) it will use on the
>    perf.data file, etc.
> 
> 5. What commands have to be used on this perf.data file and what to
>    expect from it.
> 
> I.e. a HOWTO that starts with a as short as possible description on how
>  to use it for the very first time, for people never exposed to Intel PT
> but that can benefit from using it.

Yeah, a HOWTO or a QuickStart file would be a good first step I suspect.

> Ingo, so I'll move these csets to a separate branch from where I can
> work with Adrian and others to then try again to resubmit, but only on a
> branch exclusively for this.
> 
> Will resubmit a perf/core branch with the remaining bits soon.

Sounds good to me!

Thanks,

	Ingo

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

* Re: [GIT PULL 00/37] perf/core improvements and fixes
  2015-05-27 12:35   ` Arnaldo Carvalho de Melo
  2015-05-27 12:40     ` Adrian Hunter
  2015-05-27 12:45     ` Ingo Molnar
@ 2015-06-05 13:21     ` Adrian Hunter
  2015-06-05 14:08       ` Arnaldo Carvalho de Melo
  2 siblings, 1 reply; 53+ messages in thread
From: Adrian Hunter @ 2015-06-05 13:21 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ingo Molnar
  Cc: linux-kernel, Borislav Petkov, David Ahern, Don Zickus,
	Frederic Weisbecker, Jiri Olsa, Josef Bacik, kernel-team,
	Luigi Semenzato, Martin Liska, Namhyung Kim, Nam T . Nguyen,
	Paul Mackerras, Peter Zijlstra, Simon Que, Stephane Eranian

On 27/05/15 15:35, Arnaldo Carvalho de Melo wrote:
> Em Wed, May 27, 2015 at 09:38:47AM +0200, Ingo Molnar escreveu:
>> * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>>> New features:
> 
>>> - Intel PT support, should be complete now and possible to test it with what we
>>>   already have in the kernel, go, test it and report problems on lkml, I'm sure
>>>   Adrian will chime in if something doesn't work as documented. (Adrian Hunter)
>  
>> So how can people follow your request?
> 
> First by having access to a machine with these hardware features, which,
> for one, I have no easy access to right now :-\
>  
>> The changelogs are minimal, sometimes they only say:
> 
> They improved over time, over the many resubmits Adrian made, so some
> progress was made on this front.
>  
>>   From 7a84d68975f34c912cb6ec8adb3c1869c15b5c36 Mon Sep 17 00:00:00 2001
>>   From: Adrian Hunter <adrian.hunter@intel.com>
>>   Date: Fri, 22 May 2015 14:54:04 +0300
>>   Subject: [PATCH] perf tools: Add Intel PT support
> 
>>   Add support for Intel Processor Trace.
>  
>> there's almost zero comments added by these commits.
> 
> I shouldn't have let some pass, granted.
>  
>> This commit:
>>
>>   928541b6f51f perf tools: Take Intel PT into use
>>
>> adds 'some documentation' under ./Documentation/intel-pt.txt, but that text 
>> doesn't actually give any high level description, it doesn't give _any_ way for a 
>> user to discover Intel PT support on his own - unless he already knows it, which 
>> is kind of circular.
> 
>> It doesn't describe which CPUs support Intel PT, what it is, how are people 
>> supposed to use it, what the high level capabilities and limitations are, etc. 
>> etc.
>  
>> So this stuff is user and developer hostile at the moment. We can push this 
>> towards Linus only if this becomes _much_ more user and developer friendly. Near 
>> zero documentation and near zero comments in the code don't cut it really.
> 
> Adrian, can you try to address this further, please?
> 
> Something like a handholding session, so that we don't have to dig thru
> all the csets or patch series cover letters, telling:
> 
> 1. What hardware one has to have to be able to test it
> 
> 2. First command to use
> 
> 3. What will be generated, how much space (a lot?) it will use on the
>    perf.data file, etc.
> 
> 5. What commands have to be used on this perf.data file and what to
>    expect from it.
> 
> I.e. a HOWTO that starts with a as short as possible description on how
>  to use it for the very first time, for people never exposed to Intel PT
> but that can benefit from using it.

I sent the patches again a week ago, but perhaps no one noticed.  They are here:

	http://marc.info/?l=linux-kernel&m=143290658028132

Comments welcome :-)


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

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

Em Fri, Jun 05, 2015 at 04:21:44PM +0300, Adrian Hunter escreveu:
> On 27/05/15 15:35, Arnaldo Carvalho de Melo wrote:
> > Em Wed, May 27, 2015 at 09:38:47AM +0200, Ingo Molnar escreveu:
> >> So this stuff is user and developer hostile at the moment. We can push this 
> >> towards Linus only if this becomes _much_ more user and developer friendly. Near 
> >> zero documentation and near zero comments in the code don't cut it really.

> > Adrian, can you try to address this further, please?

> > Something like a handholding session, so that we don't have to dig thru
> > all the csets or patch series cover letters, telling:
> > 
> > 1. What hardware one has to have to be able to test it
> > 
> > 2. First command to use
> > 
> > 3. What will be generated, how much space (a lot?) it will use on the
> >    perf.data file, etc.
> > 
> > 5. What commands have to be used on this perf.data file and what to
> >    expect from it.
> > 
> > I.e. a HOWTO that starts with a as short as possible description on how
> >  to use it for the very first time, for people never exposed to Intel PT
> > but that can benefit from using it.
> 
> I sent the patches again a week ago, but perhaps no one noticed.  They are here:
> 
> 	http://marc.info/?l=linux-kernel&m=143290658028132
> 
> Comments welcome :-)

I saw it, was just busy with other stuff and was waiting for other
people to chime in, will look for that 'handholding session' and also
for a broadwell machine were I can try to follow it.

- Arnaldo

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

* [GIT PULL 00/37] perf/core improvements and fixes
@ 2015-11-19 17:52 Arnaldo Carvalho de Melo
  2015-11-20 10:01 ` 平松雅巳 / HIRAMATU,MASAMI
  2015-11-23  8:16 ` Ingo Molnar
  0 siblings, 2 replies; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-11-19 17:52 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexei Starovoitov, Alexey Dobriyan, Andi Kleen,
	Bamvor Jian Zhang, Brendan Gregg, Daniel Borkmann, David Ahern,
	Frederic Weisbecker, He Kuang, Jiri Olsa, Jonathan Cameron,
	Kaixu Xia, Kan Liang, Kevin Hilman, linaro-kernel,
	Masami Hiramatsu, Michael Ellerman, Namhyung Kim, Pali Rohar,
	Pavel Machek, Pekka Enberg, Peter Zijlstra, pi3orama,
	Roberta Dobrescu, Shuah Khan, Wang Nan, Zefan Li,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, this was based on tip/perf/urgent and I did a
test merge of tip/perf/core with tip/perf/urgent and then with this branch,
haven't noticed problems,

Best regards,

- Arnaldo

The following changes since commit e15bf88a44d1fcb685754b2868b1cd28927af3aa:

  Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2015-11-18 06:56:48 +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 2c6caff2b26fde8f3f87183f8c97f2cebfdbcb98:

  perf ui/gtk: Support folded callchains (2015-11-19 13:19:26 -0300)

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

User visible:

- Allows BPF scriptlets specify arguments to be fetched using
  DWARF info, using a prologue generated at compile/build time (He Kuang, Wang Nan)

- Allow attaching BPF scriptlets to module symbols (Wang Nan)

- Allow attaching BPF scriptlets to userspace code using uprobe (Wang Nan)

- BPF programs now can specify 'perf probe' tunables via its section name,
  separating key=val values using semicolons (Wang Nan)

Testing some of these new BPF features:

Use case: get callchains when receiving SSL packets, filter then in the
          kernel, at arbitrary place.

  # cat ssl.bpf.c
  #define SEC(NAME) __attribute__((section(NAME), used))

  struct pt_regs;

  SEC("func=__inet_lookup_established hnum")
  int func(struct pt_regs *ctx, int err, unsigned short port)
  {
          return err == 0 && port == 443;
  }

  char _license[] SEC("license") = "GPL";
  int  _version   SEC("version") = LINUX_VERSION_CODE;
  #
  # perf record -a -g -e ssl.bpf.c
  ^C[ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.787 MB perf.data (3 samples) ]
  # perf script | head -30
  swapper     0 [000] 58783.268118: perf_bpf_probe:func: (ffffffff816a0f60) hnum=0x1bb
	 8a0f61 __inet_lookup_established (/lib/modules/4.3.0+/build/vmlinux)
	 896def ip_rcv_finish (/lib/modules/4.3.0+/build/vmlinux)
	 8976c2 ip_rcv (/lib/modules/4.3.0+/build/vmlinux)
	 855eba __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
	 8572a8 process_backlog (/lib/modules/4.3.0+/build/vmlinux)
	 856b11 net_rx_action (/lib/modules/4.3.0+/build/vmlinux)
	 2a284b __do_softirq (/lib/modules/4.3.0+/build/vmlinux)
	 2a2ba3 irq_exit (/lib/modules/4.3.0+/build/vmlinux)
	 96b7a4 do_IRQ (/lib/modules/4.3.0+/build/vmlinux)
	 969807 ret_from_intr (/lib/modules/4.3.0+/build/vmlinux)
	 2dede5 cpu_startup_entry (/lib/modules/4.3.0+/build/vmlinux)
	 95d5bc rest_init (/lib/modules/4.3.0+/build/vmlinux)
	1163ffa start_kernel ([kernel.vmlinux].init.text)
	11634d7 x86_64_start_reservations ([kernel.vmlinux].init.text)
	1163623 x86_64_start_kernel ([kernel.vmlinux].init.text)

  qemu-system-x86  9178 [003] 58785.792417: perf_bpf_probe:func: (ffffffff816a0f60) hnum=0x1bb
	 8a0f61 __inet_lookup_established (/lib/modules/4.3.0+/build/vmlinux)
	 896def ip_rcv_finish (/lib/modules/4.3.0+/build/vmlinux)
	 8976c2 ip_rcv (/lib/modules/4.3.0+/build/vmlinux)
	 855eba __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
	 856660 netif_receive_skb_internal (/lib/modules/4.3.0+/build/vmlinux)
	 8566ec netif_receive_skb_sk (/lib/modules/4.3.0+/build/vmlinux)
	   430a br_handle_frame_finish ([bridge])
	   48bc br_handle_frame ([bridge])
	 855f44 __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
  #

  Use 'perf probe' various options to list functions, see what variables can
  be collected at any given point, experiment first collecting without a filter,
  then filter, use it together with 'perf trace', 'perf top', with or without
  callchains, if it explodes, please tell us!

- Introduce a new callchain mode: "folded", that will list per line
  representations of all callchains for a give histogram entry, facilitating
  'perf report' output processing by other tools, such as Brendan Gregg's
  flamegraph tools (Namhyung Kim)

  E.g:

 # perf report | grep -v ^# | head
    18.37%     0.00%  swapper  [kernel.kallsyms]   [k] cpu_startup_entry
                    |
                    ---cpu_startup_entry
                       |
                       |--12.07%--start_secondary
                       |
                        --6.30%--rest_init
                                  start_kernel
                                  x86_64_start_reservations
                                  x86_64_start_kernel
  #

 Becomes, in "folded" mode:

 # perf report -g folded | grep -v ^# | head -5
     18.37%     0.00%  swapper [kernel.kallsyms]   [k] cpu_startup_entry
   12.07% cpu_startup_entry;start_secondary
    6.30% cpu_startup_entry;rest_init;start_kernel;x86_64_start_reservations;x86_64_start_kernel
     16.90%     0.00%  swapper [kernel.kallsyms]   [k] call_cpuidle
   11.23% call_cpuidle;cpu_startup_entry;start_secondary
    5.67% call_cpuidle;cpu_startup_entry;rest_init;start_kernel;x86_64_start_reservations;x86_64_start_kernel
     16.90%     0.00%  swapper [kernel.kallsyms]   [k] cpuidle_enter
   11.23% cpuidle_enter;call_cpuidle;cpu_startup_entry;start_secondary
    5.67% cpuidle_enter;call_cpuidle;cpu_startup_entry;rest_init;start_kernel;x86_64_start_reservations;x86_64_start_kernel
     15.12%     0.00%  swapper [kernel.kallsyms]   [k] cpuidle_enter_state
  #

   The user can also select one of "count", "period" or "percent" as the first column.

Infrastructure:

- Fix multiple leaks found with valgrind and a refcount
  debugger (Masami Hiramatsu)

- Add further 'perf test' entries for BPF and LLVM (Wang Nan)

- Improve 'perf test' to suport subtests, so that the series of tests
  performed in the LLVM and BPF main tests appear in the default 'perf test'
  output (Wang Nan)

- Move memdup() from tools/perf to tools/lib/string.c (Arnaldo Carvalho de Melo)

- Adopt strtobool() from the kernel into tools/lib/ (Wang Nan)

- Fix selftests_install tools/ Makefile rule (Kevin Hilman)

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

----------------------------------------------------------------
Arnaldo Carvalho de Melo (3):
      perf test: Fix build of BPF and LLVM on older glibc libraries
      tools: Adopt memdup() from tools/perf, moving it to tools/lib/string.c
      perf tests: Pass the subtest index to each test routine

He Kuang (1):
      perf bpf: Add prologue for BPF programs for fetching arguments

Kevin Hilman (1):
      tools: Fix selftests_install Makefile rule

Masami Hiramatsu (9):
      perf probe: Fix to free temporal Dwarf_Frame
      perf machine: Fix machine__findnew_module_map to put registered map
      perf machine: Fix machine__destroy_kernel_maps to drop vmlinux_maps references
      perf machine: Fix to destroy kernel maps when machine exits
      perf tools: Make perf_exec_path() always return malloc'd string
      perf tools: Fix to put new map after inserting to map_groups in dso__load_sym
      perf tools: Fix __dsos__addnew to put dso after adding it to the list
      perf tools: Fix machine__create_kernel_maps to put kernel dso refcount
      perf machine: Fix machine__findnew_module_map to put dso

Namhyung Kim (9):
      perf report: Support folded callchain mode on --stdio
      perf callchain: Abstract callchain print function
      perf callchain: Add count fields to struct callchain_node
      perf report: Add callchain value option
      perf hists browser: Factor out hist_browser__show_callchain_list()
      perf hists browser: Support flat callchains
      perf hists browser: Support folded callchains
      perf ui/gtk: Support flat callchains
      perf ui/gtk: Support folded callchains

Wang Nan (14):
      tools: Clone the kernel's strtobool function
      bpf tools: Load a program with different instances using preprocessor
      perf bpf: Add BPF_PROLOGUE config options for further patches
      perf bpf: Compile dwarf-regs.c if CONFIG_BPF_PROLOGUE is on
      perf bpf: Allow BPF program attach to uprobe events
      perf bpf: Allow attaching BPF programs to modules symbols
      perf bpf: Allow BPF program config probing options
      perf bpf: Generate prologue for BPF programs
      perf test: Test the BPF prologue adding infrastructure
      perf test: Fix 'perf test BPF' when it fails to find a suitable vmlinux
      perf bpf: Use same BPF program if arguments are identical
      perf test: Print result for each LLVM subtest
      perf test: Print result for each BPF subtest
      perf test: Mute test cases error messages if verbose == 0

 tools/Makefile                               |   2 +-
 tools/include/linux/string.h                 |  11 +
 tools/lib/bpf/libbpf.c                       | 146 ++++++++-
 tools/lib/bpf/libbpf.h                       |  64 ++++
 tools/lib/string.c                           |  62 ++++
 tools/perf/Documentation/perf-report.txt     |  14 +-
 tools/perf/MANIFEST                          |   2 +
 tools/perf/arch/x86/include/arch-tests.h     |   8 +-
 tools/perf/arch/x86/tests/insn-x86.c         |   2 +-
 tools/perf/arch/x86/tests/intel-cqm.c        |   2 +-
 tools/perf/arch/x86/tests/perf-time-to-tsc.c |   2 +-
 tools/perf/arch/x86/tests/rdpmc.c            |   2 +-
 tools/perf/arch/x86/util/Build               |   1 +
 tools/perf/builtin-report.c                  |   4 +-
 tools/perf/config/Makefile                   |  12 +
 tools/perf/tests/.gitignore                  |   1 +
 tools/perf/tests/Build                       |   9 +-
 tools/perf/tests/attr.c                      |   2 +-
 tools/perf/tests/bp_signal.c                 |   2 +-
 tools/perf/tests/bp_signal_overflow.c        |   2 +-
 tools/perf/tests/bpf-script-test-prologue.c  |  35 +++
 tools/perf/tests/bpf.c                       |  93 ++++--
 tools/perf/tests/builtin-test.c              | 112 ++++++-
 tools/perf/tests/code-reading.c              |   2 +-
 tools/perf/tests/dso-data.c                  |   6 +-
 tools/perf/tests/dwarf-unwind.c              |   2 +-
 tools/perf/tests/evsel-roundtrip-name.c      |   2 +-
 tools/perf/tests/evsel-tp-sched.c            |   2 +-
 tools/perf/tests/fdarray.c                   |   4 +-
 tools/perf/tests/hists_cumulate.c            |   2 +-
 tools/perf/tests/hists_filter.c              |   2 +-
 tools/perf/tests/hists_link.c                |   2 +-
 tools/perf/tests/hists_output.c              |   2 +-
 tools/perf/tests/keep-tracking.c             |   2 +-
 tools/perf/tests/kmod-path.c                 |   2 +-
 tools/perf/tests/llvm.c                      |  75 +++--
 tools/perf/tests/llvm.h                      |   2 +
 tools/perf/tests/mmap-basic.c                |   2 +-
 tools/perf/tests/mmap-thread-lookup.c        |   2 +-
 tools/perf/tests/openat-syscall-all-cpus.c   |   2 +-
 tools/perf/tests/openat-syscall-tp-fields.c  |   2 +-
 tools/perf/tests/openat-syscall.c            |   2 +-
 tools/perf/tests/parse-events.c              |   2 +-
 tools/perf/tests/parse-no-sample-id-all.c    |   2 +-
 tools/perf/tests/perf-record.c               |   2 +-
 tools/perf/tests/pmu.c                       |   2 +-
 tools/perf/tests/python-use.c                |   3 +-
 tools/perf/tests/sample-parsing.c            |   2 +-
 tools/perf/tests/sw-clock.c                  |   2 +-
 tools/perf/tests/switch-tracking.c           |   2 +-
 tools/perf/tests/task-exit.c                 |   2 +-
 tools/perf/tests/tests.h                     |  89 +++---
 tools/perf/tests/thread-map.c                |   2 +-
 tools/perf/tests/thread-mg-share.c           |   2 +-
 tools/perf/tests/topology.c                  |   2 +-
 tools/perf/tests/vmlinux-kallsyms.c          |   2 +-
 tools/perf/ui/browsers/hists.c               | 315 +++++++++++++++++--
 tools/perf/ui/gtk/hists.c                    | 148 ++++++++-
 tools/perf/ui/stdio/hist.c                   |  94 +++++-
 tools/perf/util/Build                        |   7 +
 tools/perf/util/bpf-loader.c                 | 434 ++++++++++++++++++++++++-
 tools/perf/util/bpf-loader.h                 |   4 +
 tools/perf/util/bpf-prologue.c               | 455 +++++++++++++++++++++++++++
 tools/perf/util/bpf-prologue.h               |  34 ++
 tools/perf/util/callchain.c                  | 135 +++++++-
 tools/perf/util/callchain.h                  |  28 +-
 tools/perf/util/dso.c                        |   2 +
 tools/perf/util/exec_cmd.c                   |  21 +-
 tools/perf/util/exec_cmd.h                   |   5 +-
 tools/perf/util/help.c                       |   6 +-
 tools/perf/util/include/linux/string.h       |   3 -
 tools/perf/util/machine.c                    |  17 +-
 tools/perf/util/probe-event.c                |   7 +-
 tools/perf/util/probe-finder.c               |   9 +-
 tools/perf/util/string.c                     |  16 -
 tools/perf/util/symbol-elf.c                 |   2 +
 tools/perf/util/util.c                       |   3 +-
 77 files changed, 2286 insertions(+), 282 deletions(-)
 create mode 100644 tools/include/linux/string.h
 create mode 100644 tools/lib/string.c
 create mode 100644 tools/perf/tests/bpf-script-test-prologue.c
 create mode 100644 tools/perf/util/bpf-prologue.c
 create mode 100644 tools/perf/util/bpf-prologue.h
 delete mode 100644 tools/perf/util/include/linux/string.h

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

* RE: [GIT PULL 00/37] perf/core improvements and fixes
  2015-11-19 17:52 Arnaldo Carvalho de Melo
@ 2015-11-20 10:01 ` 平松雅巳 / HIRAMATU,MASAMI
  2015-11-20 12:08   ` 'Arnaldo Carvalho de Melo'
  2015-11-23  8:16 ` Ingo Molnar
  1 sibling, 1 reply; 53+ messages in thread
From: 平松雅巳 / HIRAMATU,MASAMI @ 2015-11-20 10:01 UTC (permalink / raw)
  To: 'Arnaldo Carvalho de Melo', Ingo Molnar
  Cc: linux-kernel@vger.kernel.org, Adrian Hunter, Alexei Starovoitov,
	Alexey Dobriyan, Andi Kleen, Bamvor Jian Zhang, Brendan Gregg,
	Daniel Borkmann, David Ahern, Frederic Weisbecker, He Kuang,
	Jiri Olsa, Jonathan Cameron, Kaixu Xia, Kan Liang, Kevin Hilman,
	linaro-kernel@lists.linaro.org, Michael Ellerman, Namhyung Kim,
	Pali Rohar, Pavel Machek, Pekka Enberg, Peter Zijlstra,
	pi3orama@163.com, Roberta Dobrescu, Shuah Khan, Wang Nan,
	Zefan Li, Arnaldo Carvalho de Melo

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 14397 bytes --]

Hi Arnaldo,

I just have a question about the refcnt debugger patch. It seems
that the debugger itself is dropped from this series, would you
have a plan to merge it afterwards?

Since I'd like to change other refcnts with my refcnt API, and
also to add some features, I'd like to decide I'd better update
my local patches or wait for your work :)

Thanks!


>From: Arnaldo Carvalho de Melo [mailto:acme@kernel.org]
>
>Hi Ingo,
>
>	Please consider pulling, this was based on tip/perf/urgent and I did a
>test merge of tip/perf/core with tip/perf/urgent and then with this branch,
>haven't noticed problems,
>
>Best regards,
>
>- Arnaldo
>
>The following changes since commit e15bf88a44d1fcb685754b2868b1cd28927af3aa:
>
>  Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
>(2015-11-18 06:56:48 +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 2c6caff2b26fde8f3f87183f8c97f2cebfdbcb98:
>
>  perf ui/gtk: Support folded callchains (2015-11-19 13:19:26 -0300)
>
>----------------------------------------------------------------
>perf/core improvements and fixes:
>
>User visible:
>
>- Allows BPF scriptlets specify arguments to be fetched using
>  DWARF info, using a prologue generated at compile/build time (He Kuang, Wang Nan)
>
>- Allow attaching BPF scriptlets to module symbols (Wang Nan)
>
>- Allow attaching BPF scriptlets to userspace code using uprobe (Wang Nan)
>
>- BPF programs now can specify 'perf probe' tunables via its section name,
>  separating key=val values using semicolons (Wang Nan)
>
>Testing some of these new BPF features:
>
>Use case: get callchains when receiving SSL packets, filter then in the
>          kernel, at arbitrary place.
>
>  # cat ssl.bpf.c
>  #define SEC(NAME) __attribute__((section(NAME), used))
>
>  struct pt_regs;
>
>  SEC("func=__inet_lookup_established hnum")
>  int func(struct pt_regs *ctx, int err, unsigned short port)
>  {
>          return err == 0 && port == 443;
>  }
>
>  char _license[] SEC("license") = "GPL";
>  int  _version   SEC("version") = LINUX_VERSION_CODE;
>  #
>  # perf record -a -g -e ssl.bpf.c
>  ^C[ perf record: Woken up 1 times to write data ]
>  [ perf record: Captured and wrote 0.787 MB perf.data (3 samples) ]
>  # perf script | head -30
>  swapper     0 [000] 58783.268118: perf_bpf_probe:func: (ffffffff816a0f60) hnum=0x1bb
>	 8a0f61 __inet_lookup_established (/lib/modules/4.3.0+/build/vmlinux)
>	 896def ip_rcv_finish (/lib/modules/4.3.0+/build/vmlinux)
>	 8976c2 ip_rcv (/lib/modules/4.3.0+/build/vmlinux)
>	 855eba __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
>	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
>	 8572a8 process_backlog (/lib/modules/4.3.0+/build/vmlinux)
>	 856b11 net_rx_action (/lib/modules/4.3.0+/build/vmlinux)
>	 2a284b __do_softirq (/lib/modules/4.3.0+/build/vmlinux)
>	 2a2ba3 irq_exit (/lib/modules/4.3.0+/build/vmlinux)
>	 96b7a4 do_IRQ (/lib/modules/4.3.0+/build/vmlinux)
>	 969807 ret_from_intr (/lib/modules/4.3.0+/build/vmlinux)
>	 2dede5 cpu_startup_entry (/lib/modules/4.3.0+/build/vmlinux)
>	 95d5bc rest_init (/lib/modules/4.3.0+/build/vmlinux)
>	1163ffa start_kernel ([kernel.vmlinux].init.text)
>	11634d7 x86_64_start_reservations ([kernel.vmlinux].init.text)
>	1163623 x86_64_start_kernel ([kernel.vmlinux].init.text)
>
>  qemu-system-x86  9178 [003] 58785.792417: perf_bpf_probe:func: (ffffffff816a0f60) hnum=0x1bb
>	 8a0f61 __inet_lookup_established (/lib/modules/4.3.0+/build/vmlinux)
>	 896def ip_rcv_finish (/lib/modules/4.3.0+/build/vmlinux)
>	 8976c2 ip_rcv (/lib/modules/4.3.0+/build/vmlinux)
>	 855eba __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
>	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
>	 856660 netif_receive_skb_internal (/lib/modules/4.3.0+/build/vmlinux)
>	 8566ec netif_receive_skb_sk (/lib/modules/4.3.0+/build/vmlinux)
>	   430a br_handle_frame_finish ([bridge])
>	   48bc br_handle_frame ([bridge])
>	 855f44 __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
>	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
>  #
>
>  Use 'perf probe' various options to list functions, see what variables can
>  be collected at any given point, experiment first collecting without a filter,
>  then filter, use it together with 'perf trace', 'perf top', with or without
>  callchains, if it explodes, please tell us!
>
>- Introduce a new callchain mode: "folded", that will list per line
>  representations of all callchains for a give histogram entry, facilitating
>  'perf report' output processing by other tools, such as Brendan Gregg's
>  flamegraph tools (Namhyung Kim)
>
>  E.g:
>
> # perf report | grep -v ^# | head
>    18.37%     0.00%  swapper  [kernel.kallsyms]   [k] cpu_startup_entry
>                    |
>                    ---cpu_startup_entry
>                       |
>                       |--12.07%--start_secondary
>                       |
>                        --6.30%--rest_init
>                                  start_kernel
>                                  x86_64_start_reservations
>                                  x86_64_start_kernel
>  #
>
> Becomes, in "folded" mode:
>
> # perf report -g folded | grep -v ^# | head -5
>     18.37%     0.00%  swapper [kernel.kallsyms]   [k] cpu_startup_entry
>   12.07% cpu_startup_entry;start_secondary
>    6.30% cpu_startup_entry;rest_init;start_kernel;x86_64_start_reservations;x86_64_start_kernel
>     16.90%     0.00%  swapper [kernel.kallsyms]   [k] call_cpuidle
>   11.23% call_cpuidle;cpu_startup_entry;start_secondary
>    5.67% call_cpuidle;cpu_startup_entry;rest_init;start_kernel;x86_64_start_reservations;x86_64_start_kernel
>     16.90%     0.00%  swapper [kernel.kallsyms]   [k] cpuidle_enter
>   11.23% cpuidle_enter;call_cpuidle;cpu_startup_entry;start_secondary
>    5.67%
>cpuidle_enter;call_cpuidle;cpu_startup_entry;rest_init;start_kernel;x86_64_start_reservations;x86_64_start_kernel
>     15.12%     0.00%  swapper [kernel.kallsyms]   [k] cpuidle_enter_state
>  #
>
>   The user can also select one of "count", "period" or "percent" as the first column.
>
>Infrastructure:
>
>- Fix multiple leaks found with valgrind and a refcount
>  debugger (Masami Hiramatsu)
>
>- Add further 'perf test' entries for BPF and LLVM (Wang Nan)
>
>- Improve 'perf test' to suport subtests, so that the series of tests
>  performed in the LLVM and BPF main tests appear in the default 'perf test'
>  output (Wang Nan)
>
>- Move memdup() from tools/perf to tools/lib/string.c (Arnaldo Carvalho de Melo)
>
>- Adopt strtobool() from the kernel into tools/lib/ (Wang Nan)
>
>- Fix selftests_install tools/ Makefile rule (Kevin Hilman)
>
>Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
>----------------------------------------------------------------
>Arnaldo Carvalho de Melo (3):
>      perf test: Fix build of BPF and LLVM on older glibc libraries
>      tools: Adopt memdup() from tools/perf, moving it to tools/lib/string.c
>      perf tests: Pass the subtest index to each test routine
>
>He Kuang (1):
>      perf bpf: Add prologue for BPF programs for fetching arguments
>
>Kevin Hilman (1):
>      tools: Fix selftests_install Makefile rule
>
>Masami Hiramatsu (9):
>      perf probe: Fix to free temporal Dwarf_Frame
>      perf machine: Fix machine__findnew_module_map to put registered map
>      perf machine: Fix machine__destroy_kernel_maps to drop vmlinux_maps references
>      perf machine: Fix to destroy kernel maps when machine exits
>      perf tools: Make perf_exec_path() always return malloc'd string
>      perf tools: Fix to put new map after inserting to map_groups in dso__load_sym
>      perf tools: Fix __dsos__addnew to put dso after adding it to the list
>      perf tools: Fix machine__create_kernel_maps to put kernel dso refcount
>      perf machine: Fix machine__findnew_module_map to put dso
>
>Namhyung Kim (9):
>      perf report: Support folded callchain mode on --stdio
>      perf callchain: Abstract callchain print function
>      perf callchain: Add count fields to struct callchain_node
>      perf report: Add callchain value option
>      perf hists browser: Factor out hist_browser__show_callchain_list()
>      perf hists browser: Support flat callchains
>      perf hists browser: Support folded callchains
>      perf ui/gtk: Support flat callchains
>      perf ui/gtk: Support folded callchains
>
>Wang Nan (14):
>      tools: Clone the kernel's strtobool function
>      bpf tools: Load a program with different instances using preprocessor
>      perf bpf: Add BPF_PROLOGUE config options for further patches
>      perf bpf: Compile dwarf-regs.c if CONFIG_BPF_PROLOGUE is on
>      perf bpf: Allow BPF program attach to uprobe events
>      perf bpf: Allow attaching BPF programs to modules symbols
>      perf bpf: Allow BPF program config probing options
>      perf bpf: Generate prologue for BPF programs
>      perf test: Test the BPF prologue adding infrastructure
>      perf test: Fix 'perf test BPF' when it fails to find a suitable vmlinux
>      perf bpf: Use same BPF program if arguments are identical
>      perf test: Print result for each LLVM subtest
>      perf test: Print result for each BPF subtest
>      perf test: Mute test cases error messages if verbose == 0
>
> tools/Makefile                               |   2 +-
> tools/include/linux/string.h                 |  11 +
> tools/lib/bpf/libbpf.c                       | 146 ++++++++-
> tools/lib/bpf/libbpf.h                       |  64 ++++
> tools/lib/string.c                           |  62 ++++
> tools/perf/Documentation/perf-report.txt     |  14 +-
> tools/perf/MANIFEST                          |   2 +
> tools/perf/arch/x86/include/arch-tests.h     |   8 +-
> tools/perf/arch/x86/tests/insn-x86.c         |   2 +-
> tools/perf/arch/x86/tests/intel-cqm.c        |   2 +-
> tools/perf/arch/x86/tests/perf-time-to-tsc.c |   2 +-
> tools/perf/arch/x86/tests/rdpmc.c            |   2 +-
> tools/perf/arch/x86/util/Build               |   1 +
> tools/perf/builtin-report.c                  |   4 +-
> tools/perf/config/Makefile                   |  12 +
> tools/perf/tests/.gitignore                  |   1 +
> tools/perf/tests/Build                       |   9 +-
> tools/perf/tests/attr.c                      |   2 +-
> tools/perf/tests/bp_signal.c                 |   2 +-
> tools/perf/tests/bp_signal_overflow.c        |   2 +-
> tools/perf/tests/bpf-script-test-prologue.c  |  35 +++
> tools/perf/tests/bpf.c                       |  93 ++++--
> tools/perf/tests/builtin-test.c              | 112 ++++++-
> tools/perf/tests/code-reading.c              |   2 +-
> tools/perf/tests/dso-data.c                  |   6 +-
> tools/perf/tests/dwarf-unwind.c              |   2 +-
> tools/perf/tests/evsel-roundtrip-name.c      |   2 +-
> tools/perf/tests/evsel-tp-sched.c            |   2 +-
> tools/perf/tests/fdarray.c                   |   4 +-
> tools/perf/tests/hists_cumulate.c            |   2 +-
> tools/perf/tests/hists_filter.c              |   2 +-
> tools/perf/tests/hists_link.c                |   2 +-
> tools/perf/tests/hists_output.c              |   2 +-
> tools/perf/tests/keep-tracking.c             |   2 +-
> tools/perf/tests/kmod-path.c                 |   2 +-
> tools/perf/tests/llvm.c                      |  75 +++--
> tools/perf/tests/llvm.h                      |   2 +
> tools/perf/tests/mmap-basic.c                |   2 +-
> tools/perf/tests/mmap-thread-lookup.c        |   2 +-
> tools/perf/tests/openat-syscall-all-cpus.c   |   2 +-
> tools/perf/tests/openat-syscall-tp-fields.c  |   2 +-
> tools/perf/tests/openat-syscall.c            |   2 +-
> tools/perf/tests/parse-events.c              |   2 +-
> tools/perf/tests/parse-no-sample-id-all.c    |   2 +-
> tools/perf/tests/perf-record.c               |   2 +-
> tools/perf/tests/pmu.c                       |   2 +-
> tools/perf/tests/python-use.c                |   3 +-
> tools/perf/tests/sample-parsing.c            |   2 +-
> tools/perf/tests/sw-clock.c                  |   2 +-
> tools/perf/tests/switch-tracking.c           |   2 +-
> tools/perf/tests/task-exit.c                 |   2 +-
> tools/perf/tests/tests.h                     |  89 +++---
> tools/perf/tests/thread-map.c                |   2 +-
> tools/perf/tests/thread-mg-share.c           |   2 +-
> tools/perf/tests/topology.c                  |   2 +-
> tools/perf/tests/vmlinux-kallsyms.c          |   2 +-
> tools/perf/ui/browsers/hists.c               | 315 +++++++++++++++++--
> tools/perf/ui/gtk/hists.c                    | 148 ++++++++-
> tools/perf/ui/stdio/hist.c                   |  94 +++++-
> tools/perf/util/Build                        |   7 +
> tools/perf/util/bpf-loader.c                 | 434 ++++++++++++++++++++++++-
> tools/perf/util/bpf-loader.h                 |   4 +
> tools/perf/util/bpf-prologue.c               | 455 +++++++++++++++++++++++++++
> tools/perf/util/bpf-prologue.h               |  34 ++
> tools/perf/util/callchain.c                  | 135 +++++++-
> tools/perf/util/callchain.h                  |  28 +-
> tools/perf/util/dso.c                        |   2 +
> tools/perf/util/exec_cmd.c                   |  21 +-
> tools/perf/util/exec_cmd.h                   |   5 +-
> tools/perf/util/help.c                       |   6 +-
> tools/perf/util/include/linux/string.h       |   3 -
> tools/perf/util/machine.c                    |  17 +-
> tools/perf/util/probe-event.c                |   7 +-
> tools/perf/util/probe-finder.c               |   9 +-
> tools/perf/util/string.c                     |  16 -
> tools/perf/util/symbol-elf.c                 |   2 +
> tools/perf/util/util.c                       |   3 +-
> 77 files changed, 2286 insertions(+), 282 deletions(-)
> create mode 100644 tools/include/linux/string.h
> create mode 100644 tools/lib/string.c
> create mode 100644 tools/perf/tests/bpf-script-test-prologue.c
> create mode 100644 tools/perf/util/bpf-prologue.c
> create mode 100644 tools/perf/util/bpf-prologue.h
> delete mode 100644 tools/perf/util/include/linux/string.h
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [GIT PULL 00/37] perf/core improvements and fixes
  2015-11-20 10:01 ` 平松雅巳 / HIRAMATU,MASAMI
@ 2015-11-20 12:08   ` 'Arnaldo Carvalho de Melo'
  2015-11-20 16:50     ` 平松雅巳 / HIRAMATU,MASAMI
  0 siblings, 1 reply; 53+ messages in thread
From: 'Arnaldo Carvalho de Melo' @ 2015-11-20 12:08 UTC (permalink / raw)
  To: 平松雅巳 / HIRAMATU,MASAMI
  Cc: Ingo Molnar, linux-kernel@vger.kernel.org, Adrian Hunter,
	Alexei Starovoitov, Alexey Dobriyan, Andi Kleen,
	Bamvor Jian Zhang, Brendan Gregg, Daniel Borkmann, David Ahern,
	Frederic Weisbecker, He Kuang, Jiri Olsa, Jonathan Cameron,
	Kaixu Xia, Kan Liang, Kevin Hilman,
	linaro-kernel@lists.linaro.org, Michael Ellerman, Namhyung Kim,
	Pali Rohar, Pavel Machek, Pekka Enberg, Peter Zijlstra,
	pi3orama@163.com, Roberta Dobrescu, Shuah Khan, Wang Nan,
	Zefan Li

Em Fri, Nov 20, 2015 at 10:01:30AM +0000, 平松雅巳 / HIRAMATU,MASAMI escreveu:
> Hi Arnaldo,
> 
> I just have a question about the refcnt debugger patch. It seems
> that the debugger itself is dropped from this series, would you
> have a plan to merge it afterwards?

I concentrated on the fixes, leaving the debugger itself to be reviewed
later.
 
> Since I'd like to change other refcnts with my refcnt API, and
> also to add some features, I'd like to decide I'd better update
> my local patches or wait for your work :)

You can continue using it as you did, and the fixes can continue to be
applied before the debugger itself gets reviewed.

- Arnaldo

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

* RE: [GIT PULL 00/37] perf/core improvements and fixes
  2015-11-20 12:08   ` 'Arnaldo Carvalho de Melo'
@ 2015-11-20 16:50     ` 平松雅巳 / HIRAMATU,MASAMI
  0 siblings, 0 replies; 53+ messages in thread
From: 平松雅巳 / HIRAMATU,MASAMI @ 2015-11-20 16:50 UTC (permalink / raw)
  To: 'Arnaldo Carvalho de Melo'
  Cc: Ingo Molnar, linux-kernel@vger.kernel.org, Adrian Hunter,
	Alexei Starovoitov, Alexey Dobriyan, Andi Kleen,
	Bamvor Jian Zhang, Brendan Gregg, Daniel Borkmann, David Ahern,
	Frederic Weisbecker, He Kuang, Jiri Olsa, Jonathan Cameron,
	Kaixu Xia, Kan Liang, Kevin Hilman,
	linaro-kernel@lists.linaro.org, Michael Ellerman, Namhyung Kim,
	Pali Rohar, Pavel Machek, Pekka Enberg, Peter Zijlstra,
	pi3orama@163.com, Roberta Dobrescu, Shuah Khan, Wang Nan,
	Zefan Li

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1175 bytes --]

>From: 'Arnaldo Carvalho de Melo' [mailto:acme@kernel.org]
>
>Em Fri, Nov 20, 2015 at 10:01:30AM +0000, 平松雅巳 / HIRAMATU,MASAMI escreveu:
>> Hi Arnaldo,
>>
>> I just have a question about the refcnt debugger patch. It seems
>> that the debugger itself is dropped from this series, would you
>> have a plan to merge it afterwards?
>
>I concentrated on the fixes, leaving the debugger itself to be reviewed
>later.
>
>> Since I'd like to change other refcnts with my refcnt API, and
>> also to add some features, I'd like to decide I'd better update
>> my local patches or wait for your work :)
>
>You can continue using it as you did, and the fixes can continue to be
>applied before the debugger itself gets reviewed.

OK, so I'll continue to play on my series :)

Thank you!

-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu.pt@hitachi.com
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [GIT PULL 00/37] perf/core improvements and fixes
  2015-11-19 17:52 Arnaldo Carvalho de Melo
  2015-11-20 10:01 ` 平松雅巳 / HIRAMATU,MASAMI
@ 2015-11-23  8:16 ` Ingo Molnar
  1 sibling, 0 replies; 53+ messages in thread
From: Ingo Molnar @ 2015-11-23  8:16 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexei Starovoitov, Alexey Dobriyan,
	Andi Kleen, Bamvor Jian Zhang, Brendan Gregg, Daniel Borkmann,
	David Ahern, Frederic Weisbecker, He Kuang, Jiri Olsa,
	Jonathan Cameron, Kaixu Xia, Kan Liang, Kevin Hilman,
	linaro-kernel, Masami Hiramatsu, Michael Ellerman, Namhyung Kim,
	Pali Rohar, Pavel Machek, Pekka Enberg, Peter Zijlstra, pi3orama,
	Roberta Dobrescu, Shuah Khan, Wang Nan, Zefan Li,
	Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Please consider pulling, this was based on tip/perf/urgent and I did a
> test merge of tip/perf/core with tip/perf/urgent and then with this branch,
> haven't noticed problems,
> 
> Best regards,
> 
> - Arnaldo
> 
> The following changes since commit e15bf88a44d1fcb685754b2868b1cd28927af3aa:
> 
>   Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2015-11-18 06:56:48 +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 2c6caff2b26fde8f3f87183f8c97f2cebfdbcb98:
> 
>   perf ui/gtk: Support folded callchains (2015-11-19 13:19:26 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Allows BPF scriptlets specify arguments to be fetched using
>   DWARF info, using a prologue generated at compile/build time (He Kuang, Wang Nan)
> 
> - Allow attaching BPF scriptlets to module symbols (Wang Nan)
> 
> - Allow attaching BPF scriptlets to userspace code using uprobe (Wang Nan)
> 
> - BPF programs now can specify 'perf probe' tunables via its section name,
>   separating key=val values using semicolons (Wang Nan)
> 
> Testing some of these new BPF features:
> 
> Use case: get callchains when receiving SSL packets, filter then in the
>           kernel, at arbitrary place.
> 
>   # cat ssl.bpf.c
>   #define SEC(NAME) __attribute__((section(NAME), used))
> 
>   struct pt_regs;
> 
>   SEC("func=__inet_lookup_established hnum")
>   int func(struct pt_regs *ctx, int err, unsigned short port)
>   {
>           return err == 0 && port == 443;
>   }
> 
>   char _license[] SEC("license") = "GPL";
>   int  _version   SEC("version") = LINUX_VERSION_CODE;
>   #
>   # perf record -a -g -e ssl.bpf.c
>   ^C[ perf record: Woken up 1 times to write data ]
>   [ perf record: Captured and wrote 0.787 MB perf.data (3 samples) ]
>   # perf script | head -30
>   swapper     0 [000] 58783.268118: perf_bpf_probe:func: (ffffffff816a0f60) hnum=0x1bb
> 	 8a0f61 __inet_lookup_established (/lib/modules/4.3.0+/build/vmlinux)
> 	 896def ip_rcv_finish (/lib/modules/4.3.0+/build/vmlinux)
> 	 8976c2 ip_rcv (/lib/modules/4.3.0+/build/vmlinux)
> 	 855eba __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
> 	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
> 	 8572a8 process_backlog (/lib/modules/4.3.0+/build/vmlinux)
> 	 856b11 net_rx_action (/lib/modules/4.3.0+/build/vmlinux)
> 	 2a284b __do_softirq (/lib/modules/4.3.0+/build/vmlinux)
> 	 2a2ba3 irq_exit (/lib/modules/4.3.0+/build/vmlinux)
> 	 96b7a4 do_IRQ (/lib/modules/4.3.0+/build/vmlinux)
> 	 969807 ret_from_intr (/lib/modules/4.3.0+/build/vmlinux)
> 	 2dede5 cpu_startup_entry (/lib/modules/4.3.0+/build/vmlinux)
> 	 95d5bc rest_init (/lib/modules/4.3.0+/build/vmlinux)
> 	1163ffa start_kernel ([kernel.vmlinux].init.text)
> 	11634d7 x86_64_start_reservations ([kernel.vmlinux].init.text)
> 	1163623 x86_64_start_kernel ([kernel.vmlinux].init.text)
> 
>   qemu-system-x86  9178 [003] 58785.792417: perf_bpf_probe:func: (ffffffff816a0f60) hnum=0x1bb
> 	 8a0f61 __inet_lookup_established (/lib/modules/4.3.0+/build/vmlinux)
> 	 896def ip_rcv_finish (/lib/modules/4.3.0+/build/vmlinux)
> 	 8976c2 ip_rcv (/lib/modules/4.3.0+/build/vmlinux)
> 	 855eba __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
> 	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
> 	 856660 netif_receive_skb_internal (/lib/modules/4.3.0+/build/vmlinux)
> 	 8566ec netif_receive_skb_sk (/lib/modules/4.3.0+/build/vmlinux)
> 	   430a br_handle_frame_finish ([bridge])
> 	   48bc br_handle_frame ([bridge])
> 	 855f44 __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
> 	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
>   #
> 
>   Use 'perf probe' various options to list functions, see what variables can
>   be collected at any given point, experiment first collecting without a filter,
>   then filter, use it together with 'perf trace', 'perf top', with or without
>   callchains, if it explodes, please tell us!
> 
> - Introduce a new callchain mode: "folded", that will list per line
>   representations of all callchains for a give histogram entry, facilitating
>   'perf report' output processing by other tools, such as Brendan Gregg's
>   flamegraph tools (Namhyung Kim)
> 
>   E.g:
> 
>  # perf report | grep -v ^# | head
>     18.37%     0.00%  swapper  [kernel.kallsyms]   [k] cpu_startup_entry
>                     |
>                     ---cpu_startup_entry
>                        |
>                        |--12.07%--start_secondary
>                        |
>                         --6.30%--rest_init
>                                   start_kernel
>                                   x86_64_start_reservations
>                                   x86_64_start_kernel
>   #
> 
>  Becomes, in "folded" mode:
> 
>  # perf report -g folded | grep -v ^# | head -5
>      18.37%     0.00%  swapper [kernel.kallsyms]   [k] cpu_startup_entry
>    12.07% cpu_startup_entry;start_secondary
>     6.30% cpu_startup_entry;rest_init;start_kernel;x86_64_start_reservations;x86_64_start_kernel
>      16.90%     0.00%  swapper [kernel.kallsyms]   [k] call_cpuidle
>    11.23% call_cpuidle;cpu_startup_entry;start_secondary
>     5.67% call_cpuidle;cpu_startup_entry;rest_init;start_kernel;x86_64_start_reservations;x86_64_start_kernel
>      16.90%     0.00%  swapper [kernel.kallsyms]   [k] cpuidle_enter
>    11.23% cpuidle_enter;call_cpuidle;cpu_startup_entry;start_secondary
>     5.67% cpuidle_enter;call_cpuidle;cpu_startup_entry;rest_init;start_kernel;x86_64_start_reservations;x86_64_start_kernel
>      15.12%     0.00%  swapper [kernel.kallsyms]   [k] cpuidle_enter_state
>   #
> 
>    The user can also select one of "count", "period" or "percent" as the first column.
> 
> Infrastructure:
> 
> - Fix multiple leaks found with valgrind and a refcount
>   debugger (Masami Hiramatsu)
> 
> - Add further 'perf test' entries for BPF and LLVM (Wang Nan)
> 
> - Improve 'perf test' to suport subtests, so that the series of tests
>   performed in the LLVM and BPF main tests appear in the default 'perf test'
>   output (Wang Nan)
> 
> - Move memdup() from tools/perf to tools/lib/string.c (Arnaldo Carvalho de Melo)
> 
> - Adopt strtobool() from the kernel into tools/lib/ (Wang Nan)
> 
> - Fix selftests_install tools/ Makefile rule (Kevin Hilman)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (3):
>       perf test: Fix build of BPF and LLVM on older glibc libraries
>       tools: Adopt memdup() from tools/perf, moving it to tools/lib/string.c
>       perf tests: Pass the subtest index to each test routine
> 
> He Kuang (1):
>       perf bpf: Add prologue for BPF programs for fetching arguments
> 
> Kevin Hilman (1):
>       tools: Fix selftests_install Makefile rule
> 
> Masami Hiramatsu (9):
>       perf probe: Fix to free temporal Dwarf_Frame
>       perf machine: Fix machine__findnew_module_map to put registered map
>       perf machine: Fix machine__destroy_kernel_maps to drop vmlinux_maps references
>       perf machine: Fix to destroy kernel maps when machine exits
>       perf tools: Make perf_exec_path() always return malloc'd string
>       perf tools: Fix to put new map after inserting to map_groups in dso__load_sym
>       perf tools: Fix __dsos__addnew to put dso after adding it to the list
>       perf tools: Fix machine__create_kernel_maps to put kernel dso refcount
>       perf machine: Fix machine__findnew_module_map to put dso
> 
> Namhyung Kim (9):
>       perf report: Support folded callchain mode on --stdio
>       perf callchain: Abstract callchain print function
>       perf callchain: Add count fields to struct callchain_node
>       perf report: Add callchain value option
>       perf hists browser: Factor out hist_browser__show_callchain_list()
>       perf hists browser: Support flat callchains
>       perf hists browser: Support folded callchains
>       perf ui/gtk: Support flat callchains
>       perf ui/gtk: Support folded callchains
> 
> Wang Nan (14):
>       tools: Clone the kernel's strtobool function
>       bpf tools: Load a program with different instances using preprocessor
>       perf bpf: Add BPF_PROLOGUE config options for further patches
>       perf bpf: Compile dwarf-regs.c if CONFIG_BPF_PROLOGUE is on
>       perf bpf: Allow BPF program attach to uprobe events
>       perf bpf: Allow attaching BPF programs to modules symbols
>       perf bpf: Allow BPF program config probing options
>       perf bpf: Generate prologue for BPF programs
>       perf test: Test the BPF prologue adding infrastructure
>       perf test: Fix 'perf test BPF' when it fails to find a suitable vmlinux
>       perf bpf: Use same BPF program if arguments are identical
>       perf test: Print result for each LLVM subtest
>       perf test: Print result for each BPF subtest
>       perf test: Mute test cases error messages if verbose == 0
> 
>  tools/Makefile                               |   2 +-
>  tools/include/linux/string.h                 |  11 +
>  tools/lib/bpf/libbpf.c                       | 146 ++++++++-
>  tools/lib/bpf/libbpf.h                       |  64 ++++
>  tools/lib/string.c                           |  62 ++++
>  tools/perf/Documentation/perf-report.txt     |  14 +-
>  tools/perf/MANIFEST                          |   2 +
>  tools/perf/arch/x86/include/arch-tests.h     |   8 +-
>  tools/perf/arch/x86/tests/insn-x86.c         |   2 +-
>  tools/perf/arch/x86/tests/intel-cqm.c        |   2 +-
>  tools/perf/arch/x86/tests/perf-time-to-tsc.c |   2 +-
>  tools/perf/arch/x86/tests/rdpmc.c            |   2 +-
>  tools/perf/arch/x86/util/Build               |   1 +
>  tools/perf/builtin-report.c                  |   4 +-
>  tools/perf/config/Makefile                   |  12 +
>  tools/perf/tests/.gitignore                  |   1 +
>  tools/perf/tests/Build                       |   9 +-
>  tools/perf/tests/attr.c                      |   2 +-
>  tools/perf/tests/bp_signal.c                 |   2 +-
>  tools/perf/tests/bp_signal_overflow.c        |   2 +-
>  tools/perf/tests/bpf-script-test-prologue.c  |  35 +++
>  tools/perf/tests/bpf.c                       |  93 ++++--
>  tools/perf/tests/builtin-test.c              | 112 ++++++-
>  tools/perf/tests/code-reading.c              |   2 +-
>  tools/perf/tests/dso-data.c                  |   6 +-
>  tools/perf/tests/dwarf-unwind.c              |   2 +-
>  tools/perf/tests/evsel-roundtrip-name.c      |   2 +-
>  tools/perf/tests/evsel-tp-sched.c            |   2 +-
>  tools/perf/tests/fdarray.c                   |   4 +-
>  tools/perf/tests/hists_cumulate.c            |   2 +-
>  tools/perf/tests/hists_filter.c              |   2 +-
>  tools/perf/tests/hists_link.c                |   2 +-
>  tools/perf/tests/hists_output.c              |   2 +-
>  tools/perf/tests/keep-tracking.c             |   2 +-
>  tools/perf/tests/kmod-path.c                 |   2 +-
>  tools/perf/tests/llvm.c                      |  75 +++--
>  tools/perf/tests/llvm.h                      |   2 +
>  tools/perf/tests/mmap-basic.c                |   2 +-
>  tools/perf/tests/mmap-thread-lookup.c        |   2 +-
>  tools/perf/tests/openat-syscall-all-cpus.c   |   2 +-
>  tools/perf/tests/openat-syscall-tp-fields.c  |   2 +-
>  tools/perf/tests/openat-syscall.c            |   2 +-
>  tools/perf/tests/parse-events.c              |   2 +-
>  tools/perf/tests/parse-no-sample-id-all.c    |   2 +-
>  tools/perf/tests/perf-record.c               |   2 +-
>  tools/perf/tests/pmu.c                       |   2 +-
>  tools/perf/tests/python-use.c                |   3 +-
>  tools/perf/tests/sample-parsing.c            |   2 +-
>  tools/perf/tests/sw-clock.c                  |   2 +-
>  tools/perf/tests/switch-tracking.c           |   2 +-
>  tools/perf/tests/task-exit.c                 |   2 +-
>  tools/perf/tests/tests.h                     |  89 +++---
>  tools/perf/tests/thread-map.c                |   2 +-
>  tools/perf/tests/thread-mg-share.c           |   2 +-
>  tools/perf/tests/topology.c                  |   2 +-
>  tools/perf/tests/vmlinux-kallsyms.c          |   2 +-
>  tools/perf/ui/browsers/hists.c               | 315 +++++++++++++++++--
>  tools/perf/ui/gtk/hists.c                    | 148 ++++++++-
>  tools/perf/ui/stdio/hist.c                   |  94 +++++-
>  tools/perf/util/Build                        |   7 +
>  tools/perf/util/bpf-loader.c                 | 434 ++++++++++++++++++++++++-
>  tools/perf/util/bpf-loader.h                 |   4 +
>  tools/perf/util/bpf-prologue.c               | 455 +++++++++++++++++++++++++++
>  tools/perf/util/bpf-prologue.h               |  34 ++
>  tools/perf/util/callchain.c                  | 135 +++++++-
>  tools/perf/util/callchain.h                  |  28 +-
>  tools/perf/util/dso.c                        |   2 +
>  tools/perf/util/exec_cmd.c                   |  21 +-
>  tools/perf/util/exec_cmd.h                   |   5 +-
>  tools/perf/util/help.c                       |   6 +-
>  tools/perf/util/include/linux/string.h       |   3 -
>  tools/perf/util/machine.c                    |  17 +-
>  tools/perf/util/probe-event.c                |   7 +-
>  tools/perf/util/probe-finder.c               |   9 +-
>  tools/perf/util/string.c                     |  16 -
>  tools/perf/util/symbol-elf.c                 |   2 +
>  tools/perf/util/util.c                       |   3 +-
>  77 files changed, 2286 insertions(+), 282 deletions(-)
>  create mode 100644 tools/include/linux/string.h
>  create mode 100644 tools/lib/string.c
>  create mode 100644 tools/perf/tests/bpf-script-test-prologue.c
>  create mode 100644 tools/perf/util/bpf-prologue.c
>  create mode 100644 tools/perf/util/bpf-prologue.h
>  delete mode 100644 tools/perf/util/include/linux/string.h

Pulled into tip:perf/core, thanks a lot Arnaldo!

	Ingo

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

* [GIT PULL 00/37] perf/core improvements and fixes
@ 2016-10-24 16:20 Arnaldo Carvalho de Melo
  2016-10-24 18:44 ` Ingo Molnar
  0 siblings, 1 reply; 53+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-10-24 16:20 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Alemayhu, Alexander Shishkin, Alexis Berlemont,
	Andi Kleen, Anton Blanchard, Brice Goglin, David Ahern,
	Davidlohr Bueso, Hitoshi Mitake, Jiri Olsa, Maciej Debski,
	Mathieu Poirier, Namhyung Kim, Nilay Vaish, Peter Zijlstra,
	Ross McIlroy, Sebastian Andrzej Siewior, Stefano Sanfilippo,
	Stephane Eranian, Steven Rostedt, Sukadev Bhattiprolu, Wang Nan,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, more to come soon,

- Arnaldo

Build and test stats at the end of the message.

The following changes since commit e9c848928abf4cb60601e9ae7d336f0333c98bca:

  Merge tag 'perf-c2c-for-mingo-20161021' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-10-22 10:22:05 +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-20161024

for you to fetch changes up to 04b553ad7dc347eabd3cb4705932272453175a80:

  perf coresight: Removing miscellaneous debug output (2016-10-24 11:07:47 -0300)

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

New features:

- Dynamicly change verbosity level by pressing 'V' in the 'perf top/report'
  hists TUI browser (Alexis Berlemont)

- Implement 'perf trace --delay' in the same fashion as in 'perf record --delay',
  to skip sampling workload initialization events (Alexis Berlemont)

- Make vendor named events case insensitive in 'perf list', i.e.
  'perf list LONGEST_LAT' works just the same as  'perf list longest_lat' (Andi Kleen)

- Show instruction bytes and lenght in 'perf script' for Intel PT and BTS (Andi Kleen, Adrian Hunter)

   E.g:

    % perf record -e intel_pt// foo
    % perf script --itrace=i0ns -F ip,insn,insnlen
     ffffffff8101232f ilen: 5 insn: 0f 1f 44 00 00
     ffffffff81012334 ilen: 1 insn: 5b
     ffffffff81012335 ilen: 1 insn: 5d
     ffffffff81012336 ilen: 1 insn: c3
     ffffffff810123e3 ilen: 1 insn: 5b
     ffffffff810123e4 ilen: 2 insn: 41 5c
     ffffffff810123e6 ilen: 1 insn: 5d
     ffffffff810123e7 ilen: 1 insn: c3
     ffffffff810124a6 ilen: 2 insn: 31 c0
     ffffffff810124a8 ilen: 9 insn: 41 83 bc 24 a8 01 00 00 01
     ffffffff810124b1 ilen: 2 insn: 75 87

- Allow enabling the perf_event_attr.branch_type attribute member: (Andi Kleen)

  perf record -e sched:sched_switch,cpu/cpu-cycles,branch_type=any/ ...

- Add unwinding support for jitdump (Stefano Sanfilippo)

Fixes:

- Use raw_syscall:sys_enter timestamp in 'perf trace' (Arnaldo Carvalho de Melo)

Infrastructure:

- Allow jitdump to be built without libdwarf (Maciej Debski)

- Sync x86's syscall table tools/ copy (Arnaldo Carvalho de Melo)

- Fixes to avoid calling die() in library fuctions already propagating other
  errors (Arnaldo Carvalho de Melo)

- Improvements to allow libtraceevent to be properly installed in distro
  packages (Jiri Olsa)

- Removing coresight miscellaneous debug output (Mathieu Poirier)

- Cache align the 'perf bench futex' worker struct (Sebastian Andrzej Siewior)

Documentation:

- Minor improvements on the documentation of event parameters (Andi Kleen)

- Add jitdump format specification document (Stephane Eranian)

Spelling fixes:

- Fix typo "No enough" to "Not enough" (Alexander Alemayhu)

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

----------------------------------------------------------------
Adrian Hunter (1):
      perf intel-pt/bts: Tidy instruction buffer size usage

Alexander Alemayhu (1):
      perf tools: Fix typo "No enough" to "Not enough"

Alexis Berlemont (2):
      perf hists browser: Dynamically change verbosity level
      perf trace: Implement --delay

Andi Kleen (6):
      perf intel-pt/bts: Report instruction bytes and length in sample
      perf script: Support insn and insnlen
      perf record: Improve documentation of event parameters
      perf tools: Implement branch_type event parameter
      perf pmu: Only print Using CPUID message once
      perf list: Make vendor event matching case insensitive

Arnaldo Carvalho de Melo (8):
      perf tools: Sync copy of x86's syscall table
      perf jit: Avoid returning garbage for a ret variable
      perf jit: Add NT_GNU_BUILD_ID definition for older distros
      perf bench mem: Move boilerplate memory allocation to the infrastructure
      perf tools: Normalize sq_quote_argv() error reporting
      perf tools: Use normal error reporting when processing PERF_RECORD_READ events
      perf trace: Remove thread_trace->exit_time
      perf trace: Use the syscall raw_syscalls:sys_enter timestamp

Jiri Olsa (8):
      tools lib traceevent: Add install_headers target
      tools lib traceevent: Add do_install_mkdir Makefile function
      tools lib traceevent: Rename LIB_FILE to LIB_TARGET
      tools lib traceevent: Add version for traceevent shared object
      tools lib: Add for_each_clear_bit macro
      perf report: Move captured info to generic header info
      perf header: Display missing features
      perf header: Display feature name on write failure

Maciej Debski (1):
      perf jit: Enable jitdump support without dwarf

Mathieu Poirier (1):
      perf coresight: Removing miscellaneous debug output

Sebastian Andrzej Siewior (1):
      perf bench futex: Cache align the worker struct

Stefano Sanfilippo (5):
      perf jit: Make perf skip unknown records
      perf jit: Do not assume pgoff is zero
      perf jit: Add unwinding support
      perf jit: Generate .eh_frame/.eh_frame_hdr in DSO
      perf jit: Check JITHEADER_VERSION

Stephane Eranian (3):
      perf jit: Improve error messages from JVMTI
      perf jit: Remove unecessary padding in jitdump file
      perf jit: Add jitdump format specification document

 tools/include/asm-generic/bitops.h                 |   1 +
 tools/include/asm-generic/bitops/__ffz.h           |  12 ++
 tools/include/asm-generic/bitops/find.h            |  28 ++++
 tools/include/linux/bitops.h                       |   5 +
 tools/lib/find_bit.c                               |  25 +++
 tools/lib/traceevent/Makefile                      |  40 +++--
 tools/perf/Documentation/jitdump-specification.txt | 170 +++++++++++++++++++++
 tools/perf/Documentation/perf-record.txt           |   9 +-
 tools/perf/Documentation/perf-script.txt           |   6 +-
 tools/perf/Documentation/perf-trace.txt            |   5 +
 tools/perf/MANIFEST                                |   1 +
 tools/perf/Makefile.config                         |   2 +-
 tools/perf/arch/arm/util/cs-etm.c                  |   2 -
 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl  |   4 +-
 tools/perf/bench/futex-hash.c                      |   5 +-
 tools/perf/bench/mem-functions.c                   |  77 ++++------
 tools/perf/builtin-report.c                        |  12 +-
 tools/perf/builtin-script.c                        |  24 ++-
 tools/perf/builtin-trace.c                         |  19 ++-
 tools/perf/jvmti/jvmti_agent.c                     |  38 +----
 tools/perf/jvmti/libjvmti.c                        |  39 +++--
 tools/perf/tests/backward-ring-buffer.c            |   2 +-
 tools/perf/tests/bpf.c                             |   2 +-
 tools/perf/ui/browsers/hists.c                     |   5 +-
 tools/perf/util/Build                              |   2 +-
 tools/perf/util/bpf-loader.c                       |  14 +-
 tools/perf/util/event.h                            |   3 +
 tools/perf/util/evsel.c                            |   9 ++
 tools/perf/util/evsel.h                            |   2 +
 tools/perf/util/genelf.c                           | 113 +++++++++++++-
 tools/perf/util/genelf.h                           |   5 +-
 tools/perf/util/header.c                           |  19 ++-
 tools/perf/util/intel-bts.c                        |   9 +-
 .../perf/util/intel-pt-decoder/intel-pt-decoder.c  |   2 +
 .../perf/util/intel-pt-decoder/intel-pt-decoder.h  |   1 +
 .../util/intel-pt-decoder/intel-pt-insn-decoder.c  |  13 +-
 .../util/intel-pt-decoder/intel-pt-insn-decoder.h  |   6 +-
 tools/perf/util/intel-pt-decoder/intel-pt-log.c    |   4 +-
 tools/perf/util/intel-pt.c                         |  19 ++-
 tools/perf/util/jitdump.c                          |  82 ++++++++--
 tools/perf/util/jitdump.h                          |  12 ++
 tools/perf/util/llvm-utils.c                       |   2 +-
 tools/perf/util/map.c                              |  17 ++-
 tools/perf/util/parse-branch-options.c             |  85 ++++++-----
 tools/perf/util/parse-branch-options.h             |   3 +-
 tools/perf/util/parse-events.c                     |  15 +-
 tools/perf/util/pmu.c                              |  10 +-
 tools/perf/util/quote.c                            |   2 +-
 tools/perf/util/session.c                          |  10 --
 tools/perf/util/string.c                           |  21 ++-
 tools/perf/util/unwind-libunwind-local.c           |   4 +-
 tools/perf/util/util.h                             |   1 +
 tools/perf/util/values.c                           |  81 +++++++---
 tools/perf/util/values.h                           |   4 +-
 54 files changed, 830 insertions(+), 273 deletions(-)
 create mode 100644 tools/include/asm-generic/bitops/__ffz.h
 create mode 100644 tools/perf/Documentation/jitdump-specification.txt

  # time dm
     1 alpine:3.4: Ok
     2 android-ndk:r12b-arm: Ok
     3 archlinux:latest: Ok
     4 centos:5: Ok
     5 centos:6: Ok
     6 centos:7: Ok
     7 debian:7: Ok
     8 debian:8: Ok
     9 debian:experimental: Ok
    10 fedora:20: Ok
    11 fedora:21: Ok
    12 fedora:22: Ok
    13 fedora:23: Ok
    14 fedora:24: Ok
    15 fedora:24-x-ARC-uClibc: Ok
    16 fedora:rawhide: Ok
    17 mageia:5: Ok
    18 opensuse:13.2: Ok
    19 opensuse:42.1: Ok
    20 opensuse:tumbleweed: Ok
    21 ubuntu:12.04.5: Ok
    22 ubuntu:14.04: Ok
    23 ubuntu:14.04.4: Ok
    24 ubuntu:15.10: Ok
    25 ubuntu:16.04: Ok
    26 ubuntu:16.04-x-arm: Ok
    27 ubuntu:16.04-x-arm64: Ok
    28 ubuntu:16.04-x-powerpc: Ok
    29 ubuntu:16.04-x-powerpc64: Ok
    30 ubuntu:16.04-x-powerpc64el: Ok
    31 ubuntu:16.04-x-s390: Ok
    32 ubuntu:16.10: Ok
  
  real	46m1.737s
  user	0m2.200s
  sys	0m2.735s
  #

   # 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 events tests                                       : Ok
   6: Validate PERF_RECORD_* events & perf_sample fields       : Ok
   7: Test perf pmu format parsing                             : Ok
   8: Test dso data read                                       : Ok
   9: Test dso data cache                                      : Ok
  10: Test dso data reopen                                     : Ok
  11: roundtrip evsel->name check                              : Ok
  12: Check parsing of sched tracepoints fields                : Ok
  13: Generate and check syscalls:sys_enter_openat event fields: Ok
  14: struct perf_event_attr setup                             : Ok
  15: Test matching and linking multiple hists                 : Ok
  16: Try 'import perf' in python, checking link problems      : Ok
  17: Test breakpoint overflow signal handler                  : Ok
  18: Test breakpoint overflow sampling                        : Ok
  19: Test number of exit event of a simple workload           : Ok
  20: Test software clock events have valid period values      : Ok
  21: Test object code reading                                 : Ok
  22: Test sample parsing                                      : Ok
  23: Test using a dummy software event to keep tracking       : Ok
  24: Test parsing with no sample_id_all bit set               : Ok
  25: Test filtering hist entries                              : Ok
  26: Test mmap thread lookup                                  : Ok
  27: Test thread mg sharing                                   : Ok
  28: Test output sorting of hist entries                      : Ok
  29: Test cumulation of child hist entries                    : Ok
  30: Test tracking with sched_switch                          : Ok
  31: Filter fds with revents mask in a fdarray                : Ok
  32: Add fd to a fdarray, making it autogrow                  : Ok
  33: Test kmod_path__parse function                           : Ok
  34: Test thread map                                          : Ok
  35: Test LLVM searching and compiling                        :
  35.1: Basic BPF llvm compiling test                          : Ok
  35.2: Test kbuild searching                                  : Ok
  35.3: Compile source for BPF prologue generation test        : Ok
  35.4: Compile source for BPF relocation test                 : Ok
  36: Test topology in session                                 : Ok
  37: Test BPF filter                                          :
  37.1: Test basic BPF filtering                               : Ok
  37.2: Test BPF prologue generation                           : Ok
  37.3: Test BPF relocation checker                            : Ok
  38: Test thread map synthesize                               : Ok
  39: Test cpu map synthesize                                  : Ok
  40: Test stat config synthesize                              : Ok
  41: Test stat synthesize                                     : Ok
  42: Test stat round synthesize                               : Ok
  43: Test attr update synthesize                              : Ok
  44: Test events times                                        : Ok
  45: Test backward reading from ring buffer                   : Ok
  46: Test cpu map print                                       : Ok
  47: Test SDT event probing                                   : Ok
  48: Test is_printable_array function                         : Ok
  49: Test bitmap print                                        : Ok
  50: x86 rdpmc test                                           : Ok
  51: Test converting perf time to TSC                         : Ok
  52: Test dwarf unwind                                        : Ok
  53: Test x86 instruction decoder - new instructions          : Ok
  54: Test intel cqm nmi context read                          : Skip
  #

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

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

* Re: [GIT PULL 00/37] perf/core improvements and fixes
  2016-10-24 16:20 Arnaldo Carvalho de Melo
@ 2016-10-24 18:44 ` Ingo Molnar
  0 siblings, 0 replies; 53+ messages in thread
From: Ingo Molnar @ 2016-10-24 18:44 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexander Alemayhu,
	Alexander Shishkin, Alexis Berlemont, Andi Kleen, Anton Blanchard,
	Brice Goglin, David Ahern, Davidlohr Bueso, Hitoshi Mitake,
	Jiri Olsa, Maciej Debski, Mathieu Poirier, Namhyung Kim,
	Nilay Vaish, Peter Zijlstra, Ross McIlroy,
	Sebastian Andrzej Siewior, Stefano Sanfilippo, Stephane Eranian,
	Steven Rostedt, Sukadev Bhattiprolu, Wang Nan,
	Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Please consider pulling, more to come soon,
> 
> - Arnaldo
> 
> Build and test stats at the end of the message.
> 
> The following changes since commit e9c848928abf4cb60601e9ae7d336f0333c98bca:
> 
>   Merge tag 'perf-c2c-for-mingo-20161021' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-10-22 10:22:05 +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-20161024
> 
> for you to fetch changes up to 04b553ad7dc347eabd3cb4705932272453175a80:
> 
>   perf coresight: Removing miscellaneous debug output (2016-10-24 11:07:47 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> New features:
> 
> - Dynamicly change verbosity level by pressing 'V' in the 'perf top/report'
>   hists TUI browser (Alexis Berlemont)
> 
> - Implement 'perf trace --delay' in the same fashion as in 'perf record --delay',
>   to skip sampling workload initialization events (Alexis Berlemont)
> 
> - Make vendor named events case insensitive in 'perf list', i.e.
>   'perf list LONGEST_LAT' works just the same as  'perf list longest_lat' (Andi Kleen)
> 
> - Show instruction bytes and lenght in 'perf script' for Intel PT and BTS (Andi Kleen, Adrian Hunter)
> 
>    E.g:
> 
>     % perf record -e intel_pt// foo
>     % perf script --itrace=i0ns -F ip,insn,insnlen
>      ffffffff8101232f ilen: 5 insn: 0f 1f 44 00 00
>      ffffffff81012334 ilen: 1 insn: 5b
>      ffffffff81012335 ilen: 1 insn: 5d
>      ffffffff81012336 ilen: 1 insn: c3
>      ffffffff810123e3 ilen: 1 insn: 5b
>      ffffffff810123e4 ilen: 2 insn: 41 5c
>      ffffffff810123e6 ilen: 1 insn: 5d
>      ffffffff810123e7 ilen: 1 insn: c3
>      ffffffff810124a6 ilen: 2 insn: 31 c0
>      ffffffff810124a8 ilen: 9 insn: 41 83 bc 24 a8 01 00 00 01
>      ffffffff810124b1 ilen: 2 insn: 75 87
> 
> - Allow enabling the perf_event_attr.branch_type attribute member: (Andi Kleen)
> 
>   perf record -e sched:sched_switch,cpu/cpu-cycles,branch_type=any/ ...
> 
> - Add unwinding support for jitdump (Stefano Sanfilippo)
> 
> Fixes:
> 
> - Use raw_syscall:sys_enter timestamp in 'perf trace' (Arnaldo Carvalho de Melo)
> 
> Infrastructure:
> 
> - Allow jitdump to be built without libdwarf (Maciej Debski)
> 
> - Sync x86's syscall table tools/ copy (Arnaldo Carvalho de Melo)
> 
> - Fixes to avoid calling die() in library fuctions already propagating other
>   errors (Arnaldo Carvalho de Melo)
> 
> - Improvements to allow libtraceevent to be properly installed in distro
>   packages (Jiri Olsa)
> 
> - Removing coresight miscellaneous debug output (Mathieu Poirier)
> 
> - Cache align the 'perf bench futex' worker struct (Sebastian Andrzej Siewior)
> 
> Documentation:
> 
> - Minor improvements on the documentation of event parameters (Andi Kleen)
> 
> - Add jitdump format specification document (Stephane Eranian)
> 
> Spelling fixes:
> 
> - Fix typo "No enough" to "Not enough" (Alexander Alemayhu)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (1):
>       perf intel-pt/bts: Tidy instruction buffer size usage
> 
> Alexander Alemayhu (1):
>       perf tools: Fix typo "No enough" to "Not enough"
> 
> Alexis Berlemont (2):
>       perf hists browser: Dynamically change verbosity level
>       perf trace: Implement --delay
> 
> Andi Kleen (6):
>       perf intel-pt/bts: Report instruction bytes and length in sample
>       perf script: Support insn and insnlen
>       perf record: Improve documentation of event parameters
>       perf tools: Implement branch_type event parameter
>       perf pmu: Only print Using CPUID message once
>       perf list: Make vendor event matching case insensitive
> 
> Arnaldo Carvalho de Melo (8):
>       perf tools: Sync copy of x86's syscall table
>       perf jit: Avoid returning garbage for a ret variable
>       perf jit: Add NT_GNU_BUILD_ID definition for older distros
>       perf bench mem: Move boilerplate memory allocation to the infrastructure
>       perf tools: Normalize sq_quote_argv() error reporting
>       perf tools: Use normal error reporting when processing PERF_RECORD_READ events
>       perf trace: Remove thread_trace->exit_time
>       perf trace: Use the syscall raw_syscalls:sys_enter timestamp
> 
> Jiri Olsa (8):
>       tools lib traceevent: Add install_headers target
>       tools lib traceevent: Add do_install_mkdir Makefile function
>       tools lib traceevent: Rename LIB_FILE to LIB_TARGET
>       tools lib traceevent: Add version for traceevent shared object
>       tools lib: Add for_each_clear_bit macro
>       perf report: Move captured info to generic header info
>       perf header: Display missing features
>       perf header: Display feature name on write failure
> 
> Maciej Debski (1):
>       perf jit: Enable jitdump support without dwarf
> 
> Mathieu Poirier (1):
>       perf coresight: Removing miscellaneous debug output
> 
> Sebastian Andrzej Siewior (1):
>       perf bench futex: Cache align the worker struct
> 
> Stefano Sanfilippo (5):
>       perf jit: Make perf skip unknown records
>       perf jit: Do not assume pgoff is zero
>       perf jit: Add unwinding support
>       perf jit: Generate .eh_frame/.eh_frame_hdr in DSO
>       perf jit: Check JITHEADER_VERSION
> 
> Stephane Eranian (3):
>       perf jit: Improve error messages from JVMTI
>       perf jit: Remove unecessary padding in jitdump file
>       perf jit: Add jitdump format specification document
> 
>  tools/include/asm-generic/bitops.h                 |   1 +
>  tools/include/asm-generic/bitops/__ffz.h           |  12 ++
>  tools/include/asm-generic/bitops/find.h            |  28 ++++
>  tools/include/linux/bitops.h                       |   5 +
>  tools/lib/find_bit.c                               |  25 +++
>  tools/lib/traceevent/Makefile                      |  40 +++--
>  tools/perf/Documentation/jitdump-specification.txt | 170 +++++++++++++++++++++
>  tools/perf/Documentation/perf-record.txt           |   9 +-
>  tools/perf/Documentation/perf-script.txt           |   6 +-
>  tools/perf/Documentation/perf-trace.txt            |   5 +
>  tools/perf/MANIFEST                                |   1 +
>  tools/perf/Makefile.config                         |   2 +-
>  tools/perf/arch/arm/util/cs-etm.c                  |   2 -
>  tools/perf/arch/x86/entry/syscalls/syscall_64.tbl  |   4 +-
>  tools/perf/bench/futex-hash.c                      |   5 +-
>  tools/perf/bench/mem-functions.c                   |  77 ++++------
>  tools/perf/builtin-report.c                        |  12 +-
>  tools/perf/builtin-script.c                        |  24 ++-
>  tools/perf/builtin-trace.c                         |  19 ++-
>  tools/perf/jvmti/jvmti_agent.c                     |  38 +----
>  tools/perf/jvmti/libjvmti.c                        |  39 +++--
>  tools/perf/tests/backward-ring-buffer.c            |   2 +-
>  tools/perf/tests/bpf.c                             |   2 +-
>  tools/perf/ui/browsers/hists.c                     |   5 +-
>  tools/perf/util/Build                              |   2 +-
>  tools/perf/util/bpf-loader.c                       |  14 +-
>  tools/perf/util/event.h                            |   3 +
>  tools/perf/util/evsel.c                            |   9 ++
>  tools/perf/util/evsel.h                            |   2 +
>  tools/perf/util/genelf.c                           | 113 +++++++++++++-
>  tools/perf/util/genelf.h                           |   5 +-
>  tools/perf/util/header.c                           |  19 ++-
>  tools/perf/util/intel-bts.c                        |   9 +-
>  .../perf/util/intel-pt-decoder/intel-pt-decoder.c  |   2 +
>  .../perf/util/intel-pt-decoder/intel-pt-decoder.h  |   1 +
>  .../util/intel-pt-decoder/intel-pt-insn-decoder.c  |  13 +-
>  .../util/intel-pt-decoder/intel-pt-insn-decoder.h  |   6 +-
>  tools/perf/util/intel-pt-decoder/intel-pt-log.c    |   4 +-
>  tools/perf/util/intel-pt.c                         |  19 ++-
>  tools/perf/util/jitdump.c                          |  82 ++++++++--
>  tools/perf/util/jitdump.h                          |  12 ++
>  tools/perf/util/llvm-utils.c                       |   2 +-
>  tools/perf/util/map.c                              |  17 ++-
>  tools/perf/util/parse-branch-options.c             |  85 ++++++-----
>  tools/perf/util/parse-branch-options.h             |   3 +-
>  tools/perf/util/parse-events.c                     |  15 +-
>  tools/perf/util/pmu.c                              |  10 +-
>  tools/perf/util/quote.c                            |   2 +-
>  tools/perf/util/session.c                          |  10 --
>  tools/perf/util/string.c                           |  21 ++-
>  tools/perf/util/unwind-libunwind-local.c           |   4 +-
>  tools/perf/util/util.h                             |   1 +
>  tools/perf/util/values.c                           |  81 +++++++---
>  tools/perf/util/values.h                           |   4 +-
>  54 files changed, 830 insertions(+), 273 deletions(-)
>  create mode 100644 tools/include/asm-generic/bitops/__ffz.h
>  create mode 100644 tools/perf/Documentation/jitdump-specification.txt
> 
>   # time dm
>      1 alpine:3.4: Ok
>      2 android-ndk:r12b-arm: Ok
>      3 archlinux:latest: Ok
>      4 centos:5: Ok
>      5 centos:6: Ok
>      6 centos:7: Ok
>      7 debian:7: Ok
>      8 debian:8: Ok
>      9 debian:experimental: Ok
>     10 fedora:20: Ok
>     11 fedora:21: Ok
>     12 fedora:22: Ok
>     13 fedora:23: Ok
>     14 fedora:24: Ok
>     15 fedora:24-x-ARC-uClibc: Ok
>     16 fedora:rawhide: Ok
>     17 mageia:5: Ok
>     18 opensuse:13.2: Ok
>     19 opensuse:42.1: Ok
>     20 opensuse:tumbleweed: Ok
>     21 ubuntu:12.04.5: Ok
>     22 ubuntu:14.04: Ok
>     23 ubuntu:14.04.4: Ok
>     24 ubuntu:15.10: Ok
>     25 ubuntu:16.04: Ok
>     26 ubuntu:16.04-x-arm: Ok
>     27 ubuntu:16.04-x-arm64: Ok
>     28 ubuntu:16.04-x-powerpc: Ok
>     29 ubuntu:16.04-x-powerpc64: Ok
>     30 ubuntu:16.04-x-powerpc64el: Ok
>     31 ubuntu:16.04-x-s390: Ok
>     32 ubuntu:16.10: Ok
>   
>   real	46m1.737s
>   user	0m2.200s
>   sys	0m2.735s
>   #
> 
>    # 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 events tests                                       : Ok
>    6: Validate PERF_RECORD_* events & perf_sample fields       : Ok
>    7: Test perf pmu format parsing                             : Ok
>    8: Test dso data read                                       : Ok
>    9: Test dso data cache                                      : Ok
>   10: Test dso data reopen                                     : Ok
>   11: roundtrip evsel->name check                              : Ok
>   12: Check parsing of sched tracepoints fields                : Ok
>   13: Generate and check syscalls:sys_enter_openat event fields: Ok
>   14: struct perf_event_attr setup                             : Ok
>   15: Test matching and linking multiple hists                 : Ok
>   16: Try 'import perf' in python, checking link problems      : Ok
>   17: Test breakpoint overflow signal handler                  : Ok
>   18: Test breakpoint overflow sampling                        : Ok
>   19: Test number of exit event of a simple workload           : Ok
>   20: Test software clock events have valid period values      : Ok
>   21: Test object code reading                                 : Ok
>   22: Test sample parsing                                      : Ok
>   23: Test using a dummy software event to keep tracking       : Ok
>   24: Test parsing with no sample_id_all bit set               : Ok
>   25: Test filtering hist entries                              : Ok
>   26: Test mmap thread lookup                                  : Ok
>   27: Test thread mg sharing                                   : Ok
>   28: Test output sorting of hist entries                      : Ok
>   29: Test cumulation of child hist entries                    : Ok
>   30: Test tracking with sched_switch                          : Ok
>   31: Filter fds with revents mask in a fdarray                : Ok
>   32: Add fd to a fdarray, making it autogrow                  : Ok
>   33: Test kmod_path__parse function                           : Ok
>   34: Test thread map                                          : Ok
>   35: Test LLVM searching and compiling                        :
>   35.1: Basic BPF llvm compiling test                          : Ok
>   35.2: Test kbuild searching                                  : Ok
>   35.3: Compile source for BPF prologue generation test        : Ok
>   35.4: Compile source for BPF relocation test                 : Ok
>   36: Test topology in session                                 : Ok
>   37: Test BPF filter                                          :
>   37.1: Test basic BPF filtering                               : Ok
>   37.2: Test BPF prologue generation                           : Ok
>   37.3: Test BPF relocation checker                            : Ok
>   38: Test thread map synthesize                               : Ok
>   39: Test cpu map synthesize                                  : Ok
>   40: Test stat config synthesize                              : Ok
>   41: Test stat synthesize                                     : Ok
>   42: Test stat round synthesize                               : Ok
>   43: Test attr update synthesize                              : Ok
>   44: Test events times                                        : Ok
>   45: Test backward reading from ring buffer                   : Ok
>   46: Test cpu map print                                       : Ok
>   47: Test SDT event probing                                   : Ok
>   48: Test is_printable_array function                         : Ok
>   49: Test bitmap print                                        : Ok
>   50: x86 rdpmc test                                           : Ok
>   51: Test converting perf time to TSC                         : Ok
>   52: Test dwarf unwind                                        : Ok
>   53: Test x86 instruction decoder - new instructions          : Ok
>   54: Test intel cqm nmi context read                          : Skip
>   #
> 
>    $ make -C tools/perf build-test
>   make: Entering directory '/home/acme/git/linux/tools/perf'
>   - tarpkg: ./tests/perf-targz-src-pkg .
>                    make_tags_O: make tags 
>                   make_debug_O: make DEBUG=1
>               make_no_libbpf_O: make NO_LIBBPF=1
>                 make_no_newt_O: make NO_NEWT=1
>              make_no_libperl_O: make NO_LIBPERL=1
>                 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
>                make_no_slang_O: make NO_SLANG=1
>             make_no_demangle_O: make NO_DEMANGLE=1
>            make_no_libpython_O: make NO_LIBPYTHON=1
>         make_with_babeltrace_O: make LIBBABELTRACE=1
>                   make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
>               make_no_libelf_O: make NO_LIBELF=1
>            make_no_backtrace_O: make NO_BACKTRACE=1
>              make_util_map_o_O: make util/map.o
>            make_no_libunwind_O: make NO_LIBUNWIND=1
>              make_no_libnuma_O: make NO_LIBNUMA=1
>              make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
>                 make_install_O: make install
>               make_clean_all_O: make clean all
>    make_install_prefix_slash_O: make install prefix=/tmp/krava/
>                  make_perf_o_O: make perf.o
>                    make_help_O: make help
>             make_no_libaudit_O: make NO_LIBAUDIT=1
>        make_util_pmu_bison_o_O: make util/pmu-bison.o
>                    make_pure_O: make
>   make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
>             make_no_auxtrace_O: make NO_AUXTRACE=1
>          make_install_prefix_O: make install prefix=/tmp/krava
>            make_no_libbionic_O: make NO_LIBBIONIC=1
>             make_install_bin_O: make install-bin
>                 make_no_gtk2_O: make NO_GTK2=1
>                  make_static_O: make LDFLAGS=-static
>                     make_doc_O: make doc
>   OK
>   make: Leaving directory '/home/acme/git/linux/tools/perf'
>   $

Pulled, thanks a lot Arnaldo!

	Ingo

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

end of thread, other threads:[~2016-10-24 18:45 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-11 22:47 [GIT PULL 00/37] perf/core improvements and fixes Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 01/37] perf symbols: Fix dso__fprintf() print statement Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 02/37] perf ui: Always compile error printing code Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 03/37] perf ui/helpline: Introduce ui_helpline__vshow() Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 04/37] perf tools: Don't check configuration on make clean Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 05/37] perf session: Free environment information when deleting session Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 06/37] perf top: Add missing newline on pr_err call Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 07/37] perf tools: Fix mmap limitations on 32-bit Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 08/37] perf hists: Introduce perf_hpp__list for period related columns Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 09/37] perf hists: Fix period symbol_conf.field_sep display Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 10/37] perf symbols: Ignore ABS symbols when loading data maps Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 11/37] perf hists: Fix typo on hist__entry_add_pair Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 12/37] perf hists: Link hist entry pairs to leader Arnaldo Carvalho de Melo
2012-12-11 22:47 ` [PATCH 13/37] perf evsel: Set leader evsel's ->leader to itself Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 14/37] perf evsel: Convert to _is_group_leader method Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 15/37] perf diff: Remove displacement from struct hist_entry_diff Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 16/37] perf diff: Change compute methods to work with pair directly Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 17/37] perf diff: Change formula " Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 18/37] perf tools: Don't check configuration on make tags Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 19/37] perf tools: Fix TUI helpline output Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 20/37] perf buildid-list: We need to check if a file is ELF first Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 21/37] perf diff: Remove displacement output option Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 22/37] perf symbols: Generalize filter in __fprintf_buildid methods Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 23/37] perf buildid-cache: Add option to show build ids that are missing in the cache Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 24/37] perf machine: Move more machine methods to machine.c Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 25/37] perf evsel: Update sample_size when setting sample_type bits Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 26/37] perf test: Fixup error reporting in basic mmap test Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 27/37] perf test: Use perf_evsel__newtp constructor in the tracepoint tests Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 28/37] perf evsel: Introduce method to request IDs be used Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 29/37] perf evsel: No need to always ask for PERF_FORMAT_ID in read_format Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 30/37] perf evsel: No need to always ask for PERF_FORMAT_TOTAL_TIME_{ENABLED,RUNNING} Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 31/37] perf evlist: Set the leader in the perf_evlist__config method Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 32/37] perf evsel: Adopt fprintf routine from 'perf evlist' Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 33/37] perf tools: Add install-bin Makefile target Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 34/37] perf evsel: Decode read_format and sample_type in perf_evsel__fprintf Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 35/37] perf record: Pass perf_record_opts to the callchain cmdline parsing callback Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 36/37] perf record: Export the callchain parsing routine and help Arnaldo Carvalho de Melo
2012-12-11 22:48 ` [PATCH 37/37] perf top: Use perf_evlist__config() Arnaldo Carvalho de Melo
2013-01-24 15:32 ` [GIT PULL 00/37] perf/core improvements and fixes Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2015-05-26 16:47 Arnaldo Carvalho de Melo
2015-05-27  7:38 ` Ingo Molnar
2015-05-27 12:35   ` Arnaldo Carvalho de Melo
2015-05-27 12:40     ` Adrian Hunter
2015-05-27 12:45     ` Ingo Molnar
2015-06-05 13:21     ` Adrian Hunter
2015-06-05 14:08       ` Arnaldo Carvalho de Melo
2015-11-19 17:52 Arnaldo Carvalho de Melo
2015-11-20 10:01 ` 平松雅巳 / HIRAMATU,MASAMI
2015-11-20 12:08   ` 'Arnaldo Carvalho de Melo'
2015-11-20 16:50     ` 平松雅巳 / HIRAMATU,MASAMI
2015-11-23  8:16 ` Ingo Molnar
2016-10-24 16:20 Arnaldo Carvalho de Melo
2016-10-24 18:44 ` 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).