Re: [PATCH v4 05/18] perf: add minimal support for PERF_SAMPLE_WEIGHT

From: Jiri Olsa
Date: Wed Jan 02 2013 - 09:07:50 EST


On Thu, Dec 20, 2012 at 04:41:35PM +0100, Stephane Eranian wrote:
> Ensure we grab the weight from raw sample struct
> and that we can dump it via perf report -D.
>
> Signed-off-by: Stephane Eranian <eranian@xxxxxxxxxx>
> ---
> tools/perf/util/event.h | 1 +
> tools/perf/util/evsel.c | 5 +++++
> tools/perf/util/session.c | 3 +++
> 3 files changed, 9 insertions(+)
>
> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> index 0d573ff..cf52977 100644
> --- a/tools/perf/util/event.h
> +++ b/tools/perf/util/event.h
> @@ -90,6 +90,7 @@ struct perf_sample {
> u64 period;
> u32 cpu;
> u32 raw_size;
> + u64 weight;
> void *raw_data;
> struct ip_callchain *callchain;
> struct branch_stack *branch_stack;
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 1b16dd1..4374c07 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -1058,6 +1058,11 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
> }
> }
>
> + if (type & PERF_SAMPLE_WEIGHT) {
> + data->weight= *array;
> + array++;
> + }
> +

this bit should be placed right after PERF_SAMPLE_PERIOD (where
you placed it in kernel path), otherwise you get wrong data

jirka
--
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/