2010-12-01 01:20:16

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [GIT PULL 0/2] perf/core fixes

Hi Ingo,

Please pull from:

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

Now there are 13 outstanding patches in this branch.

Regards,

- Arnaldo

Corey Ashford (1):
perf tools: fix event parsing of comma-separated tracepoint events

Don Zickus (1):
perf packaging: add memcpy to perf MANIFEST

tools/perf/MANIFEST | 1 +
tools/perf/util/parse-events.c | 12 ++++++++----
2 files changed, 9 insertions(+), 4 deletions(-)


2010-12-01 01:20:37

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 1/2] perf packaging: add memcpy to perf MANIFEST

From: Don Zickus <[email protected]>

There seems to be a new dependency on arch/*/lib/memcpy*.S when compiling
the perf tool. Make sure that file is included in the MANIFEST when
creating the tarball.

Cc: Ingo Molnar <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Don Zickus <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/MANIFEST | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 8c7fc0c..c12659d 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -7,6 +7,7 @@ include/linux/stringify.h
lib/rbtree.c
include/linux/swab.h
arch/*/include/asm/unistd*.h
+arch/*/lib/memcpy*.S
include/linux/poison.h
include/linux/magic.h
include/linux/hw_breakpoint.h
--
1.6.2.5

2010-12-01 01:20:18

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH 2/2] perf tools: fix event parsing of comma-separated tracepoint events

From: Corey Ashford <[email protected]>

There are number of issues that prevent the use of multiple tracepoint events
being specified in a -e/--event switch, separated by commas.

For example, perf stat -e irq:irq_handler_entry,irq:irq_handler_exit ... fails
because the tracepoint event parsing code doesn't recognize the comma separator
properly.

This patch corrects those issues.

Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Julia Lawall <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Reported-by: Michael Ellerman <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Corey Ashford <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/parse-events.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 4af5bd5..c305305 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -434,7 +434,7 @@ parse_single_tracepoint_event(char *sys_name,
id = atoll(id_buf);
attr->config = id;
attr->type = PERF_TYPE_TRACEPOINT;
- *strp = evt_name + evt_length;
+ *strp += strlen(sys_name) + evt_length + 1; /* + 1 for the ':' */

attr->sample_type |= PERF_SAMPLE_RAW;
attr->sample_type |= PERF_SAMPLE_TIME;
@@ -495,7 +495,7 @@ static enum event_result parse_tracepoint_event(const char **strp,
struct perf_event_attr *attr)
{
const char *evt_name;
- char *flags;
+ char *flags = NULL, *comma_loc;
char sys_name[MAX_EVENT_LENGTH];
unsigned int sys_length, evt_length;

@@ -514,6 +514,11 @@ static enum event_result parse_tracepoint_event(const char **strp,
sys_name[sys_length] = '\0';
evt_name = evt_name + 1;

+ comma_loc = strchr(evt_name, ',');
+ if (comma_loc) {
+ /* take the event name up to the comma */
+ evt_name = strndup(evt_name, comma_loc - evt_name);
+ }
flags = strchr(evt_name, ':');
if (flags) {
/* split it out: */
@@ -524,9 +529,8 @@ static enum event_result parse_tracepoint_event(const char **strp,
evt_length = strlen(evt_name);
if (evt_length >= MAX_EVENT_LENGTH)
return EVT_FAILED;
-
if (strpbrk(evt_name, "*?")) {
- *strp = evt_name + evt_length;
+ *strp += strlen(sys_name) + evt_length;
return parse_multiple_tracepoint_event(sys_name, evt_name,
flags);
} else
--
1.6.2.5

2010-12-01 08:30:42

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH 2/2] perf tools: fix event parsing of comma-separated tracepoint events


* Arnaldo Carvalho de Melo <[email protected]> wrote:

> From: Corey Ashford <[email protected]>
>
> There are number of issues that prevent the use of multiple tracepoint events
> being specified in a -e/--event switch, separated by commas.
>
> For example, perf stat -e irq:irq_handler_entry,irq:irq_handler_exit ... fails
> because the tracepoint event parsing code doesn't recognize the comma separator
> properly.
>
> This patch corrects those issues.

One other thing we seem to have forgotten in the perf stat area: could we please
make Stephane's --big-num feature the default for perf stat? Big numbers are much
easier to read that way:

Before:

aldebaran:~> perf stat ./loop_100b_instructions

Performance counter stats for './loop_100b_instructions':

23958.911461 task-clock-msecs # 0.998 CPUs
50 context-switches # 0.000 M/sec
2 CPU-migrations # 0.000 M/sec
106 page-faults # 0.000 M/sec
76647095433 cycles # 3199.106 M/sec
110471119457 instructions # 1.441 IPC
10116354483 branches # 422.238 M/sec
518642 branch-misses # 0.005 %
220770 cache-references # 0.009 M/sec
81657 cache-misses # 0.003 M/sec

24.006780937 seconds time elapsed

After:

aldebaran:~> perf stat --big-num ./loop_100b_instructions

Performance counter stats for './loop_100b_instructions':

23869.990497 task-clock-msecs # 0.998 CPUs
58 context-switches # 0.000 M/sec
43 CPU-migrations # 0.000 M/sec
106 page-faults # 0.000 M/sec
76,338,390,893 cycles # 3198.091 M/sec
110,473,163,060 instructions # 1.447 IPC
10,114,252,456 branches # 423.723 M/sec
1,290,825 branch-misses # 0.013 %
1,713,770 cache-references # 0.072 M/sec
188,051 cache-misses # 0.008 M/sec

23.917757467 seconds time elapsed

perf stat output isnt an ABI.

(Btw., we should probably also add tabular output for scripts. I thought we had that
- but apparently not.)

Ingo