x86, perf_counter, bts: Add BTS support to perfcounters
authorMarkus Metzger <markus.t.metzger@intel.com>
Tue, 21 Jul 2009 13:56:48 +0000 (15:56 +0200)
committerIngo Molnar <mingo@elte.hu>
Sun, 9 Aug 2009 11:04:14 +0000 (13:04 +0200)
commit30dd568c912602b7dbd609a45d053e01b13422bb
tree96e970d91b3ef06301ca0f03bc4b1a0068b06122
parent183f3b0887083d36c8a25cd5e3518906415d1889
x86, perf_counter, bts: Add BTS support to perfcounters

Implement a performance counter with:

    attr.type           = PERF_TYPE_HARDWARE
    attr.config         = PERF_COUNT_HW_BRANCH_INSTRUCTIONS
    attr.sample_period  = 1

Using branch trace store (BTS) on x86 hardware, if available.

The from and to address for each branch can be sampled using:

    PERF_SAMPLE_IP      for the from address
    PERF_SAMPLE_ADDR    for the to address

[ v2: address review feedback, fix bugs ]

Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/include/asm/perf_counter.h
arch/x86/kernel/cpu/perf_counter.c
include/linux/perf_counter.h
kernel/perf_counter.c