From: Peter Zijlstra <peterz@infradead.org>
To: Matt Fleming <matt@console-pimps.org>
Cc: Zhang Rui <rui.zhang@intel.com>,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Frederic Weisbecker <fweisbec@gmail.com>,
Robert Richter <robert.richter@amd.com>,
Lin Ming <ming.m.lin@intel.com>,
Paul Mackerras <paulus@samba.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Don Zickus <dzickus@redhat.com>,
Cyrill Gorcunov <gorcunov@gmail.com>, Len Brown <lenb@kernel.org>,
Matthew Garrett <mjg59@srcf.ucam.org>
Subject: Re: [RFC][PATCH 2/5] perf: Turn the group counter values into delta values
Date: Mon, 30 Aug 2010 14:54:01 +0200 [thread overview]
Message-ID: <1283172841.1820.895.camel@laptop> (raw)
In-Reply-To: <1fe2a061e566c83668312ad64800768046f3ac07.1283123521.git.matt@console-pimps.org>
On Mon, 2010-08-30 at 13:13 +0100, Matt Fleming wrote:
> Change the semantics of the PERF_FORMAT_GROUP records and make them
> delta values, i.e. the difference in value between consecutive reads of
> the hardware counters. These delta values will be used in a subsequent
> patch to calculate weighted values (by multiplying the deltas with the
> time difference between reads of the counters). Calculating these deltas
> is easiest to do in the kernel (as opposed to the userland tools)
> because we can reset the counter whenever we read from it.
>
> Note that even though this patch changes the semantics of
> PERF_FORMAT_GROUP records there were no users of them anyway (the tools
> didn't even understand them).
libpfmon might be using it,.. I know some people occasionally reported
bugs for this so there are users.
Also, there's no real synchonization between read,read and read,sample
so its racy to do this, simply generate deltas in post-processing.
> Signed-off-by: Matt Fleming <matt@console-pimps.org>
> ---
> kernel/perf_event.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> index 16b0476..2cda375 100644
> --- a/kernel/perf_event.c
> +++ b/kernel/perf_event.c
> @@ -3450,7 +3450,14 @@ static void perf_output_read_group(struct perf_output_handle *handle,
> if (leader != event)
> leader->pmu->read(leader);
>
> + /*
> + * Reset the counter value so that ->count contains a delta from
> + * the previous value.
> + */
> values[n++] = perf_event_count(leader);
> + local64_set(&leader->count, 0);
> + atomic64_set(&leader->child_count, 0);
> +
> if (read_format & PERF_FORMAT_ID)
> values[n++] = primary_event_id(leader);
>
> @@ -3463,6 +3470,9 @@ static void perf_output_read_group(struct perf_output_handle *handle,
> sub->pmu->read(sub);
>
> values[n++] = perf_event_count(sub);
> + local64_set(&sub->count, 0);
> + atomic64_set(&sub->child_count, 0);
> +
> if (read_format & PERF_FORMAT_ID)
> values[n++] = primary_event_id(sub);
>
next prev parent reply other threads:[~2010-08-30 12:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-30 12:13 [RFC][PATCH 0/5] hrtimer group events Matt Fleming
2010-08-30 12:13 ` [RFC][PATCH 1/5] perf: Check if we should exclude idle thread in perf_exclude_event() Matt Fleming
2010-08-31 14:54 ` Frederic Weisbecker
2010-08-31 15:20 ` Matt Fleming
2010-08-31 15:21 ` Frederic Weisbecker
2010-08-30 12:13 ` [RFC][PATCH 2/5] perf: Turn the group counter values into delta values Matt Fleming
2010-08-30 12:54 ` Peter Zijlstra [this message]
2010-08-30 13:21 ` Matt Fleming
2010-08-30 12:13 ` [RFC][PATCH 3/5] perf: Add hrtimer code for PMI-less hardware counters Matt Fleming
2010-08-30 12:55 ` Peter Zijlstra
2010-08-30 13:27 ` Matt Fleming
2010-08-30 14:12 ` Peter Zijlstra
2010-08-30 19:35 ` Matt Fleming
2010-08-30 12:13 ` [RFC][PATCH 4/5] sh: Add support for sampling counters Matt Fleming
2010-08-30 12:13 ` [RFC][PATCH 5/5] perf: Add support for PERF_SAMPLE_READ samples Matt Fleming
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=1283172841.1820.895.camel@laptop \
--to=peterz@infradead.org \
--cc=acme@redhat.com \
--cc=dzickus@redhat.com \
--cc=fweisbec@gmail.com \
--cc=gorcunov@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@console-pimps.org \
--cc=ming.m.lin@intel.com \
--cc=mingo@elte.hu \
--cc=mjg59@srcf.ucam.org \
--cc=paulus@samba.org \
--cc=robert.richter@amd.com \
--cc=rui.zhang@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox