perf updates and fixes
Subsystems (5)
Linus,
Please pull the latest perf-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-for-linus
HEAD: 8ebfdf2babcda5a3b06cc67523bca1f9aed46009 Merge branch 'perf/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
It's mostly fixes, but there's also two late items:
- preliminary GTK GUI support for perf report
- PMU raw event format descriptors in sysfs, to be parsed by tooling
The raw event format in sysfs is a new ABI. For example for the 'CPU' PMU we have:
aldebaran:~> ll /sys/bus/event_source/devices/cpu/format/*
-r--r--r--. 1 root root 4096 Mar 31 10:29 /sys/bus/event_source/devices/cpu/format/any -r--r--r--. 1 root root 4096 Mar 31 10:29 /sys/bus/event_source/devices/cpu/format/cmask -r--r--r--. 1 root root 4096 Mar 31 10:29 /sys/bus/event_source/devices/cpu/format/edge -r--r--r--. 1 root root 4096 Mar 31 10:29 /sys/bus/event_source/devices/cpu/format/event -r--r--r--. 1 root root 4096 Mar 31 10:29 /sys/bus/event_source/devices/cpu/format/inv -r--r--r--. 1 root root 4096 Mar 31 10:29 /sys/bus/event_source/devices/cpu/format/offcore_rsp -r--r--r--. 1 root root 4096 Mar 31 10:29 /sys/bus/event_source/devices/cpu/format/pc -r--r--r--. 1 root root 4096 Mar 31 10:29 /sys/bus/event_source/devices/cpu/format/umask
those lists of fields contain a specific format:
aldebaran:~> cat /sys/bus/event_source/devices/cpu/format/offcore_rsp config1:0-63
So, those who wish to specify raw events can now use the following event format:
-e cpu/cmask=1,event=2,umask=3
Most people will not want to specify any events (let alone raw events), they'll just use whatever default event the tools use.
But for more obscure PMU events that have no cross-architecture generic events the above syntax is more usable and a bit more structured than specifying hex numbers.
Thanks,
Ingo
------------------>
Arnaldo Carvalho de Melo (1):
perf annotate: Fix off by one symbol hist size allocation and hit accounting
Borislav Petkov (1):
perf tools: Simplify event_read_id exit path
David Miller (3):
perf symbols: Do not include libgen.h
perf symbols: Handle NULL dso in dso__name_len
perf annotate: addr2line wants addresses in same format as objdump
Frederic Weisbecker (1):
perf tools: Fix display of first level of callchains
Gerlando Falauto (1):
tracing: Do not select FRAME_POINTER on PPC
Ingo Molnar (1):
perf tools: Remove auto-generated bison/flex files
Jan Beulich (1):
perf tools: Adjust make rules
Jiri Olsa (11):
perf: Add ifdef to remove unused enum switch warnings
perf: Adding sysfs group format attribute for pmu device perf tools: Add parser generator for events parsing perf tools: Add config options support for event parsing perf tools: Add perf pmu object to access pmu format definition perf tools: Add support to specify pmu style event perf tools: Fix various casting issues for 32 bits perf tools: Fix modifier to be applied on correct events perf diff: Fix to work with new hists design
perf: Move mmap page data_head offset assertion out of header perf tools: Switch module.h into export.h
Mark Brown (1):
tracing: Fix build breakage without CONFIG_PERF_EVENTS
Namhyung Kim (10):
perf stat: Fix event grouping on forked task
perf tools: Do not disable members of group event perf hists: Add hists__filter_by_symbol
perf ui browser: Introduce ui_browser__input_window perf ui browser: Add 's' key to filter by symbol name perf report: Add --symbol-filter option
perf report: Treat an argument as a symbol filter perf ui browser: Clean lines inside of the input window perf report: Document --symbol-filter option
perf tools: Add missing ref-cycles event back to event parser
Pekka Enberg (1):
perf report: Add a simple GTK2-based 'perf report' browser
Peter Zijlstra (1):
perf: Fix mmap_page capabilities and docs
Prashanth Nageshappa (1):
perf probe: Finder fails to resolve function name to address
Rajesh Bhagat (1):
ftrace: Fix function_graph for archs that test ftrace_trace_function
Stephane Eranian (1):
perf tools: Fix bug in raw sample parsing
Steven Rostedt (4):
tracing/ring-buffer: Only have tracing_on disable tracing buffers
tracing: Keep NMI watchdog from triggering when dumping trace
tracing: Move the tracing_on/off() declarations into CONFIG_TRACING
tracing: Fix ent_size in trace output
Wolfgang Mauerer (1):
tracing: Fix ftrace stack trace entries
.../testing/sysfs-bus-event_source-devices-format | 14 +
arch/x86/kernel/cpu/perf_event.c | 17 +-
arch/x86/kernel/cpu/perf_event.h | 1 +
arch/x86/kernel/cpu/perf_event_amd.c | 18 +
arch/x86/kernel/cpu/perf_event_intel.c | 36 ++
arch/x86/kernel/cpu/perf_event_p6.c | 19 +
include/linux/ftrace_event.h | 2 +
include/linux/kernel.h | 15 +-
include/linux/perf_event.h | 90 +++-
include/linux/ring_buffer.h | 3 +
kernel/events/core.c | 11 +-
kernel/trace/Kconfig | 2 +-
kernel/trace/ftrace.c | 3 +-
kernel/trace/ring_buffer.c | 157 ++----
kernel/trace/trace.c | 113 ++++
kernel/trace/trace.h | 3 +-
kernel/trace/trace_entries.h | 16 +-
kernel/trace/trace_export.c | 2 +-
tools/perf/Documentation/perf-report.txt | 5 +
tools/perf/Makefile | 66 ++-
tools/perf/builtin-diff.c | 60 ++-
tools/perf/builtin-report.c | 40 +-
tools/perf/builtin-stat.c | 2 +-
tools/perf/builtin-test.c | 174 ++++++-
tools/perf/config/feature-tests.mak | 15 +
tools/perf/util/annotate.c | 8 +-
tools/perf/util/cache.h | 12 +
tools/perf/util/evlist.c | 6 +-
tools/perf/util/evsel.c | 10 +-
tools/perf/util/evsel.h | 5 +-
tools/perf/util/gtk/browser.c | 189 ++++++
tools/perf/util/gtk/gtk.h | 8 +
tools/perf/util/header.c | 2 +-
tools/perf/util/hist.c | 200 +++++---
tools/perf/util/hist.h | 19 +
.../perf/util/include/linux/{module.h => export.h} | 0
tools/perf/util/parse-events.c | 603 +++++++++-----------
tools/perf/util/parse-events.h | 49 ++
tools/perf/util/parse-events.l | 127 ++++
tools/perf/util/parse-events.y | 229 ++++++++
tools/perf/util/pmu.c | 469 +++++++++++++++
tools/perf/util/pmu.h | 41 ++
tools/perf/util/pmu.l | 43 ++
tools/perf/util/pmu.y | 93 +++
tools/perf/util/probe-finder.c | 4 +-
tools/perf/util/session.c | 1 +
tools/perf/util/symbol.c | 3 +-
tools/perf/util/trace-event-parse.c | 10 +-
tools/perf/util/ui/browser.h | 2 +
tools/perf/util/ui/browsers/hists.c | 14 +-
tools/perf/util/ui/keysyms.h | 2 +
tools/perf/util/ui/util.c | 82 +++
52 files changed, 2531 insertions(+), 584 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-bus-event_source-devices-format
create mode 100644 tools/perf/util/gtk/browser.c
create mode 100644 tools/perf/util/gtk/gtk.h
rename tools/perf/util/include/linux/{module.h => export.h} (100%)
create mode 100644 tools/perf/util/parse-events.l
create mode 100644 tools/perf/util/parse-events.y
create mode 100644 tools/perf/util/pmu.c
create mode 100644 tools/perf/util/pmu.h
create mode 100644 tools/perf/util/pmu.l
create mode 100644 tools/perf/util/pmu.yDocumentation/ABI/testing/sysfs-bus-event_source-devices-format new file +14 -0
@@ -0,0 +1,14 @@ +Where: /sys/bus/event_source/devices/<dev>/format +Date: January 2012 +Kernel Version: 3.3 +Contact: Jiri Olsa <[email protected]> +Description: + Attribute group to describe the magic bits that go into + perf_event_attr::config[012] for a particular pmu. + Each attribute of this group defines the 'hardware' bitmask + we want to export, so that userspace can deal with sane + name/value pairs. + + Example: 'config1:1,6-10,44' + Defines contents of attribute that occupies bits 1,6-10,44 of + perf_event_attr::config1.
arch/x86/kernel/cpu/perf_event.c +16 -1
@@ -1314,6 +1314,11 @@ static void __init pmu_check_apic(void)pr_info ("no hardware sampling interrupt available.\n" ); } +static struct attribute_group x86_pmu_format_group = { + .name ="format" , + .attrs =NULL , +}; +static int __init init_hw_perf_events (void ) {struct x86_pmu_quirk *quirk;
@@ -1388,6 +1393,7 @@ static int __init init_hw_perf_events(void) } x86_pmu.attr_rdpmc =1 ;/* enable userspace RDPMC usage by default */ + x86_pmu_format_group.attrs = x86_pmu.format_attrs;pr_info ("... version: %d\n" , x86_pmu.version);pr_info ("... bit width: %d\n" , x86_pmu.cntval_bits);
@@ -1616,6 +1622,9 @@ static int x86_pmu_event_idx(struct perf_event *event) {int idx = event->hw.idx; +if (!x86_pmu.attr_rdpmc) +return 0 ; +if (x86_pmu.num_counters_fixed && idx >=X86_PMC_IDX_FIXED ) { idx -=X86_PMC_IDX_FIXED ; idx |=1 <<30 ;
@@ -1668,6 +1677,7 @@ static struct attribute_group x86_pmu_attr_group = {static const struct attribute_group *x86_pmu_attr_groups[] = { &x86_pmu_attr_group, + &x86_pmu_format_group,NULL , };
@@ -1699,14 +1709,19 @@ static struct pmu pmu = { .flush_branch_stack = x86_pmu_flush_branch_stack, }; -void perf_update_user_clock (struct perf_event_mmap_page *userpg,u64 now) +void arch_perf_update_userpage (struct perf_event_mmap_page *userpg,u64 now) { + userpg->cap_usr_time =0 ; + userpg->cap_usr_rdpmc = x86_pmu.attr_rdpmc; + userpg->pmc_width = x86_pmu.cntval_bits; +if (!boot_cpu_has (X86_FEATURE_CONSTANT_TSC ))return ;if (!boot_cpu_has (X86_FEATURE_NONSTOP_TSC ))return ; + userpg->cap_usr_time =1 ; userpg->time_mult =this_cpu_read (cyc2ns); userpg->time_shift =CYC2NS_SCALE_FACTOR ; userpg->time_offset =this_cpu_read (cyc2ns_offset) - now;
arch/x86/kernel/cpu/perf_event.h +1 -0
@@ -339,6 +339,7 @@ struct x86_pmu {* sysfs attrs */ int attr_rdpmc; +struct attribute **format_attrs;/* * CPU Hotplug hooks
arch/x86/kernel/cpu/perf_event_amd.c +18 -0
@@ -404,6 +404,21 @@ static void amd_pmu_cpu_dead(int cpu) } } +PMU_FORMAT_ATTR (event,"config:0-7,32-35" ); +PMU_FORMAT_ATTR (umask,"config:8-15" ); +PMU_FORMAT_ATTR (edge,"config:18" ); +PMU_FORMAT_ATTR (inv,"config:23" ); +PMU_FORMAT_ATTR (cmask,"config:24-31" ); + +static struct attribute *amd_format_attr[] = { + &format_attr_event.attr, + &format_attr_umask.attr, + &format_attr_edge.attr, + &format_attr_inv.attr, + &format_attr_cmask.attr, +NULL , +}; +static __initconst const struct x86_pmu amd_pmu = { .name ="AMD" , .handle_irq = x86_pmu_handle_irq,
@@ -426,6 +441,8 @@ static __initconst const struct x86_pmu amd_pmu = { .get_event_constraints = amd_get_event_constraints, .put_event_constraints = amd_put_event_constraints, + .format_attrs = amd_format_attr, + .cpu_prepare = amd_pmu_cpu_prepare, .cpu_starting = amd_pmu_cpu_starting, .cpu_dead = amd_pmu_cpu_dead,
@@ -596,6 +613,7 @@ static __initconst const struct x86_pmu amd_pmu_f15h = { .cpu_dead = amd_pmu_cpu_dead, #endif .cpu_starting = amd_pmu_cpu_starting, + .format_attrs = amd_format_attr, };__init int amd_pmu_init (void )
arch/x86/kernel/cpu/perf_event_intel.c +36 -0
@@ -1431,6 +1431,24 @@ static void core_pmu_enable_all(int added) } } +PMU_FORMAT_ATTR (event,"config:0-7" ); +PMU_FORMAT_ATTR (umask,"config:8-15" ); +PMU_FORMAT_ATTR (edge,"config:18" ); +PMU_FORMAT_ATTR (pc,"config:19" ); +PMU_FORMAT_ATTR (any,"config:21" );/* v3 + */ +PMU_FORMAT_ATTR (inv,"config:23" ); +PMU_FORMAT_ATTR (cmask,"config:24-31" ); + +static struct attribute *intel_arch_formats_attr[] = { + &format_attr_event.attr, + &format_attr_umask.attr, + &format_attr_edge.attr, + &format_attr_pc.attr, + &format_attr_inv.attr, + &format_attr_cmask.attr, +NULL , +}; +static __initconst const struct x86_pmu core_pmu = { .name ="core" , .handle_irq = x86_pmu_handle_irq,
@@ -1455,6 +1473,7 @@ static __initconst const struct x86_pmu core_pmu = { .put_event_constraints = intel_put_event_constraints, .event_constraints = intel_core_event_constraints, .guest_get_msrs = core_guest_get_msrs, + .format_attrs = intel_arch_formats_attr, };struct intel_shared_regs *allocate_shared_regs (int cpu)
@@ -1553,6 +1572,21 @@ static void intel_pmu_flush_branch_stack(void)intel_pmu_lbr_reset (); } +PMU_FORMAT_ATTR (offcore_rsp,"config1:0-63" ); + +static struct attribute *intel_arch3_formats_attr[] = { + &format_attr_event.attr, + &format_attr_umask.attr, + &format_attr_edge.attr, + &format_attr_pc.attr, + &format_attr_any.attr, + &format_attr_inv.attr, + &format_attr_cmask.attr, + + &format_attr_offcore_rsp.attr,/* XXX do NHM/WSM + SNB breakout */ +NULL , +}; +static __initconst const struct x86_pmu intel_pmu = { .name ="Intel" , .handle_irq = intel_pmu_handle_irq,
@@ -1576,6 +1610,8 @@ static __initconst const struct x86_pmu intel_pmu = { .get_event_constraints = intel_get_event_constraints, .put_event_constraints = intel_put_event_constraints, + .format_attrs = intel_arch3_formats_attr, + .cpu_prepare = intel_pmu_cpu_prepare, .cpu_starting = intel_pmu_cpu_starting, .cpu_dying = intel_pmu_cpu_dying,
arch/x86/kernel/cpu/perf_event_p6.c +19 -0
@@ -87,6 +87,23 @@ static void p6_pmu_enable_event(struct perf_event *event) (void )checking_wrmsrl (hwc->config_base, val); } +PMU_FORMAT_ATTR (event,"config:0-7" ); +PMU_FORMAT_ATTR (umask,"config:8-15" ); +PMU_FORMAT_ATTR (edge,"config:18" ); +PMU_FORMAT_ATTR (pc,"config:19" ); +PMU_FORMAT_ATTR (inv,"config:23" ); +PMU_FORMAT_ATTR (cmask,"config:24-31" ); + +static struct attribute *intel_p6_formats_attr[] = { + &format_attr_event.attr, + &format_attr_umask.attr, + &format_attr_edge.attr, + &format_attr_pc.attr, + &format_attr_inv.attr, + &format_attr_cmask.attr, +NULL , +}; +static __initconst const struct x86_pmu p6_pmu = { .name ="p6" , .handle_irq = x86_pmu_handle_irq,
@@ -115,6 +132,8 @@ static __initconst const struct x86_pmu p6_pmu = { .cntval_mask = (1ULL << 32) - 1, .get_event_constraints = x86_get_event_constraints, .event_constraints = p6_event_constraints, + + .format_attrs = intel_p6_formats_attr, };__init int p6_pmu_init (void )
include/linux/ftrace_event.h +2 -0
@@ -144,12 +144,14 @@ struct event_filter;enum trace_reg {TRACE_REG_REGISTER ,TRACE_REG_UNREGISTER , +#ifdef CONFIG_PERF_EVENTS TRACE_REG_PERF_REGISTER ,TRACE_REG_PERF_UNREGISTER ,TRACE_REG_PERF_OPEN ,TRACE_REG_PERF_CLOSE ,TRACE_REG_PERF_ADD ,TRACE_REG_PERF_DEL , +#endif };struct ftrace_event_call ;
include/linux/kernel.h +9 -6
@@ -428,16 +428,10 @@ extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);* Most likely, you want to use tracing_on/tracing_off. */ #ifdef CONFIG_RING_BUFFER -void tracing_on (void ); -void tracing_off (void );/* trace_off_permanent stops recording with no way to bring it back */ void tracing_off_permanent (void ); -int tracing_is_on (void );#else -static inline void tracing_on (void ) { } -static inline void tracing_off (void ) { }static inline void tracing_off_permanent (void ) { } -static inline int tracing_is_on (void ) {return 0 ; }#endif enum ftrace_dump_mode {
@@ -447,6 +441,10 @@ enum ftrace_dump_mode { };#ifdef CONFIG_TRACING +void tracing_on (void ); +void tracing_off (void ); +int tracing_is_on (void ); +extern void tracing_start (void );extern void tracing_stop (void );extern void ftrace_off_permanent (void );
@@ -531,6 +529,11 @@ static inline void tracing_start(void) { }static inline void tracing_stop (void ) { }static inline void ftrace_off_permanent (void ) { }static inline void trace_dump_stack (void ) { } + +static inline void tracing_on (void ) { } +static inline void tracing_off (void ) { } +static inline int tracing_is_on (void ) {return 0 ; } +static inline int trace_printk (const char *fmt, ...) {
include/linux/perf_event.h +80 -10
123 lines not on this page · raw message
include/linux/ring_buffer.h +3 -0
@@ -151,6 +151,9 @@ int ring_buffer_empty_cpu(struct ring_buffer *buffer, int cpu);void ring_buffer_record_disable (struct ring_buffer *buffer);void ring_buffer_record_enable (struct ring_buffer *buffer); +void ring_buffer_record_off (struct ring_buffer *buffer); +void ring_buffer_record_on (struct ring_buffer *buffer); +int ring_buffer_record_is_on (struct ring_buffer *buffer);void ring_buffer_record_disable_cpu (struct ring_buffer *buffer,int cpu);void ring_buffer_record_enable_cpu (struct ring_buffer *buffer,int cpu);
kernel/events/core.c +9 -2
@@ -3348,7 +3348,7 @@ static void calc_timer_values(struct perf_event *event, *running = ctx_time - event->tstamp_running; } -void __weak perf_update_user_clock (struct perf_event_mmap_page *userpg,u64 now) +void __weak arch_perf_update_userpage (struct perf_event_mmap_page *userpg,u64 now) { }
@@ -3398,7 +3398,7 @@ void perf_event_update_userpage(struct perf_event *event) userpg->time_running = running +atomic64_read (&event->child_total_time_running); -perf_update_user_clock (userpg, now); +arch_perf_update_userpage (userpg, now);barrier (); ++userpg->lock;
@@ -7116,6 +7116,13 @@ void __init perf_event_init(void)/* do not patch jump label more than once per second */ jump_label_rate_limit (&perf_sched_events,HZ ); + +/* +* Build time assertion that we keep the data_head at the intended +* location. IOW, validation we got the __reserved[] size right. +*/ +BUILD_BUG_ON ((offsetof(struct perf_event_mmap_page , data_head)) + !=1024 ); }static int __init perf_event_sysfs_init (void )
kernel/trace/Kconfig +1 -1
@@ -141,7 +141,7 @@ if FTRACE config FUNCTION_TRACER bool "Kernel Function Tracer" depends on HAVE_FUNCTION_TRACER - select FRAME_POINTER if !ARM_UNWIND && !S390 && !MICROBLAZE + select FRAME_POINTER if !ARM_UNWIND && !PPC && !S390 && !MICROBLAZE select KALLSYMS select GENERIC_TRACER select CONTEXT_SWITCH_TRACER
kernel/trace/ftrace.c +2 -1
@@ -249,7 +249,8 @@ static void update_ftrace_function(void)#else __ftrace_trace_function = func;#endif - ftrace_trace_function = ftrace_test_stop_func; + ftrace_trace_function = + (func == ftrace_stub) ? func : ftrace_test_stop_func;#endif }
kernel/trace/ring_buffer.c +60 -97
182 lines not on this page · raw message
kernel/trace/trace.c +113 -0
164 lines not on this page · raw message
kernel/trace/trace.h +1 -2
@@ -154,6 +154,7 @@ struct trace_array {struct ring_buffer *buffer;unsigned long entries;int cpu; +int buffer_disabled;cycle_t time_start;struct task_struct *waiter;struct trace_array_cpu *data[NR_CPUS ];
@@ -835,13 +836,11 @@ extern const char *__stop___trace_bprintk_fmt[]; filter)#include "trace_entries.h" -#ifdef CONFIG_PERF_EVENTS #ifdef CONFIG_FUNCTION_TRACER int perf_ftrace_event_register (struct ftrace_event_call *call,enum trace_reg type,void *data);#else #define perf_ftrace_event_register NULL#endif /* CONFIG_FUNCTION_TRACER */ -#endif /* CONFIG_PERF_EVENTS */ #endif /* _LINUX_KERNEL_TRACE_H */
kernel/trace/trace_entries.h +12 -4
@@ -166,6 +166,12 @@ FTRACE_ENTRY_DUP(wakeup, ctx_switch_entry,#define FTRACE_STACK_ENTRIES 8 +#ifndef CONFIG_64BIT +# define IP_FMT "%08lx" +#else +# define IP_FMT "%016lx" +#endif + FTRACE_ENTRY(kernel_stack, stack_entry, TRACE_STACK,
@@ -175,8 +181,9 @@ FTRACE_ENTRY(kernel_stack, stack_entry, __dynamic_array(unsigned long, caller ) ), - F_printk("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" -"\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" , + F_printk("\t=> (" IP_FMT ")\n\t=> (" IP_FMT ")\n\t=> (" IP_FMT ")\n" +"\t=> (" IP_FMT ")\n\t=> (" IP_FMT ")\n\t=> (" IP_FMT ")\n" +"\t=> (" IP_FMT ")\n\t=> (" IP_FMT ")\n" , __entry->caller[0 ], __entry->caller[1 ], __entry->caller[2 ], __entry->caller[3 ], __entry->caller[4 ], __entry->caller[5 ], __entry->caller[6], __entry->caller[7]),
@@ -193,8 +200,9 @@ FTRACE_ENTRY(user_stack, userstack_entry, __array( unsigned long, caller, FTRACE_STACK_ENTRIES ) ), -F_printk ("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" -"\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n" , +F_printk ("\t=> (" IP_FMT ")\n\t=> (" IP_FMT ")\n\t=> (" IP_FMT ")\n" +"\t=> (" IP_FMT ")\n\t=> (" IP_FMT ")\n\t=> (" IP_FMT ")\n" +"\t=> (" IP_FMT ")\n\t=> (" IP_FMT ")\n" , __entry->caller[0 ], __entry->caller[1 ], __entry->caller[2 ], __entry->caller[3 ], __entry->caller[4 ], __entry->caller[5 ], __entry->caller[6], __entry->caller[7]),
kernel/trace/trace_export.c +1 -1
@@ -162,7 +162,7 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \#define __dynamic_array (type, item)#undef F_printk -#define F_printk(fmt, args...) #fmt ", " __stringify(args) +#define F_printk(fmt, args...) __stringify(fmt) ", " __stringify(args)#undef FTRACE_ENTRY_REG #define FTRACE_ENTRY_REG(call, struct_name, etype, tstruct, print, filter,\
tools/perf/Documentation/perf-report.txt +5 -0
@@ -48,6 +48,9 @@ OPTIONS Only consider these symbols. CSV that understands file://filename entries. +--symbol-filter=:: + Only show symbols that match (partially) with this filter. + -U:: --hide-unresolved:: Only display entries resolved to a symbol.
@@ -110,6 +113,8 @@ OPTIONS requires a tty, if one is not present, as when piping to other commands, the stdio interface is used. +--gtk:: Use the GTK2 interface. + -k:: --vmlinux=<file>:: vmlinux pathname
tools/perf/Makefile +63 -3
137 lines not on this page · raw message
tools/perf/builtin-diff.c +35 -25
119 lines not on this page · raw message
tools/perf/builtin-report.c +31 -9
@@ -40,7 +40,7 @@ struct perf_report {struct perf_tool tool;struct perf_session *session;char const *input_name; -bool force, use_tui, use_stdio; +bool force, use_tui, use_gtk, use_stdio;bool hide_unresolved;bool dont_use_callchains;bool show_full_info;
@@ -50,6 +50,7 @@ struct perf_report {const char *pretty_printing_style;symbol_filter_t annotate_init;const char *cpu_list; +const char *symbol_filter_str;DECLARE_BITMAP (cpu_bitmap,MAX_NR_CPUS ); };
@@ -400,6 +401,9 @@ static int __cmd_report(struct perf_report *rep)list_for_each_entry (pos, &session->evlist->entries, node) {struct hists *hists = &pos->hists; +if (pos->idx ==0 ) + hists->symbol_filter_str = rep->symbol_filter_str; +hists__collapse_resort (hists);hists__output_resort (hists); nr_samples += hists->stats.nr_events[PERF_RECORD_SAMPLE ];
@@ -411,8 +415,13 @@ static int __cmd_report(struct perf_report *rep) }if (use_browser >0 ) { -perf_evlist__tui_browse_hists (session->evlist, help, -NULL ,NULL ,0 ); +if (use_browser ==1 ) { +perf_evlist__tui_browse_hists (session->evlist, help, +NULL ,NULL ,0 ); + }else if (use_browser ==2 ) { +perf_evlist__gtk_browse_hists (session->evlist, help, +NULL ,NULL ,0 ); + } }else perf_evlist__tty_browse_hists (session->evlist, rep, help);
@@ -569,6 +578,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)OPT_STRING (0 ,"pretty" , &report.pretty_printing_style,"key" ,"pretty printing style key: normal raw" ),OPT_BOOLEAN (0 ,"tui" , &report.use_tui,"Use the TUI interface" ), +OPT_BOOLEAN (0 ,"gtk" , &report.use_gtk,"Use the GTK2 interface" ),OPT_BOOLEAN (0 ,"stdio" , &report.use_stdio,"Use the stdio interface" ), OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
@@ -591,6 +601,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __used) "only consider symbols in these comms"),OPT_STRING ('S' ,"symbols" , &symbol_conf.sym_list_str,"symbol[,symbol...]" ,"only consider these symbols" ), +OPT_STRING (0 ,"symbol-filter" , &report.symbol_filter_str,"filter" , +"only show symbols that (partially) match with this filter" ),OPT_STRING ('w' ,"column-widths" , &symbol_conf.col_width_list_str,"width[,width...]" , "don't try to adjust column width, use these fixed values"),
@@ -624,6 +636,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __used) use_browser =0 ; else if (report.use_tui) use_browser =1 ; + else if (report.use_gtk) + use_browser =2 ;if (report.inverted_callchain) callchain_param.order =ORDER_CALLER ;
@@ -660,7 +674,10 @@ int cmd_report(int argc, const char **argv, const char *prefix __used) }if (strcmp (report.input_name,"-" ) !=0 ) { -setup_browser (true); +if (report.use_gtk) +perf_gtk_setup_browser (argc, argv, true); +else +setup_browser (true); }else { use_browser =0 ; }
@@ -709,11 +726,16 @@ int cmd_report(int argc, const char **argv, const char *prefix __used) }else symbol_conf.exclude_other = false; -/* -* Any (unrecognized) arguments left? -*/ -if (argc) -usage_with_options (report_usage, options); +if (argc) { +/* +* Special case: if there's an argument left then assume that +* it's a symbol filter: +*/ +if (argc >1 ) +usage_with_options (report_usage, options); + + report.symbol_filter_str = argv[0 ]; + }sort_entry__setup_elide (&sort_comm, symbol_conf.comm_list,"comm" , stdout);
tools/perf/builtin-stat.c +1 -1
@@ -296,7 +296,7 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,if (system_wide)return perf_evsel__open_per_cpu (evsel, evsel_list->cpus, group, group_fd); -if (!target_pid && !target_tid) { +if (!target_pid && !target_tid && (!group || evsel == first)) { attr->disabled =1 ; attr->enable_on_exec =1 ; }
tools/perf/builtin-test.c +169 -5
242 lines not on this page · raw message
tools/perf/config/feature-tests.mak +15 -0
@@ -65,6 +65,21 @@ int main(void) endef endif +ifndef NO_GTK2 +define SOURCE_GTK2 +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#include <gtk/gtk.h> +#pragma GCC diagnostic error \"-Wstrict-prototypes\" + +int main(int argc, char *argv[]) +{ + gtk_init(&argc, &argv); + + return 0; +} +endef +endif + ifndef NO_LIBPERL define SOURCE_PERL_EMBED #include <EXTERN.h>
tools/perf/util/annotate.c +4 -4
@@ -28,8 +28,8 @@ int symbol__annotate_init(struct map *map __used, struct symbol *sym)int symbol__alloc_hist (struct symbol *sym) {struct annotation *notes =symbol__annotation (sym); -size_t sizeof_sym_hist = (sizeof (struct sym_hist ) + - (sym->end - sym->start) *sizeof (u64)); +const size_t size = sym->end - sym->start +1 ; +size_t sizeof_sym_hist = (sizeof (struct sym_hist ) + size *sizeof (u64)); notes->src =zalloc (sizeof (*notes->src) + symbol_conf.nr_events * sizeof_sym_hist);if (notes->src ==NULL )
@@ -64,7 +64,7 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map,pr_debug3 ("%s: addr=%#" PRIx64"\n" , __func__, map->unmap_ip (map, addr)); -if (addr >= sym->end) +if (addr > sym->end)return 0 ; offset = addr - sym->start;
@@ -408,7 +408,7 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map,if (!notes->src->lines)return -1 ; - start = map->unmap_ip (map, sym->start); + start =map__rip_2objdump (map, sym->start);for (i =0 ; i < len; i++) {char *path =NULL ;
tools/perf/util/cache.h +12 -0
@@ -45,6 +45,18 @@ void setup_browser(bool fallback_to_pager);void exit_browser (bool wait_for_ok);#endif +#ifdef NO_GTK2_SUPPORT +static inline void perf_gtk_setup_browser (int argc__used ,const char *argv[]__used ,bool fallback_to_pager) +{ +if (fallback_to_pager) +setup_pager (); +} +static inline void perf_gtk_exit_browser (bool wait_for_ok__used ) {} +#else +void perf_gtk_setup_browser (int argc,const char *argv[],bool fallback_to_pager); +void perf_gtk_exit_browser (bool wait_for_ok); +#endif +char *alias_lookup (const char *alias);int split_cmdline (char *cmdline,const char ***argv);
tools/perf/util/evlist.c +4 -2
@@ -51,13 +51,15 @@ struct perf_evlist *perf_evlist__new(struct cpu_map *cpus,void perf_evlist__config_attrs (struct perf_evlist *evlist,struct perf_record_opts *opts) { -struct perf_evsel *evsel; +struct perf_evsel *evsel, *first;if (evlist->cpus->map[0 ] <0 ) opts->no_inherit = true; + first = list_entry(evlist->entries.next, struct perf_evsel, node); +list_for_each_entry (evsel, &evlist->entries, node) { -perf_evsel__config (evsel, opts); +perf_evsel__config (evsel, opts, first);if (evlist->nr_entries >1 ) evsel->attr.sample_type |=PERF_SAMPLE_ID ;
tools/perf/util/evsel.c +7 -3
@@ -34,7 +34,7 @@ int __perf_evsel__sample_size(u64 sample_type)return size; } -static void hists__init (struct hists *hists) +void hists__init (struct hists *hists) {memset (hists,0 ,sizeof (*hists)); hists->entries_in_array[0 ] = hists->entries_in_array[1 ] =RB_ROOT ;
@@ -63,7 +63,8 @@ struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr, int idx)return evsel; } -void perf_evsel__config (struct perf_evsel *evsel,struct perf_record_opts *opts) +void perf_evsel__config (struct perf_evsel *evsel,struct perf_record_opts *opts, +struct perf_evsel *first) {struct perf_event_attr *attr = &evsel->attr;int track = !evsel->idx;/* only the first counter needs these */
@@ -134,7 +135,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts) attr->mmap = track; attr->comm = track; -if (!opts->target_pid && !opts->target_tid && !opts->system_wide) { +if (!opts->target_pid && !opts->target_tid && !opts->system_wide && + (!opts->group || evsel == first)) { attr->disabled =1 ; attr->enable_on_exec =1 ; }
@@ -578,6 +580,8 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,return -EFAULT ; data->raw_data = (void *) pdata; + + array = (void *)array + data->raw_size +sizeof (u32); }if (type &PERF_SAMPLE_BRANCH_STACK ) {
tools/perf/util/evsel.h +4 -1
@@ -80,7 +80,8 @@ void perf_evsel__exit(struct perf_evsel *evsel);void perf_evsel__delete (struct perf_evsel *evsel);void perf_evsel__config (struct perf_evsel *evsel, -struct perf_record_opts *opts); +struct perf_record_opts *opts, +struct perf_evsel *first);int perf_evsel__alloc_fd (struct perf_evsel *evsel,int ncpus,int nthreads);int perf_evsel__alloc_id (struct perf_evsel *evsel,int ncpus,int nthreads);
@@ -169,4 +170,6 @@ static inline int perf_evsel__sample_size(struct perf_evsel *evsel) return __perf_evsel__sample_size(evsel->attr.sample_type); } +void hists__init (struct hists *hists); +#endif /* __PERF_EVSEL_H */
tools/perf/util/gtk/browser.c new file +189 -0
189 lines not on this page · raw message
tools/perf/util/gtk/gtk.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef _PERF_GTK_H_ +#define _PERF_GTK_H_ 1 + +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#include <gtk/gtk.h> +#pragma GCC diagnostic error "-Wstrict-prototypes" + +#endif /* _PERF_GTK_H_ */
tools/perf/util/header.c +1 -1
@@ -1177,7 +1177,7 @@ static void print_event_desc(struct perf_header *ph, int fd, FILE *fp) goto error; msz =sizeof (attr); -if (sz < (ssize_t )msz) +if (sz < msz) msz = sz;for (i =0 ; i < nre; i++) {
tools/perf/util/hist.c +132 -68
324 lines not on this page · raw message
tools/perf/util/hist.h +19 -0
@@ -62,6 +62,7 @@ struct hists {const struct thread *thread_filter;const struct dso *dso_filter;const char *uid_filter_str; +const char *symbol_filter_str;pthread_mutex_t lock;struct events_stats stats;u64 event_stream;
@@ -107,6 +108,7 @@ int hist_entry__annotate(struct hist_entry *self, size_t privsize);void hists__filter_by_dso (struct hists *hists);void hists__filter_by_thread (struct hists *hists); +void hists__filter_by_symbol (struct hists *hists);u16 hists__col_len (struct hists *self,enum hist_column col);void hists__set_col_len (struct hists *self,enum hist_column col,u16 len);
@@ -145,6 +147,23 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, int refresh);#endif +#ifdef NO_GTK2_SUPPORT +static inline +int perf_evlist__gtk_browse_hists (struct perf_evlist *evlist__used , +const char *help__used , +void (*timer)(void *arg)__used , +void *arg__used , +int refresh__used ) +{ +return 0 ; +} + +#else +int perf_evlist__gtk_browse_hists (struct perf_evlist *evlist,const char *help, +void (*timer)(void *arg),void *arg, +int refresh); +#endif +unsigned int hists__sort_list_width (struct hists *self);#endif /* __PERF_HIST_H */
tools/perf/util/include/linux/export.h renamed from tools/perf/util/include/linux/module.h +0 -0
tools/perf/util/parse-events.c +275 -328
801 lines not on this page · raw message
tools/perf/util/parse-events.h +49 -0
46 lines not on this page · raw message
tools/perf/util/parse-events.l new file +127 -0
127 lines not on this page · raw message
tools/perf/util/parse-events.y new file +229 -0
229 lines not on this page · raw message
tools/perf/util/pmu.c new file +469 -0
469 lines not on this page · raw message
tools/perf/util/pmu.h new file +41 -0
41 lines not on this page · raw message
tools/perf/util/pmu.l new file +43 -0
43 lines not on this page · raw message
tools/perf/util/pmu.y new file +93 -0
93 lines not on this page · raw message
tools/perf/util/ui/util.c +82 -0
82 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.