* [GIT PULL 0/5] perf/core improvements and fixes
@ 2011-02-17 20:41 Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 1/5] perf python: Add cgroup.c to setup.py to get it building again Arnaldo Carvalho de Melo
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-02-17 20:41 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Arun Sharma,
David S . Miller, Frederic Weisbecker, Ingo Molnar,
Mike Galbraith, Paul Mackerras, Peter Zijlstra, Robert Richter,
Stephane Eranian, Steven Rostedt, Tom Zanussi,
Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling from:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/core
Regards,
- Arnaldo
Arnaldo Carvalho de Melo (4):
perf python: Add cgroup.c to setup.py to get it building again
perf hists: Print number of samples, not the period sum
perf record: Delay setting the header writing atexit call
perf report: Tell the user when a perf.data file has no samples
Stephane Eranian (1):
perf: make perf stat print user provided full event names
tools/perf/builtin-record.c | 10 +++++-----
tools/perf/builtin-report.c | 6 ++++++
tools/perf/util/evsel.c | 1 +
tools/perf/util/evsel.h | 7 +++++++
tools/perf/util/hist.c | 7 +++++--
tools/perf/util/parse-events.c | 10 ++++++++++
tools/perf/util/setup.py | 2 +-
7 files changed, 35 insertions(+), 8 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/5] perf python: Add cgroup.c to setup.py to get it building again
2011-02-17 20:41 [GIT PULL 0/5] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2011-02-17 20:41 ` Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 2/5] perf: make perf stat print user provided full event names Arnaldo Carvalho de Melo
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-02-17 20:41 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Frederic Weisbecker,
Ingo Molnar, Mike Galbraith, Paul Mackerras, Peter Zijlstra,
Stephane Eranian, Tom Zanussi
From: Arnaldo Carvalho de Melo <acme@redhat.com>
The 023695d cset added a new file, util/cgroup.c, that is referenced from
util/evsel.c, so it needs to be present in util/setup.py so that the python
shared object binding works, fixing this:
[root@emilia linux]# export PYTHONPATH=~acme/git/build/perf/python/
[root@emilia linux]# ./tools/perf/python/twatch.py
Traceback (most recent call last):
File "./tools/perf/python/twatch.py", line 16, in <module>
import perf
ImportError: /home/acme/git/build/perf/python/perf.so: undefined symbol: close_cgroup
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/setup.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 1947b04..e24ffad 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -5,7 +5,7 @@ from distutils.core import setup, Extension
perf = Extension('perf',
sources = ['util/python.c', 'util/ctype.c', 'util/evlist.c',
'util/evsel.c', 'util/cpumap.c', 'util/thread_map.c',
- 'util/util.c', 'util/xyarray.c'],
+ 'util/util.c', 'util/xyarray.c', 'util/cgroup.c'],
include_dirs = ['util/include'],
extra_compile_args = ['-fno-strict-aliasing', '-Wno-write-strings'])
--
1.6.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] perf: make perf stat print user provided full event names
2011-02-17 20:41 [GIT PULL 0/5] perf/core improvements and fixes Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 1/5] perf python: Add cgroup.c to setup.py to get it building again Arnaldo Carvalho de Melo
@ 2011-02-17 20:41 ` Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 3/5] perf hists: Print number of samples, not the period sum Arnaldo Carvalho de Melo
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-02-17 20:41 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Stephane Eranian, Arun Sharma, David S. Miller,
Frederic Weisbecker, Ingo Molnar, Paul Mackerras, Peter Zijlstra,
Robert Richter, Stephane Eranian, Arnaldo Carvalho de Melo
From: Stephane Eranian <eranian@google.com>
This patch changes the way perf stat prints event names at the end of a
run. Until now, it was trying to reconstruct the event name from its
encoding. The problem is that it would only print generic events without
their modifiers (u, k, pp).
This patch saves the event name as passed by the user in the evsel
struct and uses it to print the final event name.
This would also work in case perf is linked with a library (such as
libpfm4) which provides full PMU event tables.
$ perf stat -e cycles:u,cycles:k date
Wed Feb 16 14:58:52 CET 2011
Performance counter stats for 'date':
568600 cycles:u
2779715 cycles:k
0.001908182 seconds time elapsed
Cc: Arun Sharma <arun@sharma-home.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Stephane Eranian <eranian@gmail.com>
LPU-Reference: <4d5bdc64.98a1df0a.7aa3.06c2@mx.google.com>
Signed-off-by: Stephane Eranian <eranian@google.com>
[ committer note: Fixed a merge problem with 023695d "Add cgroup support" ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evsel.c | 1 +
tools/perf/util/evsel.h | 7 +++++++
tools/perf/util/parse-events.c | 10 ++++++++++
3 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index c974e08..63cadaf 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -86,6 +86,7 @@ void perf_evsel__delete(struct perf_evsel *evsel)
{
perf_evsel__exit(evsel);
close_cgroup(evsel->cgrp);
+ free(evsel->name);
free(evsel);
}
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 1d3d5a3..f6fc8f6 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -37,6 +37,12 @@ struct perf_sample_id {
struct perf_evsel *evsel;
};
+/** struct perf_evsel - event selector
+ *
+ * @name - Can be set to retain the original event name passed by the user,
+ * so that when showing results in tools such as 'perf stat', we
+ * show the name used, not some alias.
+ */
struct perf_evsel {
struct list_head node;
struct perf_event_attr attr;
@@ -45,6 +51,7 @@ struct perf_evsel {
struct xyarray *id;
struct perf_counts *counts;
int idx;
+ char *name;
void *priv;
struct cgroup_sel *cgrp;
};
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index cf082da..80a3dd5 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -268,6 +268,9 @@ const char *event_name(struct perf_evsel *evsel)
u64 config = evsel->attr.config;
int type = evsel->attr.type;
+ if (evsel->name)
+ return evsel->name;
+
return __event_name(type, config);
}
@@ -782,8 +785,10 @@ int parse_events(const struct option *opt, const char *str, int unset __used)
struct perf_evlist *evlist = *(struct perf_evlist **)opt->value;
struct perf_event_attr attr;
enum event_result ret;
+ const char *ostr;
for (;;) {
+ ostr = str;
memset(&attr, 0, sizeof(attr));
ret = parse_event_symbols(opt, &str, &attr);
if (ret == EVT_FAILED)
@@ -798,6 +803,11 @@ int parse_events(const struct option *opt, const char *str, int unset __used)
if (evsel == NULL)
return -1;
perf_evlist__add(evlist, evsel);
+
+ evsel->name = calloc(str - ostr + 1, 1);
+ if (!evsel->name)
+ return -1;
+ strncpy(evsel->name, ostr, str - ostr);
}
if (*str == 0)
--
1.6.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/5] perf hists: Print number of samples, not the period sum
2011-02-17 20:41 [GIT PULL 0/5] perf/core improvements and fixes Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 1/5] perf python: Add cgroup.c to setup.py to get it building again Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 2/5] perf: make perf stat print user provided full event names Arnaldo Carvalho de Melo
@ 2011-02-17 20:41 ` Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 4/5] perf record: Delay setting the header writing atexit call Arnaldo Carvalho de Melo
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-02-17 20:41 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Frederic Weisbecker,
Ingo Molnar, Mike Galbraith, Paul Mackerras, Peter Zijlstra,
Stephane Eranian, Tom Zanussi
From: Arnaldo Carvalho de Melo <acme@redhat.com>
So that we match the header where we state the number of events with the
"Samples" column when using 'perf report -n/--show-nr-samples':
[root@emilia ~]# perf record -a sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.111 MB perf.data (~4860 samples) ]
[root@emilia ~]# perf report --stdio --show-nr-samples
# Events: 11 cycles
#
# Overhead Samples Command Shared Object Symbol
# ........ .......... ........... .................. ............................
#
16.65% 1 sleep [kernel.kallsyms] [k] unmap_vmas
16.10% 1 perf libpthread-2.12.so [.] __pthread_cleanup_push_defer
15.79% 2 perf [kernel.kallsyms] [k] format_decode
12.88% 1 kworker/1:2 [kernel.kallsyms] [k] cache_reap
10.69% 1 swapper [kernel.kallsyms] [k] _raw_spin_lock
7.55% 1 sleep [kernel.kallsyms] [k] prepare_exec_creds
6.00% 1 perf [jbd2] [k] start_this_handle
5.29% 1 perf [kernel.kallsyms] [k] seq_read
4.75% 1 perf [kernel.kallsyms] [k] get_pid_task
4.30% 1 perf [kernel.kallsyms] [k] _raw_spin_unlock_irqrestore
#
# (For a higher level overview, try: perf report --sort comm,dso)
#
[root@emilia ~]#
Reported-by: Stephane Eranian <eranian@google.com>
Acked-by: Stephane Eranian <eranian@google.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/hist.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 3f43723..da2899e 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -591,6 +591,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size,
{
struct sort_entry *se;
u64 period, total, period_sys, period_us, period_guest_sys, period_guest_us;
+ u64 nr_events;
const char *sep = symbol_conf.field_sep;
int ret;
@@ -599,6 +600,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size,
if (pair_hists) {
period = self->pair ? self->pair->period : 0;
+ nr_events = self->pair ? self->pair->nr_events : 0;
total = pair_hists->stats.total_period;
period_sys = self->pair ? self->pair->period_sys : 0;
period_us = self->pair ? self->pair->period_us : 0;
@@ -606,6 +608,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size,
period_guest_us = self->pair ? self->pair->period_guest_us : 0;
} else {
period = self->period;
+ nr_events = self->nr_events;
total = session_total;
period_sys = self->period_sys;
period_us = self->period_us;
@@ -646,9 +649,9 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size,
if (symbol_conf.show_nr_samples) {
if (sep)
- ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period);
+ ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, nr_events);
else
- ret += snprintf(s + ret, size - ret, "%11" PRIu64, period);
+ ret += snprintf(s + ret, size - ret, "%11" PRIu64, nr_events);
}
if (pair_hists) {
--
1.6.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] perf record: Delay setting the header writing atexit call
2011-02-17 20:41 [GIT PULL 0/5] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2011-02-17 20:41 ` [PATCH 3/5] perf hists: Print number of samples, not the period sum Arnaldo Carvalho de Melo
@ 2011-02-17 20:41 ` Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 5/5] perf report: Tell the user when a perf.data file has no samples Arnaldo Carvalho de Melo
2011-02-18 7:26 ` [GIT PULL 0/5] perf/core improvements and fixes Ingo Molnar
5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-02-17 20:41 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Frederic Weisbecker,
Ingo Molnar, Mike Galbraith, Paul Mackerras, Peter Zijlstra,
Stephane Eranian, Tom Zanussi
From: Arnaldo Carvalho de Melo <acme@redhat.com>
While testing the --filter option I noticed that we were writing lots of
unneeded stuff to the perf.data header when the filter ioctl fails, so
move the atexit(atexit_header) call to after we create the counters
successfully.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-record.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index a4aaadc..db4cd1e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -538,11 +538,6 @@ static int __cmd_record(int argc, const char **argv)
if (have_tracepoints(&evsel_list->entries))
perf_header__set_feat(&session->header, HEADER_TRACE_INFO);
- /*
- * perf_session__delete(session) will be called at atexit_header()
- */
- atexit(atexit_header);
-
if (forks) {
child_pid = fork();
if (child_pid < 0) {
@@ -601,6 +596,11 @@ static int __cmd_record(int argc, const char **argv)
perf_session__set_sample_type(session, sample_type);
+ /*
+ * perf_session__delete(session) will be called at atexit_header()
+ */
+ atexit(atexit_header);
+
if (pipe_output) {
err = perf_header__write_pipe(output);
if (err < 0)
--
1.6.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] perf report: Tell the user when a perf.data file has no samples
2011-02-17 20:41 [GIT PULL 0/5] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2011-02-17 20:41 ` [PATCH 4/5] perf record: Delay setting the header writing atexit call Arnaldo Carvalho de Melo
@ 2011-02-17 20:41 ` Arnaldo Carvalho de Melo
2011-02-18 7:26 ` [GIT PULL 0/5] perf/core improvements and fixes Ingo Molnar
5 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-02-17 20:41 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Frederic Weisbecker,
Ingo Molnar, Mike Galbraith, Paul Mackerras, Peter Zijlstra,
Stephane Eranian, Steven Rostedt, Tom Zanussi
From: Arnaldo Carvalho de Melo <acme@redhat.com>
[root@emilia ~]# perf report --stdio
The perf.data file has no samples!
[root@emilia ~]#
The TUI shows a popup warning message with the same message.
Reported-by: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-report.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f9a99a1..dddcc7e 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -350,6 +350,12 @@ static int __cmd_report(void)
perf_session__fprintf_dsos(session, stdout);
next = rb_first(&session->hists_tree);
+
+ if (next == NULL) {
+ ui__warning("The %s file has no samples!\n", input_name);
+ goto out_delete;
+ }
+
while (next) {
struct hists *hists;
--
1.6.2.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [GIT PULL 0/5] perf/core improvements and fixes
2011-02-17 20:41 [GIT PULL 0/5] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (4 preceding siblings ...)
2011-02-17 20:41 ` [PATCH 5/5] perf report: Tell the user when a perf.data file has no samples Arnaldo Carvalho de Melo
@ 2011-02-18 7:26 ` Ingo Molnar
5 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2011-02-18 7:26 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Arun Sharma, David S . Miller, Frederic Weisbecker,
Mike Galbraith, Paul Mackerras, Peter Zijlstra, Robert Richter,
Stephane Eranian, Steven Rostedt, Tom Zanussi,
Arnaldo Carvalho de Melo
* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:
> Hi Ingo,
>
> Please consider pulling from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 perf/core
>
> Regards,
>
> - Arnaldo
>
> Arnaldo Carvalho de Melo (4):
> perf python: Add cgroup.c to setup.py to get it building again
> perf hists: Print number of samples, not the period sum
> perf record: Delay setting the header writing atexit call
> perf report: Tell the user when a perf.data file has no samples
>
> Stephane Eranian (1):
> perf: make perf stat print user provided full event names
>
> tools/perf/builtin-record.c | 10 +++++-----
> tools/perf/builtin-report.c | 6 ++++++
> tools/perf/util/evsel.c | 1 +
> tools/perf/util/evsel.h | 7 +++++++
> tools/perf/util/hist.c | 7 +++++--
> tools/perf/util/parse-events.c | 10 ++++++++++
> tools/perf/util/setup.py | 2 +-
> 7 files changed, 35 insertions(+), 8 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-02-18 7:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-17 20:41 [GIT PULL 0/5] perf/core improvements and fixes Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 1/5] perf python: Add cgroup.c to setup.py to get it building again Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 2/5] perf: make perf stat print user provided full event names Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 3/5] perf hists: Print number of samples, not the period sum Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 4/5] perf record: Delay setting the header writing atexit call Arnaldo Carvalho de Melo
2011-02-17 20:41 ` [PATCH 5/5] perf report: Tell the user when a perf.data file has no samples Arnaldo Carvalho de Melo
2011-02-18 7:26 ` [GIT PULL 0/5] perf/core improvements and fixes 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).