perfcounters: add PERF_COUNT_BUS_CYCLES
authorIngo Molnar <mingo@elte.hu>
Tue, 23 Dec 2008 11:17:29 +0000 (12:17 +0100)
committerIngo Molnar <mingo@elte.hu>
Tue, 23 Dec 2008 11:45:24 +0000 (12:45 +0100)
Generalize "bus cycles" hw events - and map them to CPU_CLK_Unhalted.Ref
on x86. (which is a good enough approximation)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/cpu/perf_counter.c
include/linux/perf_counter.h

index f3359c2b3910787640faf74fa022822da78d8446..86b2fdd344a62a765b07cf3d23a01d0a47c7177d 100644 (file)
@@ -41,12 +41,13 @@ static DEFINE_PER_CPU(struct cpu_hw_counters, cpu_hw_counters);
 
 static const int intel_perfmon_event_map[] =
 {
-  [PERF_COUNT_CYCLES]                  = 0x003c,
+  [PERF_COUNT_CPU_CYCLES]              = 0x003c,
   [PERF_COUNT_INSTRUCTIONS]            = 0x00c0,
   [PERF_COUNT_CACHE_REFERENCES]                = 0x4f2e,
   [PERF_COUNT_CACHE_MISSES]            = 0x412e,
   [PERF_COUNT_BRANCH_INSTRUCTIONS]     = 0x00c4,
   [PERF_COUNT_BRANCH_MISSES]           = 0x00c5,
+  [PERF_COUNT_BUS_CYCLES]              = 0x013c,
 };
 
 static const int max_intel_perfmon_events = ARRAY_SIZE(intel_perfmon_event_map);
index 1ea08e9f31ceb25503957916d925cc7cfaf9a43f..ec77d1643d370b0cc9e7cda28ba62b79a52be6bd 100644 (file)
@@ -36,14 +36,15 @@ enum hw_event_types {
        /*
         * Common hardware events, generalized by the kernel:
         */
-       PERF_COUNT_CYCLES               =  0,
+       PERF_COUNT_CPU_CYCLES           =  0,
        PERF_COUNT_INSTRUCTIONS         =  1,
        PERF_COUNT_CACHE_REFERENCES     =  2,
        PERF_COUNT_CACHE_MISSES         =  3,
        PERF_COUNT_BRANCH_INSTRUCTIONS  =  4,
        PERF_COUNT_BRANCH_MISSES        =  5,
+       PERF_COUNT_BUS_CYCLES           =  6,
 
-       PERF_HW_EVENTS_MAX              =  6,
+       PERF_HW_EVENTS_MAX              =  7,
 
        /*
         * Special "software" counters provided by the kernel, even if