diff options
Diffstat (limited to 'include/linux/perf_counter.h')
-rw-r--r-- | include/linux/perf_counter.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index 7fdbdf8be775..6bf67ce17625 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -103,6 +103,16 @@ enum perf_counter_record_type { | |||
103 | #define PERF_COUNTER_EVENT_MASK __PERF_COUNTER_MASK(EVENT) | 103 | #define PERF_COUNTER_EVENT_MASK __PERF_COUNTER_MASK(EVENT) |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * Bits that can be set in hw_event.read_format to request that | ||
107 | * reads on the counter should return the indicated quantities, | ||
108 | * in increasing order of bit value, after the counter value. | ||
109 | */ | ||
110 | enum perf_counter_read_format { | ||
111 | PERF_FORMAT_TOTAL_TIME_ENABLED = 1, | ||
112 | PERF_FORMAT_TOTAL_TIME_RUNNING = 2, | ||
113 | }; | ||
114 | |||
115 | /* | ||
106 | * Hardware event to monitor via a performance monitoring counter: | 116 | * Hardware event to monitor via a performance monitoring counter: |
107 | */ | 117 | */ |
108 | struct perf_counter_hw_event { | 118 | struct perf_counter_hw_event { |
@@ -281,6 +291,32 @@ struct perf_counter { | |||
281 | enum perf_counter_active_state prev_state; | 291 | enum perf_counter_active_state prev_state; |
282 | atomic64_t count; | 292 | atomic64_t count; |
283 | 293 | ||
294 | /* | ||
295 | * These are the total time in nanoseconds that the counter | ||
296 | * has been enabled (i.e. eligible to run, and the task has | ||
297 | * been scheduled in, if this is a per-task counter) | ||
298 | * and running (scheduled onto the CPU), respectively. | ||
299 | * | ||
300 | * They are computed from tstamp_enabled, tstamp_running and | ||
301 | * tstamp_stopped when the counter is in INACTIVE or ACTIVE state. | ||
302 | */ | ||
303 | u64 total_time_enabled; | ||
304 | u64 total_time_running; | ||
305 | |||
306 | /* | ||
307 | * These are timestamps used for computing total_time_enabled | ||
308 | * and total_time_running when the counter is in INACTIVE or | ||
309 | * ACTIVE state, measured in nanoseconds from an arbitrary point | ||
310 | * in time. | ||
311 | * tstamp_enabled: the notional time when the counter was enabled | ||
312 | * tstamp_running: the notional time when the counter was scheduled on | ||
313 | * tstamp_stopped: in INACTIVE state, the notional time when the | ||
314 | * counter was scheduled off. | ||
315 | */ | ||
316 | u64 tstamp_enabled; | ||
317 | u64 tstamp_running; | ||
318 | u64 tstamp_stopped; | ||
319 | |||
284 | struct perf_counter_hw_event hw_event; | 320 | struct perf_counter_hw_event hw_event; |
285 | struct hw_perf_counter hw; | 321 | struct hw_perf_counter hw; |
286 | 322 | ||
@@ -292,6 +328,13 @@ struct perf_counter { | |||
292 | struct list_head child_list; | 328 | struct list_head child_list; |
293 | 329 | ||
294 | /* | 330 | /* |
331 | * These accumulate total time (in nanoseconds) that children | ||
332 | * counters have been enabled and running, respectively. | ||
333 | */ | ||
334 | atomic64_t child_total_time_enabled; | ||
335 | atomic64_t child_total_time_running; | ||
336 | |||
337 | /* | ||
295 | * Protect attach/detach and child_list: | 338 | * Protect attach/detach and child_list: |
296 | */ | 339 | */ |
297 | struct mutex mutex; | 340 | struct mutex mutex; |
@@ -339,6 +382,16 @@ struct perf_counter_context { | |||
339 | int nr_active; | 382 | int nr_active; |
340 | int is_active; | 383 | int is_active; |
341 | struct task_struct *task; | 384 | struct task_struct *task; |
385 | |||
386 | /* | ||
387 | * time_now is the current time in nanoseconds since an arbitrary | ||
388 | * point in the past. For per-task counters, this is based on the | ||
389 | * task clock, and for per-cpu counters it is based on the cpu clock. | ||
390 | * time_lost is an offset from the task/cpu clock, used to make it | ||
391 | * appear that time only passes while the context is scheduled in. | ||
392 | */ | ||
393 | u64 time_now; | ||
394 | u64 time_lost; | ||
342 | #endif | 395 | #endif |
343 | }; | 396 | }; |
344 | 397 | ||