* [PATCH 1/6] perf list: Fix exit value
2011-08-18 16:49 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
@ 2011-08-18 16:49 ` Arnaldo Carvalho de Melo
2011-08-18 16:50 ` [PATCH 2/6] perf evlist: Fix missing event name init for default event Arnaldo Carvalho de Melo
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-08-18 16:49 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Stephane Eranian, Frederic Weisbecker, Ingo Molnar,
Peter Zijlstra, Arnaldo Carvalho de Melo
From: Stephane Eranian <eranian@google.com>
This patch fixes an issue with the exit value of perf list:
$ perf list; echo $?
129
perf list returns an error exit code even though there is no error.
There was a stray exit(129) in print_events(). This patch removes this
exit().
$ perf list; echo $?
0
$ perf list hw sw
cpu-cycles OR cycles [Hardware event]
stalled-cycles-frontend OR idle-cycles-frontend [Hardware event]
stalled-cycles-backend OR idle-cycles-backend [Hardware event]
instructions [Hardware event]
cache-references [Hardware event]
cache-misses [Hardware event]
branch-instructions OR branches [Hardware event]
branch-misses [Hardware event]
bus-cycles [Hardware event]
cpu-clock [Software event]
task-clock [Software event]
page-faults OR faults [Software event]
minor-faults [Software event]
major-faults [Software event]
context-switches OR cs [Software event]
cpu-migrations OR migrations [Software event]
alignment-faults [Software event]
emulation-faults [Software event]
$ echo $?
0
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20110523123917.GA31060@quad
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/parse-events.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 4ea7e19..d93f3ce 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1097,6 +1097,4 @@ void print_events(const char *event_glob)
printf("\n");
print_tracepoint_events(NULL, NULL);
-
- exit(129);
}
--
1.6.2.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/6] perf evlist: Fix missing event name init for default event
2011-08-18 16:49 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
2011-08-18 16:49 ` [PATCH 1/6] perf list: Fix exit value Arnaldo Carvalho de Melo
@ 2011-08-18 16:50 ` Arnaldo Carvalho de Melo
2011-08-18 16:50 ` [PATCH 3/6] perf tools: Fix error handling of unknown events Arnaldo Carvalho de Melo
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-08-18 16:50 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Stephane Eranian, Ingo Molnar, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Stephane Eranian <eranian@google.com>
When no event is given to perf record, perf top, a default event is
initialized (cycles). However, perf_evlist__add_default() was not
setting the symbolic name for the event. Perf top worked simply because
it was reconstructing the name from the event code. But it should not
have to do this. This patch initializes the evsel->name field properly.
This second version improves the code flow on the non error path.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20110607161936.GA8163@quad
Signed-off-by: Stephane Eranian <eranian@google.com>
[committer note: Use perf_evsel__delete() instead of plain free()]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evlist.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index e03e7bc..c12bd47 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -85,10 +85,19 @@ int perf_evlist__add_default(struct perf_evlist *evlist)
struct perf_evsel *evsel = perf_evsel__new(&attr, 0);
if (evsel == NULL)
- return -ENOMEM;
+ goto error;
+
+ /* use strdup() because free(evsel) assumes name is allocated */
+ evsel->name = strdup("cycles");
+ if (!evsel->name)
+ goto error_free;
perf_evlist__add(evlist, evsel);
return 0;
+error_free:
+ perf_evsel__delete(evsel);
+error:
+ return -ENOMEM;
}
void perf_evlist__disable(struct perf_evlist *evlist)
--
1.6.2.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/6] perf tools: Fix error handling of unknown events
2011-08-18 16:49 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
2011-08-18 16:49 ` [PATCH 1/6] perf list: Fix exit value Arnaldo Carvalho de Melo
2011-08-18 16:50 ` [PATCH 2/6] perf evlist: Fix missing event name init for default event Arnaldo Carvalho de Melo
@ 2011-08-18 16:50 ` Arnaldo Carvalho de Melo
2011-08-18 16:50 ` [PATCH 4/6] perf tools: Fix build against newer glibc Arnaldo Carvalho de Melo
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-08-18 16:50 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Stephane Eranian, Ingo Molnar, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Stephane Eranian <eranian@google.com>
There was a problem with the parse_events() code not printing the
correct event name when an event was unknown and starting with an 'r'.
The source of the problem was the way raw notation was parsed.
Without the patch:
$ perf stat -e retired_foo
invalid event modifier: 'tired_foo'
With the patch:
$ perf stat -e retired_foo
invalid or unsupported event: 'retired_foo'
This also covers the case where the name of the event was not printed at
all when perf was linked with libpfm4.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20110723021043.GA20178@quad
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/parse-events.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index d93f3ce..928918b 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -697,7 +697,11 @@ parse_raw_event(const char **strp, struct perf_event_attr *attr)
return EVT_FAILED;
n = hex2u64(str + 1, &config);
if (n > 0) {
- *strp = str + n + 1;
+ const char *end = str + n + 1;
+ if (*end != '\0' && *end != ',' && *end != ':')
+ return EVT_FAILED;
+
+ *strp = end;
attr->type = PERF_TYPE_RAW;
attr->config = config;
return EVT_HANDLED;
--
1.6.2.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/6] perf tools: Fix build against newer glibc
2011-08-18 16:49 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2011-08-18 16:50 ` [PATCH 3/6] perf tools: Fix error handling of unknown events Arnaldo Carvalho de Melo
@ 2011-08-18 16:50 ` Arnaldo Carvalho de Melo
2011-08-18 16:50 ` [PATCH 5/6] MAINTAINERS: Fix list of perf events source files Arnaldo Carvalho de Melo
2011-08-18 16:50 ` [PATCH 6/6] perf tools: Add group event scheduling option to perf record/stat Arnaldo Carvalho de Melo
5 siblings, 0 replies; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-08-18 16:50 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Josh Boyer, Ingo Molnar, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Josh Boyer <jwboyer@redhat.com>
Upstream glibc commit 295e904 added a definition for __attribute_const__
to cdefs.h. This causes the following error when building perf:
util/include/linux/compiler.h:8:0: error: "__attribute_const__"
redefined [-Werror] /usr/include/sys/cdefs.h:226:0: note: this is the
location of the previous definition
Wrap __attribute_const__ in #ifndef as we do for __always_inline.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20110818113720.GL2227@zod.bos.redhat.com
Signed-off-by: Josh Boyer <jwboyer@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/include/linux/compiler.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/include/linux/compiler.h b/tools/perf/util/include/linux/compiler.h
index 791f9dd..547628e 100644
--- a/tools/perf/util/include/linux/compiler.h
+++ b/tools/perf/util/include/linux/compiler.h
@@ -5,7 +5,9 @@
#define __always_inline inline
#endif
#define __user
+#ifndef __attribute_const__
#define __attribute_const__
+#endif
#define __used __attribute__((__unused__))
--
1.6.2.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/6] MAINTAINERS: Fix list of perf events source files
2011-08-18 16:49 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2011-08-18 16:50 ` [PATCH 4/6] perf tools: Fix build against newer glibc Arnaldo Carvalho de Melo
@ 2011-08-18 16:50 ` Arnaldo Carvalho de Melo
2011-08-18 17:08 ` Joe Perches
2011-08-18 16:50 ` [PATCH 6/6] perf tools: Add group event scheduling option to perf record/stat Arnaldo Carvalho de Melo
5 siblings, 1 reply; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-08-18 16:50 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Geunsik Lim, Ingo Molnar, Jiri Kosina, Joe Perches,
Li Zefan, Paul Mackerras, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Geunsik Lim <geunsik.lim@samsung.com>
Recent changes made kernel/perf_event.c be split and moved to
kernel/events/.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jiri Kosina <trivial@kernel.org>
Cc: Joe Perches <joe@perches.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1313653497-27263-1-git-send-email-leemgs1@gmail.com
Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
MAINTAINERS | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 1e55e1e..7110675 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4971,7 +4971,7 @@ M: Paul Mackerras <paulus@samba.org>
M: Ingo Molnar <mingo@elte.hu>
M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
S: Supported
-F: kernel/perf_event*.c
+F: kernel/events/*
F: include/linux/perf_event.h
F: arch/*/kernel/perf_event*.c
F: arch/*/kernel/*/perf_event*.c
--
1.6.2.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 5/6] MAINTAINERS: Fix list of perf events source files
2011-08-18 16:50 ` [PATCH 5/6] MAINTAINERS: Fix list of perf events source files Arnaldo Carvalho de Melo
@ 2011-08-18 17:08 ` Joe Perches
0 siblings, 0 replies; 9+ messages in thread
From: Joe Perches @ 2011-08-18 17:08 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ingo Molnar, linux-kernel, Geunsik Lim, Jiri Kosina, Li Zefan,
Paul Mackerras, Peter Zijlstra, Arnaldo Carvalho de Melo
On Thu, 2011-08-18 at 13:50 -0300, Arnaldo Carvalho de Melo wrote:
> From: Geunsik Lim <geunsik.lim@samsung.com>
> Recent changes made kernel/perf_event.c be split and moved to
> kernel/events/.
[]
> diff --git a/MAINTAINERS b/MAINTAINERS
[]
> @@ -4971,7 +4971,7 @@ M: Paul Mackerras <paulus@samba.org>
[]
> -F: kernel/perf_event*.c
> +F: kernel/events/*
Trivia...
MAINTAINERS pattern matching in get_maintainer uses
directory/ to match all files and files in subdirectories
directory/* to match only the files in the directory
but no files in any subdirectory
This should probably be kernel/events/ so any
future subdirectory files are also included.
There is no effective difference today because
no subdirectories of kernel/event/ exist.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 6/6] perf tools: Add group event scheduling option to perf record/stat
2011-08-18 16:49 [GIT PULL 0/6] perf/urgent fixes Arnaldo Carvalho de Melo
` (4 preceding siblings ...)
2011-08-18 16:50 ` [PATCH 5/6] MAINTAINERS: Fix list of perf events source files Arnaldo Carvalho de Melo
@ 2011-08-18 16:50 ` Arnaldo Carvalho de Melo
5 siblings, 0 replies; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-08-18 16:50 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Lin Ming, Andi Kleen, Ingo Molnar, Peter Zijlstra,
Arnaldo Carvalho de Melo
From: Lin Ming <ming.m.lin@intel.com>
Group event scheduling command line option is missing in perf
record/stat.
Add it to perf record/stat, which is same as in perf top.
Reported-by: Andi Kleen <andi@firstfloor.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1313577727.2754.5.camel@hp6530s
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-record.c | 4 +++-
tools/perf/builtin-stat.c | 7 +++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index f6426b4..6b0519f 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -45,7 +45,7 @@ static int freq = 1000;
static int output;
static int pipe_output = 0;
static const char *output_name = NULL;
-static int group = 0;
+static bool group = false;
static int realtime_prio = 0;
static bool nodelay = false;
static bool raw_samples = false;
@@ -753,6 +753,8 @@ const struct option record_options[] = {
"child tasks do not inherit counters"),
OPT_UINTEGER('F', "freq", &user_freq, "profile at this frequency"),
OPT_UINTEGER('m', "mmap-pages", &mmap_pages, "number of mmap data pages"),
+ OPT_BOOLEAN(0, "group", &group,
+ "put the counters into a counter group"),
OPT_BOOLEAN('g', "call-graph", &call_graph,
"do call-graph (stack chain/backtrace) recording"),
OPT_INCR('v', "verbose", &verbose,
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 1ad04ce..5deb17d 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -193,6 +193,7 @@ static int big_num_opt = -1;
static const char *cpu_list;
static const char *csv_sep = NULL;
static bool csv_output = false;
+static bool group = false;
static volatile int done = 0;
@@ -280,14 +281,14 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
attr->inherit = !no_inherit;
if (system_wide)
- return perf_evsel__open_per_cpu(evsel, evsel_list->cpus, false);
+ return perf_evsel__open_per_cpu(evsel, evsel_list->cpus, group);
if (target_pid == -1 && target_tid == -1) {
attr->disabled = 1;
attr->enable_on_exec = 1;
}
- return perf_evsel__open_per_thread(evsel, evsel_list->threads, false);
+ return perf_evsel__open_per_thread(evsel, evsel_list->threads, group);
}
/*
@@ -1043,6 +1044,8 @@ static const struct option options[] = {
"stat events on existing thread id"),
OPT_BOOLEAN('a', "all-cpus", &system_wide,
"system-wide collection from all CPUs"),
+ OPT_BOOLEAN('g', "group", &group,
+ "put the counters into a counter group"),
OPT_BOOLEAN('c', "scale", &scale,
"scale/normalize counters"),
OPT_INCR('v', "verbose", &verbose,
--
1.6.2.5
^ permalink raw reply related [flat|nested] 9+ messages in thread