From 5090c6aea84dcc474d0aabf9f66f1eab68a143eb Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Fri, 16 Mar 2012 17:42:20 +0900 Subject: perf tools: Do not disable members of group event When event group is enabled for forked task (i.e. no target task/cpu was specified) all events were disabled and marked ->enable_on_exec. However they wouldn't be counted at all since only group leader will be enabled on exec actually. In contrast to perf stat, perf record doesn't have a real problem as it enables all the event before proceeding. But it needs to be fixed anyway IMHO. Cc: Ingo Molnar Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1331887340-32448-2-git-send-email-namhyung.kim@lge.com Signed-off-by: Namhyung Kim Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tools/perf/util/evsel.c') diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index f421f7cbc0d..0221700075c 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -63,7 +63,8 @@ struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr, int idx) return evsel; } -void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts) +void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts, + struct perf_evsel *first) { struct perf_event_attr *attr = &evsel->attr; int track = !evsel->idx; /* only the first counter needs these */ @@ -134,7 +135,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts) attr->mmap = track; attr->comm = track; - if (!opts->target_pid && !opts->target_tid && !opts->system_wide) { + if (!opts->target_pid && !opts->target_tid && !opts->system_wide && + (!opts->group || evsel == first)) { attr->disabled = 1; attr->enable_on_exec = 1; } -- cgit v1.2.3 From 4bf9ce1b5ecffffeb8b9d7e925bac3e6b10109aa Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Thu, 22 Mar 2012 14:37:26 +0100 Subject: perf diff: Fix to work with new hists design The perf diff command is broken since: perf hists: Threaded addition and sorting of entries commit 1980c2ebd7020d82c024b8c4046849b38e78e7da Several places were broken: - hists data need to be collected into opened sessions instead of into events - session's hists data need to be initialized properly when the session is created - hist_entry__pcnt_snprintf: the percentage and displacement buffer preparation must not use 'ret' because it's used as a pointer to the final buffer Signed-off-by: Jiri Olsa Cc: Corey Ashford Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20120322133726.GB1601@m.brq.redhat.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/perf/util/evsel.c') diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 0221700075c..d9da62a7234 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -34,7 +34,7 @@ int __perf_evsel__sample_size(u64 sample_type) return size; } -static void hists__init(struct hists *hists) +void hists__init(struct hists *hists) { memset(hists, 0, sizeof(*hists)); hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT; -- cgit v1.2.3 From fa30c964c0ac31a705a4f86072267a42343c4158 Mon Sep 17 00:00:00 2001 From: Stephane Eranian Date: Sat, 17 Mar 2012 23:23:18 +0100 Subject: perf tools: Fix bug in raw sample parsing In perf_event__parse_sample(), the array variable was not incremented by the amount of data used by the raw_data. That was okay until we added PERF_SAMPLE_BRANCH_STACK which depends on the array variable pointing to the beginning of the branch stack data. But that was not the case if branch stack was combined with raw mode sampling. That led to bogus branch stack addresses and count. The bug would show up with: $ perf record -R -b foo This patch fixes the problem by correctly moving the array pointer forward for RAW samples. Signed-off-by: Stephane Eranian Cc: David Ahern Cc: Ingo Molnar Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20120317222317.GA8803@quad [ committer note: Fix also later submitted by Jiri Olsa ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/perf/util/evsel.c') diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index d9da62a7234..8c13dbcb84b 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -580,6 +580,8 @@ int perf_event__parse_sample(const union perf_event *event, u64 type, return -EFAULT; data->raw_data = (void *) pdata; + + array = (void *)array + data->raw_size + sizeof(u32); } if (type & PERF_SAMPLE_BRANCH_STACK) { -- cgit v1.2.3