[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130118134907.GA1579@krava>
Date: Fri, 18 Jan 2013 14:49:07 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Stephane Eranian <eranian@...gle.com>
Cc: linux-kernel@...r.kernel.org, peterz@...radead.org, mingo@...e.hu,
ak@...ux.intel.com, acme@...hat.com, namhyung.kim@....com
Subject: Re: [PATCH v2 1/2] perf tools: add evsel prev_raw_count field
On Fri, Jan 18, 2013 at 02:06:27PM +0100, Stephane Eranian wrote:
> This field will be used by commands which print
> counter deltas on regular timer intervals,
> such as perf stat -I.
>
> Signed-off-by: Stephane Eranian <eranian@...gle.com>
> ---
> tools/perf/util/evsel.c | 21 +++++++++++++++++++++
> tools/perf/util/evsel.h | 1 +
> 2 files changed, 22 insertions(+)
>
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 1b16dd1..132da7c 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -646,6 +646,17 @@ int __perf_evsel__read_on_cpu(struct perf_evsel *evsel,
> if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) < 0)
> return -errno;
>
> + if (evsel->prev_raw_counts) {
> + struct perf_counts_values tmp;
> +
> + tmp = evsel->prev_raw_counts->cpu[cpu];
> + evsel->prev_raw_counts->cpu[cpu] = count;
> +
> + count.val = count.val - tmp.val;
> + count.ena = count.ena - tmp.ena;
> + count.run = count.run - tmp.run;
> + }
> +
> if (scale) {
> if (count.run == 0)
> count.val = 0;
> @@ -684,6 +695,16 @@ int __perf_evsel__read(struct perf_evsel *evsel,
> }
> }
>
> + if (evsel->prev_raw_counts) {
> + struct perf_counts_values tmp = evsel->prev_raw_counts->aggr;
> +
> + evsel->prev_raw_counts->aggr = *aggr;
> +
> + aggr->val = aggr->val - tmp.val;
> + aggr->ena = aggr->ena - tmp.ena;
> + aggr->run = aggr->run - tmp.run;
> + }
this and the hunk above looks like candidates for function
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists