public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] perf_events: add support for Intel reference cycles event
@ 2011-12-10 23:28 Stephane Eranian
  2011-12-10 23:28 ` [PATCH 1/4] perf_events: enable raw event support for Intel unhalted_reference_cycles event Stephane Eranian
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Stephane Eranian @ 2011-12-10 23:28 UTC (permalink / raw)
  To: linux-kernel
  Cc: peterz, mingo, acme, robert.richter, ming.m.lin, andi, asharma

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(-)


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-12-21 10:25 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-10 23:28 [PATCH 0/4] perf_events: add support for Intel reference cycles event Stephane Eranian
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox