perf: Add 'perf sched' tool
[safe/jmp/linux-2.6] / tools / perf / design.txt
index d325076..f71e0d2 100644 (file)
@@ -99,13 +99,13 @@ enum hw_event_ids {
        /*
         * Common hardware events, generalized by the kernel:
         */
-       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_COUNT_HW_CPU_CYCLES                = 0,
+       PERF_COUNT_HW_INSTRUCTIONS              = 1,
+       PERF_COUNT_HW_CACHE_REFERENCES  = 2,
+       PERF_COUNT_HW_CACHE_MISSES              = 3,
+       PERF_COUNT_HW_BRANCH_INSTRUCTIONS       = 4,
+       PERF_COUNT_HW_BRANCH_MISSES     = 5,
+       PERF_COUNT_HW_BUS_CYCLES                = 6,
 };
 
 These are standardized types of events that work relatively uniformly
@@ -130,13 +130,13 @@ software events, selected by 'event_id':
  * well):
  */
 enum sw_event_ids {
-       PERF_COUNT_CPU_CLOCK            = 0,
-       PERF_COUNT_TASK_CLOCK           = 1,
-       PERF_COUNT_PAGE_FAULTS          = 2,
-       PERF_COUNT_CONTEXT_SWITCHES     = 3,
-       PERF_COUNT_CPU_MIGRATIONS       = 4,
-       PERF_COUNT_PAGE_FAULTS_MIN      = 5,
-       PERF_COUNT_PAGE_FAULTS_MAJ      = 6,
+       PERF_COUNT_SW_CPU_CLOCK         = 0,
+       PERF_COUNT_SW_TASK_CLOCK                = 1,
+       PERF_COUNT_SW_PAGE_FAULTS               = 2,
+       PERF_COUNT_SW_CONTEXT_SWITCHES  = 3,
+       PERF_COUNT_SW_CPU_MIGRATIONS    = 4,
+       PERF_COUNT_SW_PAGE_FAULTS_MIN   = 5,
+       PERF_COUNT_SW_PAGE_FAULTS_MAJ   = 6,
 };
 
 Counters of the type PERF_TYPE_TRACEPOINT are available when the ftrace event
@@ -440,3 +440,18 @@ by this process or by another, and doesn't affect any counters that
 this process has created on other processes.  It only enables or
 disables the group leaders, not any other members in the groups.
 
+
+Arch requirements
+-----------------
+
+If your architecture does not have hardware performance metrics, you can
+still use the generic software counters based on hrtimers for sampling.
+
+So to start with, in order to add HAVE_PERF_COUNTERS to your Kconfig, you
+will need at least this:
+       - asm/perf_counter.h - a basic stub will suffice at first
+       - support for atomic64 types (and associated helper functions)
+       - set_perf_counter_pending() implemented
+
+If your architecture does have hardware capabilities, you can override the
+weak stub hw_perf_counter_init() to register hardware counters.