aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/perf_counter.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/perf_counter.h')
-rw-r--r--include/linux/perf_counter.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 7ab8e5f96f5b..33ba9fe0a781 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -14,6 +14,7 @@
14#define _LINUX_PERF_COUNTER_H 14#define _LINUX_PERF_COUNTER_H
15 15
16#include <asm/atomic.h> 16#include <asm/atomic.h>
17#include <asm/ioctl.h>
17 18
18#ifdef CONFIG_PERF_COUNTERS 19#ifdef CONFIG_PERF_COUNTERS
19# include <asm/perf_counter.h> 20# include <asm/perf_counter.h>
@@ -95,6 +96,12 @@ struct perf_counter_hw_event {
95}; 96};
96 97
97/* 98/*
99 * Ioctls that can be done on a perf counter fd:
100 */
101#define PERF_COUNTER_IOC_ENABLE _IO('$', 0)
102#define PERF_COUNTER_IOC_DISABLE _IO('$', 1)
103
104/*
98 * Kernel-internal data types: 105 * Kernel-internal data types:
99 */ 106 */
100 107
@@ -173,8 +180,10 @@ struct perf_counter {
173 struct file *filp; 180 struct file *filp;
174 181
175 struct perf_counter *parent; 182 struct perf_counter *parent;
183 struct list_head child_list;
184
176 /* 185 /*
177 * Protect attach/detach: 186 * Protect attach/detach and child_list:
178 */ 187 */
179 struct mutex mutex; 188 struct mutex mutex;
180 189
@@ -199,13 +208,21 @@ struct perf_counter {
199struct perf_counter_context { 208struct perf_counter_context {
200#ifdef CONFIG_PERF_COUNTERS 209#ifdef CONFIG_PERF_COUNTERS
201 /* 210 /*
202 * Protect the list of counters: 211 * Protect the states of the counters in the list,
212 * nr_active, and the list:
203 */ 213 */
204 spinlock_t lock; 214 spinlock_t lock;
215 /*
216 * Protect the list of counters. Locking either mutex or lock
217 * is sufficient to ensure the list doesn't change; to change
218 * the list you need to lock both the mutex and the spinlock.
219 */
220 struct mutex mutex;
205 221
206 struct list_head counter_list; 222 struct list_head counter_list;
207 int nr_counters; 223 int nr_counters;
208 int nr_active; 224 int nr_active;
225 int is_active;
209 struct task_struct *task; 226 struct task_struct *task;
210#endif 227#endif
211}; 228};