From: Stephane Eranian <eranian@google.com>
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mingo@elte.hu, acme@infradead.org,
robert.richter@amd.com, ming.m.lin@intel.com,
andi@firstfloor.org, asharma@fb.com
Subject: [PATCH 0/4] perf_events: add support for Intel reference cycles event
Date: Sun, 11 Dec 2011 00:28:50 +0100 [thread overview]
Message-ID: <1323559734-3488-1-git-send-email-eranian@google.com> (raw)
The unhalted_reference_cycles is a very useful event which counts cycles at the
reference CPU clock speed (same as TSC if processors supports constant_tsc).
That means, it keeps a constant correlation with wall-clock time while the
processor is not halted, unlike its counter-part unhalted_core_cycles.
The latter event, used by generic PMU event cycles in the perf tool is
subject to frequency down-scaling AND Turbo mode fluctuations.
The unhlated_reference_cycles is NOT equivalent to wall clock time because
it counts only when the processor is not in halted state. But this limitation
impacts only system-wide measurements.
The unhalted_reference_cycles can only be counted on fixed counter 2.
As such, it does not have an event encoding. Fixed counters can only measure
one (hardwired) event. Yet, with perf_events user manipulates events and not
counters, thus each event needs an encoding. That encoding is then used by
the kernel to identify the event and schedule it on the proper counter.
Up until now, there was no encoding chosen for unhalted_reference_cycles, thus
it could not be scheduled properly and thus it was not supported.
This patch uses the encoding 0x0300. That means event code 0x00, umask 0x3.
That event code is not used by Intel on any existing processor. We have
also checked with Intel and it seems that they don't plan on using it in
the future.
With this patch, it is possible to see the effect of Turbo mode:
$ perf stat -e unhalted_reference_cycles,unhalted_core_cycles ./noploop 1
noploop for 1 seconds
Performance counter stats for './noploop 1':
3,197,640,960 unhalted_reference_cycles
3,595,043,997 unhalted_core_cycles
1.000732233 seconds time elapsed
Signed-off-by: Stephane Eranian <eranian@google.com>
---
Stephane Eranian (4):
perf_events: enable raw event support for Intel
unhalted_reference_cycles event
perf_event: add PERF_COUNT_HW_REF_CPU_CYCLES generic PMU event
perf_events: add Intel X86 mapping for PERF_COUNT_HW_REF_CPU_CYCLES
perf: add support for PERF_HW_COUNT_REF_CPU_CYCLES
arch/x86/include/asm/perf_event.h | 15 ++++++++-------
arch/x86/kernel/cpu/perf_event.c | 8 +++++++-
arch/x86/kernel/cpu/perf_event_intel.c | 16 ++++++----------
include/linux/perf_event.h | 1 +
tools/perf/util/parse-events.c | 2 ++
5 files changed, 24 insertions(+), 18 deletions(-)
next reply other threads:[~2011-12-10 23:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-10 23:28 Stephane Eranian [this message]
2011-12-10 23:28 ` [PATCH 1/4] perf_events: enable raw event support for Intel unhalted_reference_cycles event Stephane Eranian
2011-12-21 10:22 ` [tip:perf/core] perf events: Enable " tip-bot for Stephane Eranian
2011-12-10 23:28 ` [PATCH 2/4] perf_event: add PERF_COUNT_HW_REF_CPU_CYCLES generic PMU event Stephane Eranian
2011-12-11 8:01 ` Ingo Molnar
2011-12-11 12:55 ` Peter Zijlstra
2011-12-11 15:47 ` Ingo Molnar
2011-12-12 3:45 ` Stephane Eranian
2011-12-12 12:57 ` Peter Zijlstra
2011-12-12 17:32 ` Ingo Molnar
2011-12-13 6:45 ` Stephane Eranian
2011-12-13 10:02 ` Peter Zijlstra
2011-12-14 17:42 ` Stephane Eranian
2011-12-21 10:23 ` [tip:perf/core] perf events: Add " tip-bot for Stephane Eranian
2011-12-10 23:28 ` [PATCH 3/4] perf_events: add Intel X86 mapping for PERF_COUNT_HW_REF_CPU_CYCLES Stephane Eranian
2011-12-21 10:24 ` [tip:perf/core] perf events: Add Intel x86 " tip-bot for Stephane Eranian
2011-12-10 23:28 ` [PATCH 4/4] perf: add support for PERF_HW_COUNT_REF_CPU_CYCLES Stephane Eranian
2011-12-21 10:25 ` [tip:perf/core] perf: Add " tip-bot for Stephane Eranian
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=1323559734-3488-1-git-send-email-eranian@google.com \
--to=eranian@google.com \
--cc=acme@infradead.org \
--cc=andi@firstfloor.org \
--cc=asharma@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.m.lin@intel.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=robert.richter@amd.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
all inboxes | Powered by JetHome®