aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/perf_counter.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-09-02 02:17:56 -0400
committerIngo Molnar <mingo@elte.hu>2009-09-02 02:17:56 -0400
commit936e894a976dd3b0f07f1f6f43c17b77b7e6146d (patch)
tree5ed5c1f6735dcd26550594df23c8f7fe2aa21a15 /include/linux/perf_counter.h
parent69575d388603365f2afbf4166df93152df59b165 (diff)
parent326ba5010a5429a5a528b268b36a5900d4ab0eba (diff)
Merge commit 'v2.6.31-rc8' into x86/txt
Conflicts: arch/x86/kernel/reboot.c security/Kconfig Merge reason: resolve the conflicts, bump up from rc3 to rc8. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/perf_counter.h')
-rw-r--r--include/linux/perf_counter.h74
1 files changed, 57 insertions, 17 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 5e970c7d3fd5..b53f7006cc4e 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -115,26 +115,44 @@ enum perf_counter_sample_format {
115 PERF_SAMPLE_TID = 1U << 1, 115 PERF_SAMPLE_TID = 1U << 1,
116 PERF_SAMPLE_TIME = 1U << 2, 116 PERF_SAMPLE_TIME = 1U << 2,
117 PERF_SAMPLE_ADDR = 1U << 3, 117 PERF_SAMPLE_ADDR = 1U << 3,
118 PERF_SAMPLE_GROUP = 1U << 4, 118 PERF_SAMPLE_READ = 1U << 4,
119 PERF_SAMPLE_CALLCHAIN = 1U << 5, 119 PERF_SAMPLE_CALLCHAIN = 1U << 5,
120 PERF_SAMPLE_ID = 1U << 6, 120 PERF_SAMPLE_ID = 1U << 6,
121 PERF_SAMPLE_CPU = 1U << 7, 121 PERF_SAMPLE_CPU = 1U << 7,
122 PERF_SAMPLE_PERIOD = 1U << 8, 122 PERF_SAMPLE_PERIOD = 1U << 8,
123 PERF_SAMPLE_STREAM_ID = 1U << 9,
124 PERF_SAMPLE_RAW = 1U << 10,
123 125
124 PERF_SAMPLE_MAX = 1U << 9, /* non-ABI */ 126 PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */
125}; 127};
126 128
127/* 129/*
128 * Bits that can be set in attr.read_format to request that 130 * The format of the data returned by read() on a perf counter fd,
129 * reads on the counter should return the indicated quantities, 131 * as specified by attr.read_format:
130 * in increasing order of bit value, after the counter value. 132 *
133 * struct read_format {
134 * { u64 value;
135 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
136 * { u64 time_running; } && PERF_FORMAT_RUNNING
137 * { u64 id; } && PERF_FORMAT_ID
138 * } && !PERF_FORMAT_GROUP
139 *
140 * { u64 nr;
141 * { u64 time_enabled; } && PERF_FORMAT_ENABLED
142 * { u64 time_running; } && PERF_FORMAT_RUNNING
143 * { u64 value;
144 * { u64 id; } && PERF_FORMAT_ID
145 * } cntr[nr];
146 * } && PERF_FORMAT_GROUP
147 * };
131 */ 148 */
132enum perf_counter_read_format { 149enum perf_counter_read_format {
133 PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, 150 PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0,
134 PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, 151 PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1,
135 PERF_FORMAT_ID = 1U << 2, 152 PERF_FORMAT_ID = 1U << 2,
153 PERF_FORMAT_GROUP = 1U << 3,
136 154
137 PERF_FORMAT_MAX = 1U << 3, /* non-ABI */ 155 PERF_FORMAT_MAX = 1U << 4, /* non-ABI */
138}; 156};
139 157
140#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ 158#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
@@ -180,8 +198,9 @@ struct perf_counter_attr {
180 freq : 1, /* use freq, not period */ 198 freq : 1, /* use freq, not period */
181 inherit_stat : 1, /* per task counts */ 199 inherit_stat : 1, /* per task counts */
182 enable_on_exec : 1, /* next exec enables */ 200 enable_on_exec : 1, /* next exec enables */
201 task : 1, /* trace fork/exit */
183 202
184 __reserved_1 : 51; 203 __reserved_1 : 50;
185 204
186 __u32 wakeup_events; /* wakeup every n events */ 205 __u32 wakeup_events; /* wakeup every n events */
187 __u32 __reserved_2; 206 __u32 __reserved_2;
@@ -310,18 +329,18 @@ enum perf_event_type {
310 /* 329 /*
311 * struct { 330 * struct {
312 * struct perf_event_header header; 331 * struct perf_event_header header;
313 * u64 time; 332 * u32 pid, ppid;
314 * u64 id; 333 * u32 tid, ptid;
315 * u64 sample_period;
316 * }; 334 * };
317 */ 335 */
318 PERF_EVENT_PERIOD = 4, 336 PERF_EVENT_EXIT = 4,
319 337
320 /* 338 /*
321 * struct { 339 * struct {
322 * struct perf_event_header header; 340 * struct perf_event_header header;
323 * u64 time; 341 * u64 time;
324 * u64 id; 342 * u64 id;
343 * u64 stream_id;
325 * }; 344 * };
326 */ 345 */
327 PERF_EVENT_THROTTLE = 5, 346 PERF_EVENT_THROTTLE = 5,
@@ -331,6 +350,7 @@ enum perf_event_type {
331 * struct { 350 * struct {
332 * struct perf_event_header header; 351 * struct perf_event_header header;
333 * u32 pid, ppid; 352 * u32 pid, ppid;
353 * u32 tid, ptid;
334 * }; 354 * };
335 */ 355 */
336 PERF_EVENT_FORK = 7, 356 PERF_EVENT_FORK = 7,
@@ -339,10 +359,8 @@ enum perf_event_type {
339 * struct { 359 * struct {
340 * struct perf_event_header header; 360 * struct perf_event_header header;
341 * u32 pid, tid; 361 * u32 pid, tid;
342 * u64 value; 362 *
343 * { u64 time_enabled; } && PERF_FORMAT_ENABLED 363 * struct read_format values;
344 * { u64 time_running; } && PERF_FORMAT_RUNNING
345 * { u64 parent_id; } && PERF_FORMAT_ID
346 * }; 364 * };
347 */ 365 */
348 PERF_EVENT_READ = 8, 366 PERF_EVENT_READ = 8,
@@ -356,14 +374,28 @@ enum perf_event_type {
356 * { u64 time; } && PERF_SAMPLE_TIME 374 * { u64 time; } && PERF_SAMPLE_TIME
357 * { u64 addr; } && PERF_SAMPLE_ADDR 375 * { u64 addr; } && PERF_SAMPLE_ADDR
358 * { u64 id; } && PERF_SAMPLE_ID 376 * { u64 id; } && PERF_SAMPLE_ID
377 * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID
359 * { u32 cpu, res; } && PERF_SAMPLE_CPU 378 * { u32 cpu, res; } && PERF_SAMPLE_CPU
360 * { u64 period; } && PERF_SAMPLE_PERIOD 379 * { u64 period; } && PERF_SAMPLE_PERIOD
361 * 380 *
362 * { u64 nr; 381 * { struct read_format values; } && PERF_SAMPLE_READ
363 * { u64 id, val; } cnt[nr]; } && PERF_SAMPLE_GROUP
364 * 382 *
365 * { u64 nr, 383 * { u64 nr,
366 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN 384 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN
385 *
386 * #
387 * # The RAW record below is opaque data wrt the ABI
388 * #
389 * # That is, the ABI doesn't make any promises wrt to
390 * # the stability of its content, it may vary depending
391 * # on event, hardware, kernel version and phase of
392 * # the moon.
393 * #
394 * # In other words, PERF_SAMPLE_RAW contents are not an ABI.
395 * #
396 *
397 * { u32 size;
398 * char data[size];}&& PERF_SAMPLE_RAW
367 * }; 399 * };
368 */ 400 */
369 PERF_EVENT_SAMPLE = 9, 401 PERF_EVENT_SAMPLE = 9,
@@ -409,6 +441,11 @@ struct perf_callchain_entry {
409 __u64 ip[PERF_MAX_STACK_DEPTH]; 441 __u64 ip[PERF_MAX_STACK_DEPTH];
410}; 442};
411 443
444struct perf_raw_record {
445 u32 size;
446 void *data;
447};
448
412struct task_struct; 449struct task_struct;
413 450
414/** 451/**
@@ -677,10 +714,13 @@ struct perf_sample_data {
677 struct pt_regs *regs; 714 struct pt_regs *regs;
678 u64 addr; 715 u64 addr;
679 u64 period; 716 u64 period;
717 struct perf_raw_record *raw;
680}; 718};
681 719
682extern int perf_counter_overflow(struct perf_counter *counter, int nmi, 720extern int perf_counter_overflow(struct perf_counter *counter, int nmi,
683 struct perf_sample_data *data); 721 struct perf_sample_data *data);
722extern void perf_counter_output(struct perf_counter *counter, int nmi,
723 struct perf_sample_data *data);
684 724
685/* 725/*
686 * Return 1 for a software counter, 0 for a hardware counter 726 * Return 1 for a software counter, 0 for a hardware counter