1. 14 Dec, 2008 6 commits
    • Ingo Molnar's avatar
      perfcounters: add task migrations counter · 6c594c21
      Ingo Molnar authored
      Impact: add new feature, new sw counter
      
      Add a counter that counts the number of cross-CPU migrations a
      task is suffering.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6c594c21
    • Ingo Molnar's avatar
      perfcounters: add context switch counter · 5d6a27d8
      Ingo Molnar authored
      Impact: add new feature, new sw counter
      
      Add a counter that counts the number of context-switches a task
      is doing.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5d6a27d8
    • Ingo Molnar's avatar
      perfcounters: fix task clock counter · 8cb391e8
      Ingo Molnar authored
      Impact: bugfix
      
      Update the task clock counter to the new math.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8cb391e8
    • Ingo Molnar's avatar
      perfcounters: implement "counter inheritance" · 9b51f66d
      Ingo Molnar authored
      Impact: implement new performance feature
      
      Counter inheritance can be used to run performance counters in a workload,
      transparently - and pipe back the counter results to the parent counter.
      
      Inheritance for performance counters works the following way: when creating
      a counter it can be marked with the .inherit=1 flag. Such counters are then
      'inherited' by all child tasks (be they fork()-ed or clone()-ed). These
      counters get inherited through exec() boundaries as well (except through
      setuid boundaries).
      
      The counter values get added back to the parent counter(s) when the child
      task(s) exit - much like stime/utime statistics are gathered. So inherited
      counters are ideal to gather summary statistics about an application's
      behavior via shell commands, without having to modify that application.
      
      The timec.c command utilizes counter inheritance:
      
        http://redhat.com/~mingo/perfcounters/timec.c
      
      Sample output:
      
         $ ./timec -e 1 -e 3 -e 5 ls -lR /usr/include/ >/dev/null
      
         Performance counter stats for 'ls':
      
                 163516953 instructions
                      2295 cache-misses
                   2855182 branch-misses
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      9b51f66d
    • Ingo Molnar's avatar
      perfcounters: restructure x86 counter math · ee06094f
      Ingo Molnar authored
      Impact: restructure code
      
      Change counter math from absolute values to clear delta logic.
      
      We try to extract elapsed deltas from the raw hw counter - and put
      that into the generic counter.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ee06094f
    • Ingo Molnar's avatar
      x86: implement atomic64_t on 32-bit · 9b194e83
      Ingo Molnar authored
      Impact: new API
      
      Implement the atomic64_t APIs on 32-bit as well. Will be used by
      the performance counters code.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      9b194e83
  2. 12 Dec, 2008 3 commits
  3. 11 Dec, 2008 13 commits
    • Ingo Molnar's avatar
      perf counters: update docs · 447557ac
      Ingo Molnar authored
      Impact: update docs
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      447557ac
    • Ingo Molnar's avatar
      perf counters: clean up state transitions · 6a930700
      Ingo Molnar authored
      Impact: cleanup
      
      Introduce a proper enum for the 3 states of a counter:
      
      	PERF_COUNTER_STATE_OFF		= -1
      	PERF_COUNTER_STATE_INACTIVE	=  0
      	PERF_COUNTER_STATE_ACTIVE	=  1
      
      and rename counter->active to counter->state and propagate the
      changes everywhere.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6a930700
    • Ingo Molnar's avatar
      perf counters: add prctl interface to disable/enable counters · 1d1c7ddb
      Ingo Molnar authored
      Add a way for self-monitoring tasks to disable/enable counters summarily,
      via a prctl:
      
      	PR_TASK_PERF_COUNTERS_DISABLE		31
      	PR_TASK_PERF_COUNTERS_ENABLE		32
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      1d1c7ddb
    • Ingo Molnar's avatar
      perf counters: implement PERF_COUNT_TASK_CLOCK · bae43c99
      Ingo Molnar authored
      Impact: add new perf-counter type
      
      The 'task clock' counter counts the amount of time a task is executing,
      in nanoseconds. It stops ticking when a task is scheduled out either due
      to it blocking, sleeping or it being preempted.
      
      This counter type is a Linux kernel based abstraction, it is available
      even if the hardware does not support native hardware performance counters.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      bae43c99
    • Ingo Molnar's avatar
      perf counters: consolidate hw_perf save/restore APIs · 01b2838c
      Ingo Molnar authored
      Impact: cleanup
      
      Rename them to better match up the usual IRQ disable/enable APIs:
      
       hw_perf_disable_all()  => hw_perf_save_disable()
       hw_perf_restore_ctrl() => hw_perf_restore()
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      01b2838c
    • Ingo Molnar's avatar
      perf counters: implement PERF_COUNT_CPU_CLOCK · 5c92d124
      Ingo Molnar authored
      Impact: add new perf-counter type
      
      The 'CPU clock' counter counts the amount of CPU clock time that is
      elapsing, in nanoseconds. (regardless of how much of it the task is
      spending on a CPU executing)
      
      This counter type is a Linux kernel based abstraction, it is available
      even if the hardware does not support native hardware performance counters.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5c92d124
    • Ingo Molnar's avatar
      perf counters: hw driver API · 621a01ea
      Ingo Molnar authored
      Impact: restructure code, introduce hw_ops driver abstraction
      
      Introduce this abstraction to handle counter details:
      
       struct hw_perf_counter_ops {
      	void (*hw_perf_counter_enable)	(struct perf_counter *counter);
      	void (*hw_perf_counter_disable)	(struct perf_counter *counter);
      	void (*hw_perf_counter_read)	(struct perf_counter *counter);
       };
      
      This will be useful to support assymetric hw details, and it will also
      be useful to implement "software counters". (Counters that count kernel
      managed sw events such as pagefaults, context-switches, wall-clock time
      or task-local time.)
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      621a01ea
    • Ingo Molnar's avatar
      perf counters: group counter, fixes · ccff286d
      Ingo Molnar authored
      Impact: bugfix
      
      Check that a group does not span outside the context of a CPU or a task.
      
      Also, do not allow deep recursive hierarchies.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ccff286d
    • Ingo Molnar's avatar
      perf counters: add support for group counters · 04289bb9
      Ingo Molnar authored
      Impact: add group counters
      
      This patch adds the "counter groups" abstraction.
      
      Groups of counters behave much like normal 'single' counters, with a
      few semantic and behavioral extensions on top of that.
      
      A counter group is created by creating a new counter with the open()
      syscall's group-leader group_fd file descriptor parameter pointing
      to another, already existing counter.
      
      Groups of counters are scheduled in and out in one atomic group, and
      they are also roundrobin-scheduled atomically.
      
      Counters that are member of a group can also record events with an
      (atomic) extended timestamp that extends to all members of the group,
      if the record type is set to PERF_RECORD_GROUP.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      04289bb9
    • Ingo Molnar's avatar
      perf counters: restructure the API · 9f66a381
      Ingo Molnar authored
      Impact: clean up new API
      
      Thorough cleanup of the new perf counters API, we now get clean separation
      of the various concepts:
      
       - introduce perf_counter_hw_event to separate out the event source details
      
       - move special type flags into separate attributes: PERF_COUNT_NMI,
         PERF_COUNT_RAW
      
       - extend the type to u64 and reserve it fully to the architecture in the
         raw type case.
      
      And make use of all these changes in the core and x86 perfcounters code.
      
      Also change the syscall signature to:
      
        asmlinkage int sys_perf_counter_open(
      
      	struct perf_counter_hw_event	*hw_event_uptr		__user,
      	pid_t				pid,
      	int				cpu,
      	int				group_fd);
      
      ( Note that group_fd is unused for now - it's reserved for the counter
        groups abstraction. )
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      9f66a381
    • Thomas Gleixner's avatar
      perf counters: expand use of counter->event · dfa7c899
      Thomas Gleixner authored
      Impact: change syscall, cleanup
      
      Make use of the new perf_counters event type.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      dfa7c899
    • Thomas Gleixner's avatar
      perf counters: clean up 'raw' type API · eab656ae
      Thomas Gleixner authored
      Impact: cleanup
      
      Introduce a separate hw_event type.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      eab656ae
    • Thomas Gleixner's avatar
      perf counters: protect them against CSTATE transitions · 4ac13294
      Thomas Gleixner authored
      Impact: fix rare lost events problem
      
      There are CPUs whose performance counters misbehave on CSTATE transitions,
      so provide a way to just disable/enable them around deep idle methods.
      
      (hw_perf_enable_all() is cheap on x86.)
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4ac13294
  4. 10 Dec, 2008 18 commits