Re: [RFC PATCH 2/2] tools/perf: Make group_fd static and move itsplace in __perf_evsel__open()
From: Arnaldo Carvalho de Melo
Date: Mon Oct 24 2011 - 10:03:33 EST
Em Mon, Oct 24, 2011 at 06:57:00PM +0800, Deng-Cheng Zhu escreveu:
> __perf_evsel__open() is called per event, it does not work for all the
> grouped events at one time. So, currently group_fd will alway be -1 for
> the events in a group. This patch fixes it.
>
> Signed-off-by: Deng-Cheng Zhu <dczhu@xxxxxxxx>
> Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> Cc: Paul Mackerras <paulus@xxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxx>
> Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxxxxxxx>
> ---
> tools/perf/util/evsel.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index e389815..7bd0d9d 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -219,9 +219,8 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
> }
>
> for (cpu = 0; cpu < cpus->nr; cpu++) {
> - int group_fd = -1;
> -
> for (thread = 0; thread < threads->nr; thread++) {
> + static int group_fd = -1;
>
> if (!evsel->cgrp)
> pid = threads->map[thread];
Lets not do it that way, using statics for this is humm, ugly, IMHO.
Just pass an integer pointer that is a member of perf_evlist, I'll work
on a patch now.
Thanks for reporting the bug tho!
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/