diff options
author | Paul Mackerras <paulus@samba.org> | 2009-01-09 16:43:42 +1100 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2009-01-09 16:43:42 +1100 |
commit | 3cbed429a9ccdb7a243f733b1056fe5c39e9004c (patch) | |
tree | 1b41a966a1f2598257b8d51299d180bce33b835e /include/linux/perf_counter.h | |
parent | 9abf8a08bc8f18a3b125f834f00e2e71b49c15d2 (diff) | |
download | linux-stable-3cbed429a9ccdb7a243f733b1056fe5c39e9004c.tar.gz linux-stable-3cbed429a9ccdb7a243f733b1056fe5c39e9004c.tar.bz2 linux-stable-3cbed429a9ccdb7a243f733b1056fe5c39e9004c.zip |
perf_counter: Add optional hw_perf_group_sched_in arch function
Impact: extend perf_counter infrastructure
This adds an optional hw_perf_group_sched_in() arch function that enables
a whole group of counters in one go. It returns 1 if it added the group
successfully, 0 if it did nothing (and therefore the core needs to add
the counters individually), or a negative number if an error occurred.
It should add all the counters and enable any software counters in the
group, or else add none of them and return an error.
There are a couple of related changes/improvements in the group handling
here:
* As an optimization, group_sched_out() and group_sched_in() now check the
state of the group leader, and do nothing if the leader is not active
or disabled.
* We now call hw_perf_save_disable/hw_perf_restore around the complete
set of counter enable/disable calls in __perf_counter_sched_in/out,
to give the arch code the opportunity to defer updating the hardware
state until the hw_perf_restore call if it wants.
* We no longer stop adding groups after we get to a group that has more
than one counter. We will ultimately add an option for a group to be
exclusive. The current code doesn't really implement exclusive groups
anyway, since a group could end up going on with other counters that
get added before it.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/linux/perf_counter.h')
-rw-r--r-- | include/linux/perf_counter.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index cc3a75a239a9..b21d1ea4c054 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h @@ -236,6 +236,9 @@ extern u64 hw_perf_save_disable(void); extern void hw_perf_restore(u64 ctrl); extern int perf_counter_task_disable(void); extern int perf_counter_task_enable(void); +extern int hw_perf_group_sched_in(struct perf_counter *group_leader, + struct perf_cpu_context *cpuctx, + struct perf_counter_context *ctx, int cpu); #else static inline void |