aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/perf_event.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 13:28:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 13:28:49 -0400
commit7e92daaefa68e5ef1e1732e45231e73adbb724e7 (patch)
tree8e7f8ac9d82654df4c65939c6682f95510e22977 /include/linux/perf_event.h
parent7a68294278ae714ce2632a54f0f46916dca64f56 (diff)
parent1d787d37c8ff6612b8151c6dff15bfa7347bcbdf (diff)
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf update from Ingo Molnar: "Lots of changes in this cycle as well, with hundreds of commits from over 30 contributors. Most of the activity was on the tooling side. Higher level changes: - New 'perf kvm' analysis tool, from Xiao Guangrong. - New 'perf trace' system-wide tracing tool - uprobes fixes + cleanups from Oleg Nesterov. - Lots of patches to make perf build on Android out of box, from Irina Tirdea - Extend ftrace function tracing utility to be more dynamic for its users. It allows for data passing to the callback functions, as well as reading regs as if a breakpoint were to trigger at function entry. The main goal of this patch series was to allow kprobes to use ftrace as an optimized probe point when a probe is placed on an ftrace nop. With lots of help from Masami Hiramatsu, and going through lots of iterations, we finally came up with a good solution. - Add cpumask for uncore pmu, use it in 'stat', from Yan, Zheng. - Various tracing updates from Steve Rostedt - Clean up and improve 'perf sched' performance by elliminating lots of needless calls to libtraceevent. - Event group parsing support, from Jiri Olsa - UI/gtk refactorings and improvements from Namhyung Kim - Add support for non-tracepoint events in perf script python, from Feng Tang - Add --symbols to 'script', similar to the one in 'report', from Feng Tang. Infrastructure enhancements and fixes: - Convert the trace builtins to use the growing evsel/evlist tracepoint infrastructure, removing several open coded constructs like switch like series of strcmp to dispatch events, etc. Basically what had already been showcased in 'perf sched'. - Add evsel constructor for tracepoints, that uses libtraceevent just to parse the /format events file, use it in a new 'perf test' to make sure the libtraceevent format parsing regressions can be more readily caught. - Some strange errors were happening in some builds, but not on the next, reported by several people, problem was some parser related files, generated during the build, didn't had proper make deps, fix from Eric Sandeen. - Introduce struct and cache information about the environment where a perf.data file was captured, from Namhyung Kim. - Fix handling of unresolved samples when --symbols is used in 'report', from Feng Tang. - Add union member access support to 'probe', from Hyeoncheol Lee. - Fixups to die() removal, from Namhyung Kim. - Render fixes for the TUI, from Namhyung Kim. - Don't enable annotation in non symbolic view, from Namhyung Kim. - Fix pipe mode in 'report', from Namhyung Kim. - Move related stats code from stat to util/, will be used by the 'stat' kvm tool, from Xiao Guangrong. - Remove die()/exit() calls from several tools. - Resolve vdso callchains, from Jiri Olsa - Don't pass const char pointers to basename, so that we can unconditionally use libgen.h and thus avoid ifdef BIONIC lines, from David Ahern - Refactor hist formatting so that it can be reused with the GTK browser, From Namhyung Kim - Fix build for another rbtree.c change, from Adrian Hunter. - Make 'perf diff' command work with evsel hists, from Jiri Olsa. - Use the only field_sep var that is set up: symbol_conf.field_sep, fix from Jiri Olsa. - .gitignore compiled python binaries, from Namhyung Kim. - Get rid of die() in more libtraceevent places, from Namhyung Kim. - Rename libtraceevent 'private' struct member to 'priv' so that it works in C++, from Steven Rostedt - Remove lots of exit()/die() calls from tools so that the main perf exit routine can take place, from David Ahern - Fix x86 build on x86-64, from David Ahern. - {int,str,rb}list fixes from Suzuki K Poulose - perf.data header fixes from Namhyung Kim - Allow user to indicate objdump path, needed in cross environments, from Maciek Borzecki - Fix hardware cache event name generation, fix from Jiri Olsa - Add round trip test for sw, hw and cache event names, catching the problem Jiri fixed, after Jiri's patch, the test passes successfully. - Clean target should do clean for lib/traceevent too, fix from David Ahern - Check the right variable for allocation failure, fix from Namhyung Kim - Set up evsel->tp_format regardless of evsel->name being set already, fix from Namhyung Kim - Oprofile fixes from Robert Richter. - Remove perf_event_attr needless version inflation, from Jiri Olsa - Introduce libtraceevent strerror like error reporting facility, from Namhyung Kim - Add pmu mappings to perf.data header and use event names from cmd line, from Robert Richter - Fix include order for bison/flex-generated C files, from Ben Hutchings - Build fixes and documentation corrections from David Ahern - Assorted cleanups from Robert Richter - Let O= makes handle relative paths, from Steven Rostedt - perf script python fixes, from Feng Tang. - Initial bash completion support, from Frederic Weisbecker - Allow building without libelf, from Namhyung Kim. - Support DWARF CFI based unwind to have callchains when %bp based unwinding is not possible, from Jiri Olsa. - Symbol resolution fixes, while fixing support PPC64 files with an .opt ELF section was the end goal, several fixes for code that handles all architectures and cleanups are included, from Cody Schafer. - Assorted fixes for Documentation and build in 32 bit, from Robert Richter - Cache the libtraceevent event_format associated to each evsel early, so that we avoid relookups, i.e. calling pevent_find_event repeatedly when processing tracepoint events. [ This is to reduce the surface contact with libtraceevents and make clear what is that the perf tools needs from that lib: so far parsing the common and per event fields. ] - Don't stop the build if the audit libraries are not installed, fix from Namhyung Kim. - Fix bfd.h/libbfd detection with recent binutils, from Markus Trippelsdorf. - Improve warning message when libunwind devel packages not present, from Jiri Olsa" * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (282 commits) perf trace: Add aliases for some syscalls perf probe: Print an enum type variable in "enum variable-name" format when showing accessible variables perf tools: Check libaudit availability for perf-trace builtin perf hists: Add missing period_* fields when collapsing a hist entry perf trace: New tool perf evsel: Export the event_format constructor perf evsel: Introduce rawptr() method perf tools: Use perf_evsel__newtp in the event parser perf evsel: The tracepoint constructor should store sys:name perf evlist: Introduce set_filter() method perf evlist: Renane set_filters method to apply_filters perf test: Add test to check we correctly parse and match syscall open parms perf evsel: Handle endianity in intval method perf evsel: Know if byte swap is needed perf tools: Allow handling a NULL cpu_map as meaning "all cpus" perf evsel: Improve tracepoint constructor setup tools lib traceevent: Fix error path on pevent_parse_event perf test: Fix build failure trace: Move trace event enable from fs_initcall to core_initcall tracing: Add an option for disabling markers ...
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r--include/linux/perf_event.h60
1 files changed, 55 insertions, 5 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index bdb41612bfec..599afc4bb67e 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -130,8 +130,10 @@ enum perf_event_sample_format {
130 PERF_SAMPLE_STREAM_ID = 1U << 9, 130 PERF_SAMPLE_STREAM_ID = 1U << 9,
131 PERF_SAMPLE_RAW = 1U << 10, 131 PERF_SAMPLE_RAW = 1U << 10,
132 PERF_SAMPLE_BRANCH_STACK = 1U << 11, 132 PERF_SAMPLE_BRANCH_STACK = 1U << 11,
133 PERF_SAMPLE_REGS_USER = 1U << 12,
134 PERF_SAMPLE_STACK_USER = 1U << 13,
133 135
134 PERF_SAMPLE_MAX = 1U << 12, /* non-ABI */ 136 PERF_SAMPLE_MAX = 1U << 14, /* non-ABI */
135}; 137};
136 138
137/* 139/*
@@ -163,6 +165,15 @@ enum perf_branch_sample_type {
163 PERF_SAMPLE_BRANCH_HV) 165 PERF_SAMPLE_BRANCH_HV)
164 166
165/* 167/*
168 * Values to determine ABI of the registers dump.
169 */
170enum perf_sample_regs_abi {
171 PERF_SAMPLE_REGS_ABI_NONE = 0,
172 PERF_SAMPLE_REGS_ABI_32 = 1,
173 PERF_SAMPLE_REGS_ABI_64 = 2,
174};
175
176/*
166 * The format of the data returned by read() on a perf event fd, 177 * The format of the data returned by read() on a perf event fd,
167 * as specified by attr.read_format: 178 * as specified by attr.read_format:
168 * 179 *
@@ -194,6 +205,8 @@ enum perf_event_read_format {
194#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ 205#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
195#define PERF_ATTR_SIZE_VER1 72 /* add: config2 */ 206#define PERF_ATTR_SIZE_VER1 72 /* add: config2 */
196#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */ 207#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */
208#define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */
209 /* add: sample_stack_user */
197 210
198/* 211/*
199 * Hardware event_id to monitor via a performance monitoring event: 212 * Hardware event_id to monitor via a performance monitoring event:
@@ -255,7 +268,10 @@ struct perf_event_attr {
255 exclude_host : 1, /* don't count in host */ 268 exclude_host : 1, /* don't count in host */
256 exclude_guest : 1, /* don't count in guest */ 269 exclude_guest : 1, /* don't count in guest */
257 270
258 __reserved_1 : 43; 271 exclude_callchain_kernel : 1, /* exclude kernel callchains */
272 exclude_callchain_user : 1, /* exclude user callchains */
273
274 __reserved_1 : 41;
259 275
260 union { 276 union {
261 __u32 wakeup_events; /* wakeup every n events */ 277 __u32 wakeup_events; /* wakeup every n events */
@@ -271,7 +287,21 @@ struct perf_event_attr {
271 __u64 bp_len; 287 __u64 bp_len;
272 __u64 config2; /* extension of config1 */ 288 __u64 config2; /* extension of config1 */
273 }; 289 };
274 __u64 branch_sample_type; /* enum branch_sample_type */ 290 __u64 branch_sample_type; /* enum perf_branch_sample_type */
291
292 /*
293 * Defines set of user regs to dump on samples.
294 * See asm/perf_regs.h for details.
295 */
296 __u64 sample_regs_user;
297
298 /*
299 * Defines size of the user stack to dump on samples.
300 */
301 __u32 sample_stack_user;
302
303 /* Align to u64. */
304 __u32 __reserved_2;
275}; 305};
276 306
277#define perf_flags(attr) (*(&(attr)->read_format + 1)) 307#define perf_flags(attr) (*(&(attr)->read_format + 1))
@@ -550,6 +580,13 @@ enum perf_event_type {
550 * char data[size];}&& PERF_SAMPLE_RAW 580 * char data[size];}&& PERF_SAMPLE_RAW
551 * 581 *
552 * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK 582 * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK
583 *
584 * { u64 abi; # enum perf_sample_regs_abi
585 * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER
586 *
587 * { u64 size;
588 * char data[size];
589 * u64 dyn_size; } && PERF_SAMPLE_STACK_USER
553 * }; 590 * };
554 */ 591 */
555 PERF_RECORD_SAMPLE = 9, 592 PERF_RECORD_SAMPLE = 9,
@@ -611,6 +648,7 @@ struct perf_guest_info_callbacks {
611#include <linux/static_key.h> 648#include <linux/static_key.h>
612#include <linux/atomic.h> 649#include <linux/atomic.h>
613#include <linux/sysfs.h> 650#include <linux/sysfs.h>
651#include <linux/perf_regs.h>
614#include <asm/local.h> 652#include <asm/local.h>
615 653
616struct perf_callchain_entry { 654struct perf_callchain_entry {
@@ -656,6 +694,11 @@ struct perf_branch_stack {
656 struct perf_branch_entry entries[0]; 694 struct perf_branch_entry entries[0];
657}; 695};
658 696
697struct perf_regs_user {
698 __u64 abi;
699 struct pt_regs *regs;
700};
701
659struct task_struct; 702struct task_struct;
660 703
661/* 704/*
@@ -1135,6 +1178,8 @@ struct perf_sample_data {
1135 struct perf_callchain_entry *callchain; 1178 struct perf_callchain_entry *callchain;
1136 struct perf_raw_record *raw; 1179 struct perf_raw_record *raw;
1137 struct perf_branch_stack *br_stack; 1180 struct perf_branch_stack *br_stack;
1181 struct perf_regs_user regs_user;
1182 u64 stack_user_size;
1138}; 1183};
1139 1184
1140static inline void perf_sample_data_init(struct perf_sample_data *data, 1185static inline void perf_sample_data_init(struct perf_sample_data *data,
@@ -1144,7 +1189,10 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
1144 data->addr = addr; 1189 data->addr = addr;
1145 data->raw = NULL; 1190 data->raw = NULL;
1146 data->br_stack = NULL; 1191 data->br_stack = NULL;
1147 data->period = period; 1192 data->period = period;
1193 data->regs_user.abi = PERF_SAMPLE_REGS_ABI_NONE;
1194 data->regs_user.regs = NULL;
1195 data->stack_user_size = 0;
1148} 1196}
1149 1197
1150extern void perf_output_sample(struct perf_output_handle *handle, 1198extern void perf_output_sample(struct perf_output_handle *handle,
@@ -1292,8 +1340,10 @@ static inline bool has_branch_stack(struct perf_event *event)
1292extern int perf_output_begin(struct perf_output_handle *handle, 1340extern int perf_output_begin(struct perf_output_handle *handle,
1293 struct perf_event *event, unsigned int size); 1341 struct perf_event *event, unsigned int size);
1294extern void perf_output_end(struct perf_output_handle *handle); 1342extern void perf_output_end(struct perf_output_handle *handle);
1295extern void perf_output_copy(struct perf_output_handle *handle, 1343extern unsigned int perf_output_copy(struct perf_output_handle *handle,
1296 const void *buf, unsigned int len); 1344 const void *buf, unsigned int len);
1345extern unsigned int perf_output_skip(struct perf_output_handle *handle,
1346 unsigned int len);
1297extern int perf_swevent_get_recursion_context(void); 1347extern int perf_swevent_get_recursion_context(void);
1298extern void perf_swevent_put_recursion_context(int rctx); 1348extern void perf_swevent_put_recursion_context(int rctx);
1299extern void perf_event_enable(struct perf_event *event); 1349extern void perf_event_enable(struct perf_event *event);