All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Fixes and usability improvements
@ 2010-04-08 14:38 Arnaldo Carvalho de Melo
  2010-04-08 14:38 ` [PATCH 1/6] perf TUI: Show filters on the title and add help line about how to zoom out Arnaldo Carvalho de Melo
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-04-08 14:38 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling from:

gi://gi.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf

	Freshly rebased from tip/perf/core,

Thanks,

- Arnaldo

Arnaldo Carvalho de Melo (4):
  perf TUI: Show filters on the title and add help line about how to zoom out
  perf TUI: Move "Yes" button to before "No"
  perf tools: Reorganize some structs to save space
  perf trace: Ignore "overwrite" field if present in /events/header_page

Randy Dunlap (2):
  perf bench: fix spello
  perf: cleanup some Documentation

 tools/perf/Documentation/perf-bench.txt |    6 +-
 tools/perf/Documentation/perf-sched.txt |    4 +-
 tools/perf/bench/sched-pipe.c           |    2 +-
 tools/perf/builtin-sched.c              |    2 +-
 tools/perf/builtin-timechart.c          |    2 -
 tools/perf/util/event.h                 |    4 +-
 tools/perf/util/header.h                |    2 +-
 tools/perf/util/newt.c                  |   98 ++++++++++++++++++++++---------
 tools/perf/util/probe-event.h           |    2 +-
 tools/perf/util/probe-finder.h          |    4 +-
 tools/perf/util/trace-event-parse.c     |   49 +++++++++++-----
 11 files changed, 116 insertions(+), 59 deletions(-)


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

* [PATCH 1/6] perf TUI: Show filters on the title and add help line about how to zoom out
  2010-04-08 14:38 [PATCH 0/6] Fixes and usability improvements Arnaldo Carvalho de Melo
@ 2010-04-08 14:38 ` Arnaldo Carvalho de Melo
  2010-04-08 14:38 ` [PATCH 2/6] perf TUI: Move "Yes" button to before "No" Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-04-08 14:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo,
	Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra,
	Paul Mackerras

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

Suggested-by: Ingo Molnar <molnar@elte.hu>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/newt.c |   96 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 68 insertions(+), 28 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 6d6e022..c0e71aa 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -411,7 +411,7 @@ static void hist_browser__delete(struct hist_browser *self)
 }
 
 static int hist_browser__populate(struct hist_browser *self, struct rb_root *hists,
-				  u64 nr_hists, u64 session_total)
+				  u64 nr_hists, u64 session_total, const char *title)
 {
 	int max_len = 0, idx, cols, rows;
 	struct ui_progress *progress;
@@ -476,7 +476,7 @@ static int hist_browser__populate(struct hist_browser *self, struct rb_root *his
 		newtListboxSetWidth(self->tree, max_len);
 
 	newtCenteredWindow(max_len + (symbol_conf.use_callchain ? 5 : 0),
-			   rows - 5, "Report");
+			   rows - 5, title);
 	self->form = newt_form__new();
 	if (self->form == NULL)
 		return -1;
@@ -495,7 +495,7 @@ enum hist_filter {
 	HIST_FILTER__THREAD,
 };
 
-static u64 hists__filter_by_dso(struct rb_root *hists, struct dso *dso,
+static u64 hists__filter_by_dso(struct rb_root *hists, const struct dso *dso,
 				u64 *session_total)
 {
 	struct rb_node *nd;
@@ -560,25 +560,47 @@ out:
 	return *(struct thread **)(self->selection + 1);
 }
 
+static int hist_browser__title(char *bf, size_t size, const char *input_name,
+			       const struct dso *dso, const struct thread *thread)
+{
+	int printed = 0;
+
+	if (thread)
+		printed += snprintf(bf + printed, size - printed,
+				    "Thread: %s(%d)",
+				    (thread->comm_set ?  thread->comm : ""),
+				    thread->pid);
+	if (dso)
+		printed += snprintf(bf + printed, size - printed,
+				    "%sDSO: %s", thread ? " " : "",
+				    dso->short_name);
+	return printed ?: snprintf(bf, size, "Report: %s", input_name);
+}
+
 int perf_session__browse_hists(struct rb_root *hists, u64 nr_hists,
 			       u64 session_total, const char *helpline,
 			       const char *input_name)
 {
+	struct hist_browser *browser = hist_browser__new();
+	const struct thread *thread_filter = NULL;
+	const struct dso *dso_filter = NULL;
 	struct newtExitStruct es;
-	bool dso_filtered = false, thread_filtered = false;
+	char msg[160];
 	int err = -1;
-	struct hist_browser *browser = hist_browser__new();
 
 	if (browser == NULL)
 		return -1;
 
 	newtPushHelpLine(helpline);
 
-	if (hist_browser__populate(browser, hists, nr_hists, session_total) < 0)
+	hist_browser__title(msg, sizeof(msg), input_name,
+			    dso_filter, thread_filter);
+	if (hist_browser__populate(browser, hists, nr_hists, session_total, msg) < 0)
 		goto out;
 
 	while (1) {
 		const struct thread *thread;
+		const struct dso *dso;
 		char *options[16];
 		int nr_options = 0, choice = 0, i,
 		    annotate = -2, zoom_dso = -2, zoom_thread = -2;
@@ -602,20 +624,21 @@ int perf_session__browse_hists(struct rb_root *hists, u64 nr_hists,
 			     browser->selection->sym->name) > 0)
 			annotate = nr_options++;
 
-		if (browser->selection->map != NULL &&
-		    asprintf(&options[nr_options], "Zoom %s %s DSO",
-			     dso_filtered ? "out of" : "into",
-			     (browser->selection->map->dso->kernel ? "the Kernel" :
-			      browser->selection->map->dso->short_name)) > 0)
-			zoom_dso = nr_options++;
-
 		thread = hist_browser__selected_thread(browser);
 		if (thread != NULL &&
 		    asprintf(&options[nr_options], "Zoom %s %s(%d) thread",
-			     (thread_filtered ? "out of" : "into"),
-			     (thread->comm_set ?  thread->comm : ""), thread->pid) > 0)
+			     (thread_filter ? "out of" : "into"),
+			     (thread->comm_set ? thread->comm : ""),
+			     thread->pid) > 0)
 			zoom_thread = nr_options++;
 
+		dso = browser->selection->map ? browser->selection->map->dso : NULL;
+		if (dso != NULL &&
+		    asprintf(&options[nr_options], "Zoom %s %s DSO",
+			     (dso_filter ? "out of" : "into"),
+			     (dso->kernel ? "the Kernel" : dso->short_name)) > 0)
+			zoom_dso = nr_options++;
+
 		options[nr_options++] = (char *)"Exit";
 
 		choice = popup_menu(nr_options, options);
@@ -637,22 +660,39 @@ do_annotate:
 						 "kallsyms file");
 				continue;
 			}
-			map_symbol__annotate_browser(browser->selection,
-						     input_name);
+			map_symbol__annotate_browser(browser->selection, input_name);
 		} else if (choice == zoom_dso) {
-			nr_hists = hists__filter_by_dso(hists,
-							(dso_filtered ? NULL :
-							 browser->selection->map->dso),
-							&session_total);
-			dso_filtered = !dso_filtered;
-			if (hist_browser__populate(browser, hists, nr_hists, session_total) < 0)
+			if (dso_filter) {
+				newtPopHelpLine();
+				dso_filter = NULL;
+			} else {
+				snprintf(msg, sizeof(msg),
+					 "To zoom out press -> + \"Zoom out of %s DSO\"",
+					 dso->kernel ? "the Kernel" : dso->short_name);
+				newtPushHelpLine(msg);
+				dso_filter = dso;
+			}
+			nr_hists = hists__filter_by_dso(hists, dso_filter, &session_total);
+			hist_browser__title(msg, sizeof(msg), input_name,
+					    dso_filter, thread_filter);
+			if (hist_browser__populate(browser, hists, nr_hists, session_total, msg) < 0)
 				goto out;
 		} else if (choice == zoom_thread) {
-			nr_hists = hists__filter_by_thread(hists,
-							   (thread_filtered ? NULL : thread),
-							   &session_total);
-			thread_filtered = !thread_filtered;
-			if (hist_browser__populate(browser, hists, nr_hists, session_total) < 0)
+			if (thread_filter) {
+				newtPopHelpLine();
+				thread_filter = NULL;
+			} else {
+				snprintf(msg, sizeof(msg),
+					 "To zoom out press -> + \"Zoom out of %s(%d) thread\"",
+					 (thread->comm_set ? thread->comm : ""),
+					 thread->pid);
+				newtPushHelpLine(msg);
+				thread_filter = thread;
+			}
+			nr_hists = hists__filter_by_thread(hists, thread_filter, &session_total);
+			hist_browser__title(msg, sizeof(msg), input_name,
+					    dso_filter, thread_filter);
+			if (hist_browser__populate(browser, hists, nr_hists, session_total, msg) < 0)
 				goto out;
 		}
 	}
-- 
1.6.2.5


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

* [PATCH 2/6] perf TUI: Move "Yes" button to before "No"
  2010-04-08 14:38 [PATCH 0/6] Fixes and usability improvements Arnaldo Carvalho de Melo
  2010-04-08 14:38 ` [PATCH 1/6] perf TUI: Show filters on the title and add help line about how to zoom out Arnaldo Carvalho de Melo
@ 2010-04-08 14:38 ` Arnaldo Carvalho de Melo
  2010-04-08 14:38 ` [PATCH 3/6] perf tools: Reorganize some structs to save space Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-04-08 14:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo,
	Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra,
	Paul Mackerras

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

Esc + Enter should be enough warning to avoid accidentaly exiting from
the browser.

Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/newt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index c0e71aa..7a123a9 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -132,7 +132,7 @@ static bool dialog_yesno(const char *msg)
 {
 	/* newtWinChoice should really be accepting const char pointers... */
 	char yes[] = "Yes", no[] = "No";
-	return newtWinChoice(NULL, no, yes, (char *)msg) == 2;
+	return newtWinChoice(NULL, yes, no, (char *)msg) == 1;
 }
 
 /*
-- 
1.6.2.5


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

* [PATCH 3/6] perf tools: Reorganize some structs to save space
  2010-04-08 14:38 [PATCH 0/6] Fixes and usability improvements Arnaldo Carvalho de Melo
  2010-04-08 14:38 ` [PATCH 1/6] perf TUI: Show filters on the title and add help line about how to zoom out Arnaldo Carvalho de Melo
  2010-04-08 14:38 ` [PATCH 2/6] perf TUI: Move "Yes" button to before "No" Arnaldo Carvalho de Melo
@ 2010-04-08 14:38 ` Arnaldo Carvalho de Melo
  2010-04-08 15:11   ` Peter Zijlstra
  2010-04-08 14:38 ` [PATCH 4/6] perf bench: fix spello Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-04-08 14:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo,
	Frédéric Weisbecker, Mike Galbraith, Peter Zijlstra,
	Paul Mackerras

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

Using 'pahole --packable' I found some structs that could be reorganized
to eliminate alignment holes, in some cases getting them to be cacheline
multiples.

[acme@doppio linux-2.6-tip]$ codiff perf.old ~/bin/perf
builtin-annotate.c:
  struct perf_session    |   -8
  struct perf_header     |   -8
 2 structs changed

builtin-diff.c:
  struct sample_data         |   -8
 1 struct changed
  diff__process_sample_event |   -8
 1 function changed, 8 bytes removed, diff: -8

builtin-sched.c:
  struct sched_atom      |   -8
 1 struct changed

builtin-timechart.c:
  struct per_pid         |   -8
 1 struct changed
  cmd_timechart          |  -16
 1 function changed, 16 bytes removed, diff: -16

builtin-probe.c:
  struct perf_probe_point |   -8
  struct perf_probe_event |   -8
 2 structs changed
  opt_add_probe_event     |   -3
 1 function changed, 3 bytes removed, diff: -3

util/probe-finder.c:
  struct probe_finder      |   -8
 1 struct changed
  find_kprobe_trace_events |  -16
 1 function changed, 16 bytes removed, diff: -16

/home/acme/bin/perf:
 4 functions changed, 43 bytes removed, diff: -43
[acme@doppio linux-2.6-tip]$

Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c     |    2 +-
 tools/perf/builtin-timechart.c |    2 --
 tools/perf/util/event.h        |    4 ++--
 tools/perf/util/header.h       |    2 +-
 tools/perf/util/probe-event.h  |    2 +-
 tools/perf/util/probe-finder.h |    4 ++--
 6 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 4f5a03e..5e59c0c 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -68,10 +68,10 @@ enum sched_event_type {
 
 struct sched_atom {
 	enum sched_event_type	type;
+	int			specific_wait;
 	u64			timestamp;
 	u64			duration;
 	unsigned long		nr;
-	int			specific_wait;
 	sem_t			*wait_sem;
 	struct task_desc	*wakee;
 };
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 266e7aa..369c1b4 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -77,8 +77,6 @@ struct per_pid {
 
 	struct per_pidcomm *all;
 	struct per_pidcomm *current;
-
-	int painted;
 };
 
 
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index a33b949..7f7cf85 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -68,11 +68,11 @@ struct sample_data {
 	u64 addr;
 	u64 id;
 	u64 stream_id;
-	u32 cpu;
 	u64 period;
-	struct ip_callchain *callchain;
+	u32 cpu;
 	u32 raw_size;
 	void *raw_data;
+	struct ip_callchain *callchain;
 };
 
 #define BUILD_ID_SIZE 20
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index 82a6af7..c059f08 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -47,13 +47,13 @@ int perf_file_header__read(struct perf_file_header *self,
 struct perf_header {
 	int			frozen;
 	int			attrs, size;
+	bool			needs_swap;
 	struct perf_header_attr **attr;
 	s64			attr_offset;
 	u64			data_offset;
 	u64			data_size;
 	u64			event_offset;
 	u64			event_size;
-	bool			needs_swap;
 	DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
 };
 
diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h
index cd308b0..9d99fc2 100644
--- a/tools/perf/util/probe-event.h
+++ b/tools/perf/util/probe-event.h
@@ -40,9 +40,9 @@ struct perf_probe_point {
 	char		*file;		/* File path */
 	char		*function;	/* Function name */
 	int		line;		/* Line number */
+	bool		retprobe;	/* Return probe flag */
 	char		*lazy_line;	/* Lazy matching pattern */
 	unsigned long	offset;		/* Offset from function entry */
-	bool		retprobe;	/* Return probe flag */
 };
 
 /* Perf probe probing argument field chain */
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 3564f22..2a27132 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -31,13 +31,13 @@ extern int find_line_range(int fd, struct line_range *lr);
 
 struct probe_finder {
 	struct perf_probe_event	*pev;		/* Target probe event */
-	int			ntevs;		/* number of trace events */
 	struct kprobe_trace_event *tevs;	/* Result trace events */
+	int			ntevs;		/* number of trace events */
 
 	/* For function searching */
+	int			lno;		/* Line number */
 	Dwarf_Addr		addr;		/* Address */
 	const char		*fname;		/* Real file name */
-	int			lno;		/* Line number */
 	Dwarf_Die		cu_die;		/* Current CU */
 	struct list_head	lcache;		/* Line cache for lazy match */
 
-- 
1.6.2.5


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

* [PATCH 4/6] perf bench: fix spello
  2010-04-08 14:38 [PATCH 0/6] Fixes and usability improvements Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2010-04-08 14:38 ` [PATCH 3/6] perf tools: Reorganize some structs to save space Arnaldo Carvalho de Melo
@ 2010-04-08 14:38 ` Arnaldo Carvalho de Melo
  2010-04-08 14:38 ` [PATCH 5/6] perf: cleanup some Documentation Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-04-08 14:38 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Randy Dunlap, Peter Zijlstra, Paul Mackerra, s

From: Randy Dunlap <randy.dunlap@oracle.com>

Fix spello in user message.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Cc: Paul Mackerra <paulus@samba.org>s
LKML-Reference: <20100331113056.2c7df509.randy.dunlap@oracle.com>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 tools/perf/bench/sched-pipe.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c
index 4f77c7c..d9ab3ce 100644
--- a/tools/perf/bench/sched-pipe.c
+++ b/tools/perf/bench/sched-pipe.c
@@ -93,7 +93,7 @@ int bench_sched_pipe(int argc, const char **argv,
 
 	switch (bench_format) {
 	case BENCH_FORMAT_DEFAULT:
-		printf("# Extecuted %d pipe operations between two tasks\n\n",
+		printf("# Executed %d pipe operations between two tasks\n\n",
 			loops);
 
 		result_usec = diff.tv_sec * 1000000;
-- 
1.6.2.5


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

* [PATCH 5/6] perf: cleanup some Documentation
  2010-04-08 14:38 [PATCH 0/6] Fixes and usability improvements Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2010-04-08 14:38 ` [PATCH 4/6] perf bench: fix spello Arnaldo Carvalho de Melo
@ 2010-04-08 14:38 ` Arnaldo Carvalho de Melo
  2010-04-08 14:38 ` [PATCH 6/6] perf trace: Ignore "overwrite" field if present in /events/header_page Arnaldo Carvalho de Melo
  2010-04-08 14:59 ` [PATCH 0/6] Fixes and usability improvements Ingo Molnar
  6 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-04-08 14:38 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Randy Dunlap, Peter Zijlstra, Paul Mackerras

From: Randy Dunlap <randy.dunlap@oracle.com>

Correct typos in perf bench & perf sched help text.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <20100331113100.cc898487.randy.dunlap@oracle.com>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 tools/perf/Documentation/perf-bench.txt |    6 +++---
 tools/perf/Documentation/perf-sched.txt |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/Documentation/perf-bench.txt b/tools/perf/Documentation/perf-bench.txt
index ae525ac..0181ddd 100644
--- a/tools/perf/Documentation/perf-bench.txt
+++ b/tools/perf/Documentation/perf-bench.txt
@@ -19,12 +19,12 @@ COMMON OPTIONS
 -f::
 --format=::
 Specify format style.
-Current available format styles are,
+Current available format styles are:
 
 'default'::
 Default style. This is mainly for human reading.
 ---------------------
-% perf bench sched pipe                      # with no style specify
+% perf bench sched pipe                      # with no style specified
 (executing 1000000 pipe operations between two tasks)
         Total time:5.855 sec
                 5.855061 usecs/op
@@ -79,7 +79,7 @@ options (20 sender and receiver processes per group)
 
       Total time:0.308 sec
 
-% perf bench sched messaging -t -g 20        # be multi-thread,with 20 groups
+% perf bench sched messaging -t -g 20        # be multi-thread, with 20 groups
 (20 sender and receiver threads per group)
 (20 groups == 800 threads run)
 
diff --git a/tools/perf/Documentation/perf-sched.txt b/tools/perf/Documentation/perf-sched.txt
index 1ce7919..8417644 100644
--- a/tools/perf/Documentation/perf-sched.txt
+++ b/tools/perf/Documentation/perf-sched.txt
@@ -12,7 +12,7 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-There's four variants of perf sched:
+There are four variants of perf sched:
 
   'perf sched record <command>' to record the scheduling events
   of an arbitrary workload.
@@ -27,7 +27,7 @@ There's four variants of perf sched:
   via perf sched record. (this is done by starting up mockup threads
   that mimic the workload based on the events in the trace. These
   threads can then replay the timings (CPU runtime and sleep patterns)
-  of the workload as it occured when it was recorded - and can repeat
+  of the workload as it occurred when it was recorded - and can repeat
   it a number of times, measuring its performance.)
 
 OPTIONS
-- 
1.6.2.5


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

* [PATCH 6/6] perf trace: Ignore "overwrite" field if present in /events/header_page
  2010-04-08 14:38 [PATCH 0/6] Fixes and usability improvements Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2010-04-08 14:38 ` [PATCH 5/6] perf: cleanup some Documentation Arnaldo Carvalho de Melo
@ 2010-04-08 14:38 ` Arnaldo Carvalho de Melo
  2010-04-08 14:59 ` [PATCH 0/6] Fixes and usability improvements Ingo Molnar
  6 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-04-08 14:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo,
	Frédéric Weisbecker, Hitoshi Mitake, Mike Galbraith,
	Peter Zijlstra, Paul Mackerras

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

That is not used in perf where we have the LOST events.

Without this patch we get:

[root@doppio ~]# perf lock report | head -3
  Warning: Error: expected 'data' but read 'overwrite'

So, to make the same perf command work with kernels with and without
this field, introduce variants for the parsing routines to not warn the
user in such case.

Discussed-with: Steven Rostedt <rostedt@goodmis.org>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/trace-event-parse.c |   49 ++++++++++++++++++++++++----------
 1 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 9b3c20f..3b81250 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -37,6 +37,8 @@ int header_page_ts_offset;
 int header_page_ts_size;
 int header_page_size_offset;
 int header_page_size_size;
+int header_page_overwrite_offset;
+int header_page_overwrite_size;
 int header_page_data_offset;
 int header_page_data_size;
 
@@ -628,23 +630,32 @@ static int test_type(enum event_type type, enum event_type expect)
 	return 0;
 }
 
-static int test_type_token(enum event_type type, char *token,
-		    enum event_type expect, const char *expect_tok)
+static int __test_type_token(enum event_type type, char *token,
+			     enum event_type expect, const char *expect_tok,
+			     bool warn)
 {
 	if (type != expect) {
-		warning("Error: expected type %d but read %d",
-		    expect, type);
+		if (warn)
+			warning("Error: expected type %d but read %d",
+				expect, type);
 		return -1;
 	}
 
 	if (strcmp(token, expect_tok) != 0) {
-		warning("Error: expected '%s' but read '%s'",
-		    expect_tok, token);
+		if (warn)
+			warning("Error: expected '%s' but read '%s'",
+				expect_tok, token);
 		return -1;
 	}
 	return 0;
 }
 
+static int test_type_token(enum event_type type, char *token,
+			   enum event_type expect, const char *expect_tok)
+{
+	return __test_type_token(type, token, expect, expect_tok, true);
+}
+
 static int __read_expect_type(enum event_type expect, char **tok, int newline_ok)
 {
 	enum event_type type;
@@ -661,7 +672,8 @@ static int read_expect_type(enum event_type expect, char **tok)
 	return __read_expect_type(expect, tok, 1);
 }
 
-static int __read_expected(enum event_type expect, const char *str, int newline_ok)
+static int __read_expected(enum event_type expect, const char *str,
+			   int newline_ok, bool warn)
 {
 	enum event_type type;
 	char *token;
@@ -672,21 +684,26 @@ static int __read_expected(enum event_type expect, const char *str, int newline_
 	else
 		type = read_token_item(&token);
 
-	ret = test_type_token(type, token, expect, str);
+	ret = __test_type_token(type, token, expect, str, warn);
 
 	free_token(token);
 
 	return ret;
 }
 
+static int read_expected_warn(enum event_type expect, const char *str, bool warn)
+{
+	return __read_expected(expect, str, 1, warn);
+}
+
 static int read_expected(enum event_type expect, const char *str)
 {
-	return __read_expected(expect, str, 1);
+	return __read_expected(expect, str, 1, true);
 }
 
 static int read_expected_item(enum event_type expect, const char *str)
 {
-	return __read_expected(expect, str, 0);
+	return __read_expected(expect, str, 0, true);
 }
 
 static char *event_read_name(void)
@@ -3088,7 +3105,7 @@ static void print_args(struct print_arg *args)
 }
 
 static void parse_header_field(const char *field,
-			       int *offset, int *size)
+			       int *offset, int *size, bool warn)
 {
 	char *token;
 	int type;
@@ -3103,7 +3120,7 @@ static void parse_header_field(const char *field,
 		goto fail;
 	free_token(token);
 
-	if (read_expected(EVENT_ITEM, field) < 0)
+	if (read_expected_warn(EVENT_ITEM, field, warn) < 0)
 		return;
 	if (read_expected(EVENT_OP, ";") < 0)
 		return;
@@ -3160,11 +3177,13 @@ int parse_header_page(char *buf, unsigned long size)
 	init_input_buf(buf, size);
 
 	parse_header_field("timestamp", &header_page_ts_offset,
-			   &header_page_ts_size);
+			   &header_page_ts_size, true);
 	parse_header_field("commit", &header_page_size_offset,
-			   &header_page_size_size);
+			   &header_page_size_size, true);
+	parse_header_field("overwrite", &header_page_overwrite_offset,
+			   &header_page_overwrite_size, false);
 	parse_header_field("data", &header_page_data_offset,
-			   &header_page_data_size);
+			   &header_page_data_size, true);
 
 	return 0;
 }
-- 
1.6.2.5


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

* Re: [PATCH 0/6] Fixes and usability improvements
  2010-04-08 14:38 [PATCH 0/6] Fixes and usability improvements Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2010-04-08 14:38 ` [PATCH 6/6] perf trace: Ignore "overwrite" field if present in /events/header_page Arnaldo Carvalho de Melo
@ 2010-04-08 14:59 ` Ingo Molnar
  6 siblings, 0 replies; 10+ messages in thread
From: Ingo Molnar @ 2010-04-08 14:59 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Peter Zijlstra, Fr??d??ric Weisbecker, Paul Mackerras


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

> Hi Ingo,
> 
> 	Please consider pulling from:
> 
> gi://gi.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf
> 
> 	Freshly rebased from tip/perf/core,
> 
> Thanks,
> 
> - Arnaldo
> 
> Arnaldo Carvalho de Melo (4):
>   perf TUI: Show filters on the title and add help line about how to zoom out
>   perf TUI: Move "Yes" button to before "No"
>   perf tools: Reorganize some structs to save space
>   perf trace: Ignore "overwrite" field if present in /events/header_page
> 
> Randy Dunlap (2):
>   perf bench: fix spello
>   perf: cleanup some Documentation
> 
>  tools/perf/Documentation/perf-bench.txt |    6 +-
>  tools/perf/Documentation/perf-sched.txt |    4 +-
>  tools/perf/bench/sched-pipe.c           |    2 +-
>  tools/perf/builtin-sched.c              |    2 +-
>  tools/perf/builtin-timechart.c          |    2 -
>  tools/perf/util/event.h                 |    4 +-
>  tools/perf/util/header.h                |    2 +-
>  tools/perf/util/newt.c                  |   98 ++++++++++++++++++++++---------
>  tools/perf/util/probe-event.h           |    2 +-
>  tools/perf/util/probe-finder.h          |    4 +-
>  tools/perf/util/trace-event-parse.c     |   49 +++++++++++-----
>  11 files changed, 116 insertions(+), 59 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

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

* Re: [PATCH 3/6] perf tools: Reorganize some structs to save space
  2010-04-08 14:38 ` [PATCH 3/6] perf tools: Reorganize some structs to save space Arnaldo Carvalho de Melo
@ 2010-04-08 15:11   ` Peter Zijlstra
  2010-04-08 15:27     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Zijlstra @ 2010-04-08 15:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, linux-kernel, Arnaldo Carvalho de Melo,
	Frédéric Weisbecker, Mike Galbraith, Paul Mackerras

On Thu, 2010-04-08 at 11:38 -0300, Arnaldo Carvalho de Melo wrote:
> @@ -68,11 +68,11 @@ struct sample_data {
>         u64 addr;
>         u64 id;
>         u64 stream_id;
> -       u32 cpu;
>         u64 period;
> -       struct ip_callchain *callchain;
> +       u32 cpu;
>         u32 raw_size;
>         void *raw_data;
> +       struct ip_callchain *callchain;
>  }; 

If that is a struct that is to match a kernel produced record then this
is utterly broken.


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

* Re: [PATCH 3/6] perf tools: Reorganize some structs to save space
  2010-04-08 15:11   ` Peter Zijlstra
@ 2010-04-08 15:27     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-04-08 15:27 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Ingo Molnar, linux-kernel, Frédéric Weisbecker,
	Mike Galbraith, Paul Mackerras

Em Thu, Apr 08, 2010 at 05:11:49PM +0200, Peter Zijlstra escreveu:
> On Thu, 2010-04-08 at 11:38 -0300, Arnaldo Carvalho de Melo wrote:
> > @@ -68,11 +68,11 @@ struct sample_data {
> >         u64 addr;
> >         u64 id;
> >         u64 stream_id;
> > -       u32 cpu;
> >         u64 period;
> > -       struct ip_callchain *callchain;
> > +       u32 cpu;
> >         u32 raw_size;
> >         void *raw_data;
> > +       struct ip_callchain *callchain;
> >  }; 
> 
> If that is a struct that is to match a kernel produced record then this
> is utterly broken.

No, it is not, it is filled in userspace:

tools/perf/util/event.c:

int event__parse_sample(event_t *event, u64 type, struct sample_data *data)
{
        u64 *array = event->sample.array;

        if (type & PERF_SAMPLE_IP) {
                data->ip = event->ip.ip;
                array++;
        }

        if (type & PERF_SAMPLE_TID) {
                u32 *p = (u32 *)array;
                data->pid = p[0];
                data->tid = p[1];
                array++;
        }

        if (type & PERF_SAMPLE_TIME) {
                data->time = *array;
                array++;
        }
<SNIP>

We can reorder it at will and decoupled from any kernel changes.

- Arnaldo

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

end of thread, other threads:[~2010-04-08 15:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-08 14:38 [PATCH 0/6] Fixes and usability improvements Arnaldo Carvalho de Melo
2010-04-08 14:38 ` [PATCH 1/6] perf TUI: Show filters on the title and add help line about how to zoom out Arnaldo Carvalho de Melo
2010-04-08 14:38 ` [PATCH 2/6] perf TUI: Move "Yes" button to before "No" Arnaldo Carvalho de Melo
2010-04-08 14:38 ` [PATCH 3/6] perf tools: Reorganize some structs to save space Arnaldo Carvalho de Melo
2010-04-08 15:11   ` Peter Zijlstra
2010-04-08 15:27     ` Arnaldo Carvalho de Melo
2010-04-08 14:38 ` [PATCH 4/6] perf bench: fix spello Arnaldo Carvalho de Melo
2010-04-08 14:38 ` [PATCH 5/6] perf: cleanup some Documentation Arnaldo Carvalho de Melo
2010-04-08 14:38 ` [PATCH 6/6] perf trace: Ignore "overwrite" field if present in /events/header_page Arnaldo Carvalho de Melo
2010-04-08 14:59 ` [PATCH 0/6] Fixes and usability improvements Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.