perf counters: add support for group counters

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: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Ingo Molnar
2008-12-11 08:38:42 +01:00
parent 9f66a3810f
commit 04289bb989
3 changed files with 236 additions and 82 deletions

View File

@ -117,7 +117,10 @@ struct perf_data {
* struct perf_counter - performance counter kernel representation:
*/
struct perf_counter {
struct list_head list;
struct list_head list_entry;
struct list_head sibling_list;
struct perf_counter *group_leader;
int active;
#if BITS_PER_LONG == 64
atomic64_t count;
@ -158,7 +161,8 @@ struct perf_counter_context {
* Protect the list of counters:
*/
spinlock_t lock;
struct list_head counters;
struct list_head counter_list;
int nr_counters;
int nr_active;
struct task_struct *task;