All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	mingo@elte.hu, ak@linux.intel.com, acme@redhat.com,
	namhyung.kim@lge.com
Subject: Re: [PATCH v2 1/2] perf tools: add evsel prev_raw_count field
Date: Fri, 18 Jan 2013 14:49:07 +0100	[thread overview]
Message-ID: <20130118134907.GA1579@krava> (raw)
In-Reply-To: <1358514388-4344-2-git-send-email-eranian@google.com>

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@google.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

  reply	other threads:[~2013-01-18 13:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-18 13:06 [PATCH v2 0/2] perf stat: add interval counter printing Stephane Eranian
2013-01-18 13:06 ` [PATCH v2 1/2] perf tools: add evsel prev_raw_count field Stephane Eranian
2013-01-18 13:49   ` Jiri Olsa [this message]
2013-01-18 13:06 ` [PATCH v2 2/2] perf stat: add interval printing Stephane Eranian
2013-01-18 13:50   ` Jiri Olsa
2013-01-18 13:59     ` Stephane Eranian
2013-01-18 14:05       ` Jiri Olsa
2013-01-18 14:09       ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130118134907.GA1579@krava \
    --to=jolsa@redhat.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung.kim@lge.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.