perf/core improvements
Arnaldo Carvalho de Melo
maintainerHi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit 0b22cd276cec21107d9d69453fa58abba73e71df:
Merge tag 'perf-core-for-mingo-20160414' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-04-14 15:30:59 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-20160415
for you to fetch changes up to f3e459d16a8493b617ccf2a940330279679e0291:
perf trace: Bump --mmap-pages when --call-graph is used by the root user (2016-04-15 17:52:34 -0300)
----------------------------------------------------------------
perf/core improvements:
User visible:
- Wire the callchain unwinding "max-stack" know to 'perf script --max-stack', allowing to limit the depth of callchains, possibly reducing processing time (Arnaldo Carvalho de Melo)
- Ditto for 'perf trace --max-stack' (Arnaldo Carvalho de Melo)
- Introduce a --min-stack filter for 'perf trace', to show syscalls that
had a userspace callchain leading to it at least min-stack deep (Arnaldo Carvalho de Melo)
- Make 'perf trace' work with multiple threads and the --duration filter, i.e. do not print the start of an interrupted syscall followed by ... to print interrupts from other threads, as we need to wait the sys_exit syscall tracepoint to calculate the duration, duh. (Arnaldo Carvalho de Melo)
System wide --duration now works as expected:
[root@jouet ~]# trace --duration 100
152.393 (145.147 ms): Timer/24358 futex(uaddr: 0x7f5ed98e56cc, op: WAIT_BITSET|PRIV|CLKRT, val: 7055125, utime: 0x7f5ecdbfec30, val3: 4294967295) = -1 ETIMEDOUT Connection timed out
152.438 (145.040 ms): firefox/24321 poll(ufds: 0x7f5ec388b460, nfds: 6, timeout_msecs: 4294967295) = 1
358.580 (158.279 ms): Xorg/2025 select(n: 512, inp: 0x83a8e0, tvp: 0x7ffdcbb63610) = 0 Timeout
358.687 (148.285 ms): gnome-terminal/2711 poll(ufds: 0x55b7e6811ad0, nfds: 15, timeout_msecs: 249) = 1
370.150 (169.569 ms): gnome-shell/2287 poll(ufds: 0x55e623d65490, nfds: 86, timeout_msecs: 4294967295) = 1- Now 'perf trace's --max-stack and --min-stack will automatically set "--call-graph dwarf", if --call-graph is not present on the command line:
[root@jouet ~]# perf trace -e nanosleep --max-stack 3 usleep 1
0.299 ( 0.057 ms): usleep/29658 nanosleep(rqtp: 0x7fff80f3b230) = 0
__nanosleep+0x10 (/usr/lib64/libc-2.22.so)
usleep+0x34 (/usr/lib64/libc-2.22.so)
main+0x1eb (/usr/bin/usleep)
[root@jouet ~]#- Bump 'perf trace --mmap-pages' for root when using callchains and not specifying --mmap-pages explicitely (Arnaldo Carvalho de Melo)
Build fixes:
- The python binding object had missing symbols, to some refactoring to fix that (Arnaldo Carvalho de Melo)
----------------------------------------------------------------
Arnaldo Carvalho de Melo (15):
perf trace: Move socket_type beautifier to tools/perf/trace/beauty/ perf callchain: Start moving away from global per thread cursors
perf evsel: Remove symbol_conf usage
perf symbols: Move fprintf routines to separate object file
perf evsel: Require that callchains be resolved before calling fprintf_{sym,callchain} perf tools: Remove addr_location argument to sample__fprintf_callchain perf script: Add --max-stack knob
perf trace: Add --max-stack knob
perf evsel: Move fprintf methods to separate source file
perf trace: Do not print interrupted syscalls when using --duration perf trace: Introduce --min-stack filter
perf record: Export record_opts based callchain parsing helper
perf trace: Make --(min,max}-stack imply "--call-graph dwarf"
perf evlist: Expose perf_event_mlock_kb_in_pages() helper
perf trace: Bump --mmap-pages when --call-graph is used by the root user
tools/perf/Documentation/perf-script.txt | 10 + tools/perf/Documentation/perf-trace.txt | 23 +++ tools/perf/builtin-kmem.c | 2 +- tools/perf/builtin-record.c | 35 ++-- tools/perf/builtin-script.c | 39 ++-- tools/perf/builtin-trace.c | 144 +++++++------- tools/perf/trace/beauty/socket_type.c | 60 ++++++ tools/perf/util/Build | 2 + tools/perf/util/callchain.c | 5 +- tools/perf/util/callchain.h | 9 +- tools/perf/util/evlist.c | 42 ++-- tools/perf/util/evlist.h | 2 + tools/perf/util/evsel.c | 220 --------------------- tools/perf/util/evsel.h | 19 +- tools/perf/util/evsel_fprintf.c | 212 ++++++++++++++++++++ tools/perf/util/hist.c | 2 +- tools/perf/util/machine.c | 26 +-- tools/perf/util/machine.h | 4 + tools/perf/util/python-ext-sources | 1 + .../perf/util/scripting-engines/trace-event-perl.c | 2 +- .../util/scripting-engines/trace-event-python.c | 2 +- tools/perf/util/symbol.c | 71 ------- tools/perf/util/symbol.h | 5 + tools/perf/util/symbol_fprintf.c | 71 +++++++ 24 files changed, 565 insertions(+), 443 deletions(-) create mode 100644 tools/perf/trace/beauty/socket_type.c create mode 100644 tools/perf/util/evsel_fprintf.c create mode 100644 tools/perf/util/symbol_fprintf.c
Arnaldo Carvalho de Melo
maintainerPATCH 1/15 perf trace: Move socket_type beautifier to tools/perf/trace/beauty/
From: Arnaldo Carvalho de Melo <[email protected]>
To reduce the size of builtin-trace.c.
--- tools/perf/builtin-trace.c | 60 +---------------------------------- tools/perf/trace/beauty/socket_type.c | 60 +++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 59 deletions(-) create mode 100644 tools/perf/trace/beauty/socket_type.c
tools/perf/builtin-trace.c +1 -59
@@ -51,18 +51,6 @@# define O_CLOEXEC 02000000#endif -#ifndef SOCK_DCCP -# define SOCK_DCCP 6 -#endif - -#ifndef SOCK_CLOEXEC -# define SOCK_CLOEXEC 02000000 -#endif - -#ifndef SOCK_NONBLOCK -# define SOCK_NONBLOCK 00004000 -#endif -#ifndef MSG_CMSG_CLOEXEC # define MSG_CMSG_CLOEXEC 0x40000000#endif
@@ -538,53 +526,6 @@ static const char *socket_families[] = { };static DEFINE_STRARRAY (socket_families); -#ifndef SOCK_TYPE_MASK -#define SOCK_TYPE_MASK 0xf -#endif - -static size_t syscall_arg__scnprintf_socket_type (char *bf,size_t size, -struct syscall_arg *arg) -{ -size_t printed; -int type = arg->val, - flags = type & ~SOCK_TYPE_MASK ; - - type &=SOCK_TYPE_MASK ; -/* -* Can't use a strarray, MIPS may override for ABI reasons. -*/ -switch (type) { -#define P_SK_TYPE (n) case SOCK_##n: printed = scnprintf(bf, size, #n); break; -P_SK_TYPE (STREAM ); -P_SK_TYPE (DGRAM ); -P_SK_TYPE (RAW ); -P_SK_TYPE (RDM ); -P_SK_TYPE (SEQPACKET ); -P_SK_TYPE (DCCP ); -P_SK_TYPE (PACKET ); -#undef P_SK_TYPE -default : - printed =scnprintf (bf, size,"%#x" , type); - } - -#define P_SK_FLAG (n) \ - if (flags & SOCK_##n) { \ - printed += scnprintf(bf + printed, size - printed, "|%s", #n); \ - flags &= ~SOCK_##n; \ - } - -P_SK_FLAG (CLOEXEC ); -P_SK_FLAG (NONBLOCK ); -#undef P_SK_FLAG - -if (flags) - printed +=scnprintf (bf + printed, size - printed,"|%#x" , flags); - -return printed; -} - -#define SCA_SK_TYPE syscall_arg__scnprintf_socket_type -#ifndef MSG_PROBE #define MSG_PROBE 0x10#endif
@@ -951,6 +892,7 @@ static size_t syscall_arg__scnprintf_getrandom_flags(char *bf, size_t size,#include "trace/beauty/mmap.c" #include "trace/beauty/mode_t.c" #include "trace/beauty/sched_policy.c" +#include "trace/beauty/socket_type.c" #include "trace/beauty/waitid_options.c" static struct syscall_fmt {
tools/perf/trace/beauty/socket_type.c new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 2/15 perf callchain: Start moving away from global per thread cursors
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The recent perf_evsel__fprintf_callchain() move to evsel.c added several new symbol requirements to the python binding, for instance:
# perf test -v python
16: Try 'import perf' in python, checking link problems :
--- start ---
test child forked, pid 18030
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /tmp/build/perf/python/perf.so: undefined symbol:
callchain_cursor
test child finished with -1
---- end ----
Try 'import perf' in python, checking link problems: FAILED!
#This would require linking against callchain.c to access to the global callchain_cursor variables.
Since lots of functions already receive as a parameter a callchain_cursor struct pointer, make that be the case for some more function so that we can start phasing out usage of yet another global variable.
--- tools/perf/builtin-kmem.c | 2 +- tools/perf/util/callchain.c | 5 +++-- tools/perf/util/callchain.h | 3 ++- tools/perf/util/evsel.c | 9 ++++---- tools/perf/util/hist.c | 2 +- tools/perf/util/machine.c | 26 +++++++++++++--------- tools/perf/util/machine.h | 4 ++++ .../perf/util/scripting-engines/trace-event-perl.c | 2 +- .../util/scripting-engines/trace-event-python.c | 2 +- 9 files changed, 33 insertions(+), 22 deletions(-)
tools/perf/builtin-kmem.c +1 -1
@@ -375,7 +375,7 @@ static u64 find_callsite(struct perf_evsel *evsel, struct perf_sample *sample) } al.thread =machine__findnew_thread (machine, sample->pid, sample->tid); -sample__resolve_callchain (sample,NULL , evsel, &al,16 ); +sample__resolve_callchain (sample, &callchain_cursor,NULL , evsel, &al,16 );callchain_cursor_commit (&callchain_cursor);while (true) {
tools/perf/util/callchain.c +3 -2
@@ -788,7 +788,8 @@ int callchain_cursor_append(struct callchain_cursor *cursor,return 0 ; } -int sample__resolve_callchain (struct perf_sample *sample,struct symbol **parent, +int sample__resolve_callchain (struct perf_sample *sample, +struct callchain_cursor *cursor,struct symbol **parent,struct perf_evsel *evsel,struct addr_location *al,int max_stack) {
@@ -797,7 +798,7 @@ int sample__resolve_callchain(struct perf_sample *sample, struct symbol **parentif (symbol_conf.use_callchain || symbol_conf.cumulate_callchain || sort__has_parent) { -return thread__resolve_callchain (al->thread, evsel, sample, +return thread__resolve_callchain (al->thread, cursor, evsel, sample, parent, al, max_stack); }return 0 ;
tools/perf/util/callchain.h +2 -1
@@ -212,7 +212,8 @@ struct hist_entry;int record_parse_callchain_opt (const struct option *opt,const char *arg,int unset);int record_callchain_opt (const struct option *opt,const char *arg,int unset); -int sample__resolve_callchain (struct perf_sample *sample,struct symbol **parent, +int sample__resolve_callchain (struct perf_sample *sample, +struct callchain_cursor *cursor,struct symbol **parent,struct perf_evsel *evsel,struct addr_location *al,int max_stack);int hist_entry__append_callchain (struct hist_entry *he,struct perf_sample *sample);
tools/perf/util/evsel.c +5 -4
@@ -2349,6 +2349,7 @@ int perf_evsel__fprintf_callchain(struct perf_evsel *evsel, struct perf_sample * FILE *fp) {int printed =0 ; +struct callchain_cursor cursor;struct callchain_cursor_node *node;int print_ip = print_opts &EVSEL__PRINT_IP ;int print_sym = print_opts &EVSEL__PRINT_SYM ;
@@ -2362,14 +2363,14 @@ int perf_evsel__fprintf_callchain(struct perf_evsel *evsel, struct perf_sample *if (sample->callchain) {struct addr_location node_al; -if (thread__resolve_callchain (al->thread, evsel, +if (thread__resolve_callchain (al->thread, &cursor, evsel, sample,NULL ,NULL , stack_depth) !=0 ) {if (verbose)error ("Failed to resolve callchain. Skipping\n" );return printed; } -callchain_cursor_commit (&callchain_cursor); +callchain_cursor_commit (&cursor);if (print_symoffset) node_al = *al;
@@ -2377,7 +2378,7 @@ int perf_evsel__fprintf_callchain(struct perf_evsel *evsel, struct perf_sample *while (stack_depth) {u64 addr =0 ; - node =callchain_cursor_current (&callchain_cursor); + node =callchain_cursor_current (&cursor);if (!node)break ;
@@ -2420,7 +2421,7 @@ int perf_evsel__fprintf_callchain(struct perf_evsel *evsel, struct perf_sample * stack_depth--; next: -callchain_cursor_advance (&callchain_cursor); +callchain_cursor_advance (&cursor); } }
tools/perf/util/hist.c +1 -1
@@ -953,7 +953,7 @@ int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al, {int err, err2; - err =sample__resolve_callchain (iter->sample, &iter->parent, + err =sample__resolve_callchain (iter->sample, &callchain_cursor, &iter->parent, iter->evsel, al, max_stack_depth);if (err)return err;
tools/perf/util/machine.c +15 -11
@@ -1599,6 +1599,7 @@ struct mem_info *sample__resolve_mem(struct perf_sample *sample, } static int add_callchain_ip(struct thread *thread, + struct callchain_cursor *cursor, struct symbol **parent, struct addr_location *root_al, u8 *cpumode,
@@ -1630,7 +1631,7 @@ static int add_callchain_ip(struct thread *thread,* It seems the callchain is corrupted. * Discard all. */ -callchain_cursor_reset (&callchain_cursor); +callchain_cursor_reset (cursor);return 1 ; }return 0 ;
@@ -1648,13 +1649,13 @@ static int add_callchain_ip(struct thread *thread,/* Treat this symbol as the root, forgetting its callees. */ *root_al = al; -callchain_cursor_reset (&callchain_cursor); +callchain_cursor_reset (cursor); } }if (symbol_conf.hide_unresolved && al.sym ==NULL )return 0 ; -return callchain_cursor_append (&callchain_cursor, al.addr, al.map, al.sym); +return callchain_cursor_append (cursor, al.addr, al.map, al.sym); } struct branch_info *sample__resolve_bstack(struct perf_sample *sample,
@@ -1724,6 +1725,7 @@ static int remove_loops(struct branch_entry *l, int nr)* negative error code on other errors. */ static int resolve_lbr_callchain_sample(struct thread *thread, + struct callchain_cursor *cursor, struct perf_sample *sample, struct symbol **parent, struct addr_location *root_al,
@@ -1778,7 +1780,7 @@ static int resolve_lbr_callchain_sample(struct thread *thread, ip = lbr_stack->entries[0 ].to; } - err =add_callchain_ip (thread, parent, root_al, &cpumode, ip); + err =add_callchain_ip (thread, cursor, parent, root_al, &cpumode, ip);if (err)return (err <0 ) ? err :0 ; }
@@ -1789,6 +1791,7 @@ static int resolve_lbr_callchain_sample(struct thread *thread, } static int thread__resolve_callchain_sample(struct thread *thread, + struct callchain_cursor *cursor, struct perf_evsel *evsel, struct perf_sample *sample, struct symbol **parent,
@@ -1803,10 +1806,10 @@ static int thread__resolve_callchain_sample(struct thread *thread,int skip_idx =-1 ;int first_call =0 ; -callchain_cursor_reset (&callchain_cursor); +callchain_cursor_reset (cursor);if (has_branch_callstack (evsel)) { - err =resolve_lbr_callchain_sample (thread, sample, parent, + err =resolve_lbr_callchain_sample (thread, cursor, sample, parent, root_al, max_stack);if (err)return (err <0 ) ? err :0 ;
@@ -1863,10 +1866,10 @@ static int thread__resolve_callchain_sample(struct thread *thread, nr =remove_loops (be, nr);for (i =0 ; i < nr; i++) { - err =add_callchain_ip (thread, parent, root_al, + err =add_callchain_ip (thread, cursor, parent, root_al,NULL , be[i].to);if (!err) - err =add_callchain_ip (thread, parent, root_al, + err =add_callchain_ip (thread, cursor, parent, root_al,NULL , be[i].from);if (err == -EINVAL )break ;
@@ -1896,7 +1899,7 @@ check_calls:#endif ip = chain->ips[j]; - err =add_callchain_ip (thread, parent, root_al, &cpumode, ip); + err =add_callchain_ip (thread, cursor, parent, root_al, &cpumode, ip);if (err)return (err <0 ) ? err :0 ;
@@ -1916,13 +1919,14 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) }int thread__resolve_callchain (struct thread *thread, +struct callchain_cursor *cursor,struct perf_evsel *evsel,struct perf_sample *sample,struct symbol **parent,struct addr_location *root_al,int max_stack) { -int ret =thread__resolve_callchain_sample (thread, evsel, +int ret =thread__resolve_callchain_sample (thread, cursor, evsel, sample, parent, root_al, max_stack);if (ret)
@@ -1938,7 +1942,7 @@ int thread__resolve_callchain(struct thread *thread, (!sample->user_stack.size))return 0 ; -return unwind__get_entries (unwind_entry, &callchain_cursor, +return unwind__get_entries (unwind_entry, cursor, thread, sample, max_stack); }
tools/perf/util/machine.h +4 -0
@@ -141,7 +141,11 @@ struct branch_info *sample__resolve_bstack(struct perf_sample *sample, struct addr_location *al);struct mem_info *sample__resolve_mem (struct perf_sample *sample,struct addr_location *al); + +struct callchain_cursor ; + int thread__resolve_callchain(struct thread *thread, + struct callchain_cursor *cursor, struct perf_evsel *evsel, struct perf_sample *sample, struct symbol **parent,
tools/perf/util/scripting-engines/trace-event-perl.c +1 -1
@@ -263,7 +263,7 @@ static SV *perl_process_callchain(struct perf_sample *sample,if (!symbol_conf.use_callchain || !sample->callchain) goto exit; -if (thread__resolve_callchain (al->thread, evsel, +if (thread__resolve_callchain (al->thread, &callchain_cursor, evsel, sample,NULL ,NULL ,PERF_MAX_STACK_DEPTH ) !=0 ) {pr_err ("Failed to resolve callchain. Skipping\n" );
tools/perf/util/scripting-engines/trace-event-python.c +1 -1
@@ -323,7 +323,7 @@ static PyObject *python_process_callchain(struct perf_sample *sample,if (!symbol_conf.use_callchain || !sample->callchain) goto exit; -if (thread__resolve_callchain (al->thread, evsel, +if (thread__resolve_callchain (al->thread, &callchain_cursor, evsel, sample,NULL ,NULL , scripting_max_stack) !=0 ) {pr_err ("Failed to resolve callchain. Skipping\n" );
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 3/15 perf evsel: Remove symbol_conf usage
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
# perf test -v python
16: Try 'import perf' in python, checking link problems :
--- start ---
test child forked, pid 672
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /tmp/build/perf/python/perf.so: undefined symbol:
symbol_conf
test child finished with -1
---- end ----
Try 'import perf' in python, checking link problems: FAILED!
#To fix it just pass a parameter to perf_evsel__fprintf_sym telling if callchains should be printed.
--- tools/perf/builtin-script.c | 2 ++ tools/perf/util/evsel.c | 6 +++--- tools/perf/util/evsel.h | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-)
tools/perf/builtin-script.c +2 -0
@@ -580,6 +580,7 @@ static void print_sample_bts(struct perf_sample *sample, } }perf_evsel__fprintf_sym (evsel, sample, al,0 , print_opts, + symbol_conf.use_callchain, scripting_max_stack, stdout); }
@@ -790,6 +791,7 @@ static void process_event(struct perf_script *script,perf_evsel__fprintf_sym (evsel, sample, al,0 , output[attr->type].print_ip_opts, + symbol_conf.use_callchain, scripting_max_stack, stdout); }
tools/perf/util/evsel.c +3 -3
@@ -2430,8 +2430,8 @@ next:int perf_evsel__fprintf_sym (struct perf_evsel *evsel,struct perf_sample *sample,struct addr_location *al,int left_alignment, -unsigned int print_opts,unsigned int stack_depth, -FILE *fp) +unsigned int print_opts,bool print_callchain, +unsigned int stack_depth,FILE *fp) {int printed =0 ;int print_ip = print_opts &EVSEL__PRINT_IP ;
@@ -2441,7 +2441,7 @@ int perf_evsel__fprintf_sym(struct perf_evsel *evsel, struct perf_sample *sampleint print_srcline = print_opts &EVSEL__PRINT_SRCLINE ;int print_unknown_as_addr = print_opts &EVSEL__PRINT_UNKNOWN_AS_ADDR ; -if (symbol_conf.use_callchain && sample->callchain) { +if (print_callchain && sample->callchain) { printed +=perf_evsel__fprintf_callchain (evsel, sample, al, left_alignment, print_opts, stack_depth, fp); }else if (!(al->sym && al->sym->ignore)) {
tools/perf/util/evsel.h +2 -2
@@ -403,8 +403,8 @@ int perf_evsel__fprintf_callchain(struct perf_evsel *evsel,int perf_evsel__fprintf_sym (struct perf_evsel *evsel,struct perf_sample *sample,struct addr_location *al,int left_alignment, -unsigned int print_opts,unsigned int stack_depth, -FILE *fp); +unsigned int print_opts,bool print_callchain, +unsigned int stack_depth,FILE *fp);bool perf_evsel__fallback (struct perf_evsel *evsel,int err,char *msg,size_t msgsize);
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 4/15 perf symbols: Move fprintf routines to separate object file
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To disentangle symbol printing from all the code related to symbol tables, resolution of addresses to symbols, etc.
--- tools/perf/util/Build | 1 + tools/perf/util/python-ext-sources | 1 + tools/perf/util/symbol.c | 71 -------------------------------------- tools/perf/util/symbol.h | 5 +++ tools/perf/util/symbol_fprintf.c | 71 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 78 insertions(+), 71 deletions(-) create mode 100644 tools/perf/util/symbol_fprintf.c
tools/perf/util/Build +1 -0
@@ -29,6 +29,7 @@ libperf-y += usage.o libperf-y += wrapper.o libperf-y += dso.o libperf-y += symbol.o +libperf-y += symbol_fprintf.o libperf-y += color.o libperf-y += header.o libperf-y += callchain.o
tools/perf/util/python-ext-sources +1 -0
@@ -23,3 +23,4 @@ util/strlist.c util/trace-event.c ../lib/rbtree.c util/string.c +util/symbol_fprintf.c
tools/perf/util/symbol.c +0 -71
89 lines not on this page · raw message
tools/perf/util/symbol.h +5 -0
@@ -140,6 +140,11 @@ struct symbol_conf {extern struct symbol_conf symbol_conf; +struct symbol_name_rb_node { +struct rb_node rb_node; +struct symbol sym; +}; +static inline int __symbol__join_symfs (char *bf,size_t size,const char *path) {return path__join (bf, size, symbol_conf.symfs, path);
tools/perf/util/symbol_fprintf.c new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 5/15 perf evsel: Require that callchains be resolved before calling fprintf_{sym,callchain}
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
This way the print routine merely does printing, not requiring access to the resolving machinery, which helps disentangling the object files and easing creating subsets with a limited functionality set.
--- tools/perf/builtin-script.c | 36 ++++++++++++++++++++---------------- tools/perf/builtin-trace.c | 8 +++++--- tools/perf/util/evsel.c | 39 ++++++++++++++------------------------- tools/perf/util/evsel.h | 19 +++++++++---------- 4 files changed, 48 insertions(+), 54 deletions(-)
tools/perf/builtin-script.c +20 -16
@@ -569,19 +569,23 @@ static void print_sample_bts(struct perf_sample *sample,/* print branch_from information */ if (PRINT_FIELD (IP )) {unsigned int print_opts = output[attr->type].print_ip_opts; +struct callchain_cursor *cursor =NULL , cursor_callchain; -if (symbol_conf.use_callchain && sample->callchain) { -printf ("\n" ); - }else { -printf (" " ); +if (symbol_conf.use_callchain && sample->callchain && +thread__resolve_callchain (al->thread, &cursor_callchain, evsel, + sample,NULL ,NULL , scripting_max_stack) ==0 ) + cursor = &cursor_callchain; + +if (cursor ==NULL ) { +putchar (' ' );if (print_opts &EVSEL__PRINT_SRCLINE ) { print_srcline_last = true; print_opts &= ~EVSEL__PRINT_SRCLINE ; } - } -perf_evsel__fprintf_sym (evsel, sample, al,0 , print_opts, - symbol_conf.use_callchain, - scripting_max_stack, stdout); + }else +putchar ('\n' ); + +sample__fprintf_sym (sample, al,0 , print_opts, cursor, stdout); }/* print branch_to information */
@@ -784,15 +788,15 @@ static void process_event(struct perf_script *script,printf ("%16" PRIu64, sample->weight);if (PRINT_FIELD (IP )) { -if (!symbol_conf.use_callchain) -printf (" " ); -else -printf ("\n" ); +struct callchain_cursor *cursor =NULL , cursor_callchain; + +if (symbol_conf.use_callchain && +thread__resolve_callchain (al->thread, &cursor_callchain, evsel, + sample,NULL ,NULL , scripting_max_stack) ==0 ) + cursor = &cursor_callchain; -perf_evsel__fprintf_sym (evsel, sample, al,0 , - output[attr->type].print_ip_opts, - symbol_conf.use_callchain, - scripting_max_stack, stdout); +putchar (cursor ?'\n' :' ' ); +sample__fprintf_sym (sample, al,0 , output[attr->type].print_ip_opts, cursor, stdout); }if (PRINT_FIELD (IREGS ))
tools/perf/builtin-trace.c +5 -3
@@ -1890,14 +1890,16 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_evsel *evseif (sample->callchain ==NULL )return 0 ; -if (machine__resolve (trace->host, &al, sample) <0 ) { +if (machine__resolve (trace->host, &al, sample) <0 || +thread__resolve_callchain (al.thread, &callchain_cursor, evsel, + sample,NULL ,NULL , scripting_max_stack)) {pr_err ("Problem processing %s callchain, skipping...\n" ,perf_evsel__name (evsel));return 0 ; } -return perf_evsel__fprintf_callchain (evsel, sample, &al,38 , print_opts, - scripting_max_stack, trace->output); +return sample__fprintf_callchain (sample, &al,38 , print_opts, + &callchain_cursor, trace->output); } static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
tools/perf/util/evsel.c +14 -25
@@ -2343,13 +2343,12 @@ out:return ++printed; } -int perf_evsel__fprintf_callchain (struct perf_evsel *evsel,struct perf_sample *sample, -struct addr_location *al,int left_alignment, -unsigned int print_opts,unsigned int stack_depth, -FILE *fp) +int sample__fprintf_callchain (struct perf_sample *sample, +struct addr_location *al,int left_alignment, +unsigned int print_opts,struct callchain_cursor *cursor, +FILE *fp) {int printed =0 ; -struct callchain_cursor cursor;struct callchain_cursor_node *node;int print_ip = print_opts &EVSEL__PRINT_IP ;int print_sym = print_opts &EVSEL__PRINT_SYM ;
@@ -2363,22 +2362,15 @@ int perf_evsel__fprintf_callchain(struct perf_evsel *evsel, struct perf_sample *if (sample->callchain) {struct addr_location node_al; -if (thread__resolve_callchain (al->thread, &cursor, evsel, - sample,NULL ,NULL , - stack_depth) !=0 ) { -if (verbose) -error ("Failed to resolve callchain. Skipping\n" ); -return printed; - } -callchain_cursor_commit (&cursor); +callchain_cursor_commit (cursor);if (print_symoffset) node_al = *al; -while (stack_depth) { +while (1 ) {u64 addr =0 ; - node =callchain_cursor_current (&cursor); + node =callchain_cursor_current (cursor);if (!node)break ;
@@ -2418,20 +2410,17 @@ int perf_evsel__fprintf_callchain(struct perf_evsel *evsel, struct perf_sample *if (!print_oneline) printed +=fprintf (fp,"\n" ); - - stack_depth--; next: -callchain_cursor_advance (&cursor); +callchain_cursor_advance (cursor); } }return printed; } -int perf_evsel__fprintf_sym (struct perf_evsel *evsel,struct perf_sample *sample, -struct addr_location *al,int left_alignment, -unsigned int print_opts,bool print_callchain, -unsigned int stack_depth,FILE *fp) +int sample__fprintf_sym (struct perf_sample *sample,struct addr_location *al, +int left_alignment,unsigned int print_opts, +struct callchain_cursor *cursor,FILE *fp) {int printed =0 ;int print_ip = print_opts &EVSEL__PRINT_IP ;
@@ -2441,9 +2430,9 @@ int perf_evsel__fprintf_sym(struct perf_evsel *evsel, struct perf_sample *sampleint print_srcline = print_opts &EVSEL__PRINT_SRCLINE ;int print_unknown_as_addr = print_opts &EVSEL__PRINT_UNKNOWN_AS_ADDR ; -if (print_callchain && sample->callchain) { - printed +=perf_evsel__fprintf_callchain (evsel, sample, al, left_alignment, - print_opts, stack_depth, fp); +if (cursor !=NULL ) { + printed +=sample__fprintf_callchain (sample, al, left_alignment, + print_opts, cursor, fp); }else if (!(al->sym && al->sym->ignore)) { printed +=fprintf (fp,"%-*.*s" , left_alignment, left_alignment," " );
tools/perf/util/evsel.h +9 -10
@@ -395,16 +395,15 @@ int perf_evsel__fprintf(struct perf_evsel *evsel,#define EVSEL__PRINT_SRCLINE (1<<5)#define EVSEL__PRINT_UNKNOWN_AS_ADDR (1<<6) -int perf_evsel__fprintf_callchain (struct perf_evsel *evsel, -struct perf_sample *sample, -struct addr_location *al,int left_alignment, -unsigned int print_opts, -unsigned int stack_depth,FILE *fp); - -int perf_evsel__fprintf_sym (struct perf_evsel *evsel,struct perf_sample *sample, -struct addr_location *al,int left_alignment, -unsigned int print_opts,bool print_callchain, -unsigned int stack_depth,FILE *fp); +struct callchain_cursor ; + +int sample__fprintf_callchain (struct perf_sample *sample,struct addr_location *al, +int left_alignment,unsigned int print_opts, +struct callchain_cursor *cursor,FILE *fp); + +int sample__fprintf_sym (struct perf_sample *sample,struct addr_location *al, +int left_alignment,unsigned int print_opts, +struct callchain_cursor *cursor,FILE *fp);bool perf_evsel__fallback (struct perf_evsel *evsel,int err,char *msg,size_t msgsize);
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 6/15 perf tools: Remove addr_location argument to sample__fprintf_callchain
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Not used at all, nuke it.
--- tools/perf/builtin-trace.c | 3 +-- tools/perf/util/evsel.c | 8 ++------ tools/perf/util/evsel.h | 4 ++-- 3 files changed, 5 insertions(+), 10 deletions(-)
tools/perf/builtin-trace.c +1 -2
@@ -1898,8 +1898,7 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_evsel *evsereturn 0 ; } -return sample__fprintf_callchain (sample, &al,38 , print_opts, - &callchain_cursor, trace->output); +return sample__fprintf_callchain (sample,38 , print_opts, &callchain_cursor, trace->output); } static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
tools/perf/util/evsel.c +2 -6
@@ -2343,8 +2343,7 @@ out:return ++printed; } -int sample__fprintf_callchain (struct perf_sample *sample, -struct addr_location *al,int left_alignment, +int sample__fprintf_callchain (struct perf_sample *sample,int left_alignment,unsigned int print_opts,struct callchain_cursor *cursor,FILE *fp) {
@@ -2364,9 +2363,6 @@ int sample__fprintf_callchain(struct perf_sample *sample,callchain_cursor_commit (cursor); -if (print_symoffset) - node_al = *al; -while (1 ) {u64 addr =0 ;
@@ -2431,7 +2427,7 @@ int sample__fprintf_sym(struct perf_sample *sample, struct addr_location *al,int print_unknown_as_addr = print_opts &EVSEL__PRINT_UNKNOWN_AS_ADDR ;if (cursor !=NULL ) { - printed +=sample__fprintf_callchain (sample, al, left_alignment, + printed +=sample__fprintf_callchain (sample, left_alignment, print_opts, cursor, fp); }else if (!(al->sym && al->sym->ignore)) { printed +=fprintf (fp,"%-*.*s" , left_alignment, left_alignment," " );
tools/perf/util/evsel.h +2 -2
@@ -397,8 +397,8 @@ int perf_evsel__fprintf(struct perf_evsel *evsel,struct callchain_cursor ; -int sample__fprintf_callchain (struct perf_sample *sample,struct addr_location *al, -int left_alignment,unsigned int print_opts, +int sample__fprintf_callchain (struct perf_sample *sample,int left_alignment, +unsigned int print_opts,struct callchain_cursor *cursor,FILE *fp); int sample__fprintf_sym(struct perf_sample *sample, struct addr_location *al,
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 7/15 perf script: Add --max-stack knob
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Works just like with 'perf report'. In some cases we may want to have more than 127 entries, the default maximum.
--- tools/perf/Documentation/perf-script.txt | 10 ++++++++++ tools/perf/builtin-script.c | 5 +++++ 2 files changed, 15 insertions(+)
tools/perf/Documentation/perf-script.txt +10 -0
@@ -259,6 +259,16 @@ include::itrace.txt[] --full-source-path:: Show the full path for source files for srcline output. +--max-stack:: + Set the stack depth limit when parsing the callchain, anything + beyond the specified depth will be ignored. This is a trade-off + between information loss and faster processing especially for + workloads that can have a very long callchain stack. + Note that when using the --itrace option the synthesized callchain size + will override this value if the synthesized callchain size is bigger. + + Default: 127 + --ns:: Use 9 decimal places when displaying time (i.e. show the nanoseconds)
tools/perf/builtin-script.c +5 -0
@@ -22,6 +22,7 @@#include "util/thread_map.h" #include "util/stat.h" #include <linux/bitmap.h> +#include <linux/stringify.h> #include "asm/bug.h" #include "util/mem-events.h"
@@ -2027,6 +2028,10 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) "only consider symbols in these pids"),OPT_STRING (0 ,"tid" , &symbol_conf.tid_list_str,"tid[,tid...]" ,"only consider symbols in these tids" ), +OPT_UINTEGER (0 ,"max-stack" , &scripting_max_stack, +"Set the maximum stack depth when parsing the callchain, " +"anything beyond the specified depth will be ignored. " +"Default: " __stringify(PERF_MAX_STACK_DEPTH )),OPT_BOOLEAN ('I' ,"show-info" , &show_full_info,"display extended information from perf.data file" ), OPT_BOOLEAN('\0', "show-kernel-path", &symbol_conf.show_kernel_path,
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 8/15 perf trace: Add --max-stack knob
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Similar to the one in the other tools (report, script, top).
--- tools/perf/Documentation/perf-trace.txt | 9 +++++++++ tools/perf/builtin-trace.c | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-trace.txt +9 -0
@@ -129,6 +129,15 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs. --event:: Trace other events, see 'perf list' for a complete list. +--max-stack:: + Set the stack depth limit when parsing the callchain, anything + beyond the specified depth will be ignored. Note that at this point + this is just about the presentation part, i.e. the kernel is still + not limiting, the overhead of callchains needs to be set via the + knobs in --call-graph dwarf. + + Default: 127 + --proc-map-timeout:: When processing pre-existing threads /proc/XXX/mmap, it may take a long time, because the file may be huge. A time out is needed in such cases.
tools/perf/builtin-trace.c +8 -1
@@ -46,6 +46,7 @@#include <linux/audit.h> #include <sys/ptrace.h> #include <linux/random.h> +#include <linux/stringify.h> #ifndef O_CLOEXEC # define O_CLOEXEC 02000000
@@ -106,6 +107,7 @@ struct trace {u64 vfs_getname, proc_getname; } stats; +unsigned int max_stack;bool not_ev_qualifier;bool live;bool full_time;
@@ -1892,7 +1894,7 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_evsel *evseif (machine__resolve (trace->host, &al, sample) <0 ||thread__resolve_callchain (al.thread, &callchain_cursor, evsel, - sample,NULL ,NULL , scripting_max_stack)) { + sample,NULL ,NULL , trace->max_stack)) {pr_err ("Problem processing %s callchain, skipping...\n" ,perf_evsel__name (evsel));return 0 ;
@@ -3029,6 +3031,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) .show_comm = true, .trace_syscalls = true, .kernel_syscallchains = false, + .max_stack = PERF_MAX_STACK_DEPTH, };const char *output_name =NULL ;const char *ev_qualifier_str =NULL ;
@@ -3079,6 +3082,10 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) &record_parse_callchain_opt),OPT_BOOLEAN (0 ,"kernel-syscall-graph" , &trace.kernel_syscallchains,"Show the kernel callchains on the syscall exit path" ), +OPT_UINTEGER (0 ,"max-stack" , &trace.max_stack, +"Set the maximum stack depth when parsing the callchain, " +"anything beyond the specified depth will be ignored. " +"Default: " __stringify(PERF_MAX_STACK_DEPTH )),OPT_UINTEGER (0 ,"proc-map-timeout" , &trace.opts.proc_map_timeout,"per thread proc mmap processing timeout in ms" ),OPT_END ()
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 9/15 perf evsel: Move fprintf methods to separate source file
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
They still use functions that would drag more stuff to the python binding, where these fprintf methods are not used, so separate it.
--- tools/perf/util/Build | 1 + tools/perf/util/evsel.c | 206 -------------------------------------- tools/perf/util/evsel_fprintf.c | 212 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 213 insertions(+), 206 deletions(-) create mode 100644 tools/perf/util/evsel_fprintf.c
tools/perf/util/Build +1 -0
@@ -8,6 +8,7 @@ libperf-y += env.o libperf-y += event.o libperf-y += evlist.o libperf-y += evsel.o +libperf-y += evsel_fprintf.o libperf-y += find_bit.o libperf-y += kallsyms.o libperf-y += levenshtein.o
tools/perf/util/evsel.c +0 -206
212 lines not on this page · raw message
tools/perf/util/evsel_fprintf.c new file +212 -0
212 lines not on this page · raw message
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 10/15 perf trace: Do not print interrupted syscalls when using --duration
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
With multiple threads, e.g. a system wide trace session, and one syscall is midway in a thread and another thread starts another syscall we must print the start of the interrupted syscall followed by ..., but that can't be done that way when we use the --duration filter, as we have to wait for the syscall exit to calculate the duration and decide if it should be filtered, so we have to disable the interrupted logic and only print at syscall exit, duh.
Before:
# trace --duration 100 <SNIP> 9.248 (0.023 ms): gnome-shell/2287 poll(ufds: 0x7ffc5ea26580, nfds: 1, timeout_msecs: 4294967295) ... 9.296 (0.001 ms): gnome-shell/2287 recvmsg(fd: 11<socket:[35818]>, msg: 0x7ffc5ea264a0 ) ... 9.311 (0.008 ms): Xorg/2025 select(n: 512, inp: 0x83a8e0, tvp: 0x8316a0 ) ... 9.859 (0.023 ms): gnome-shell/2287 poll(ufds: 0x7ffc5ea24250, nfds: 1, timeout_msecs: 4294967295) ... 9.942 (0.051 ms): Xorg/2025 select(n: 512, inp: 0x83a8e0, tvp: 0x8316a0 ) ... 10.467 (0.003 ms): gnome-shell/2287 poll(ufds: 0x55e623431220, nfds: 50, timeout_msecs: 4294967295) ... 11.136 (0.382 ms): Xorg/2025 select(n: 512, inp: 0x83a8e0, tvp: 0x8316a0 ) ... 11.223 (0.023 ms): SoftwareVsyncT/24369 futex(uaddr: 0x7f5ec5df8c14, op: WAIT_BITSET|PRIV, val: 1, utime: 0x7f5ec5df8b68, val3: 4294967295) ... 16.865 (5.501 ms): firefox/24321 poll(ufds: 0x7f5ec388b460, nfds: 6, timeout_msecs: 4294967295 ) ... 22.571 (0.006 ms): Xorg/2025 select(n: 512, inp: 0x83a8e0, tvp: 0x8316a0 ) ... 26.793 (4.063 ms): gnome-shell/2287 poll(ufds: 0x55e623431220, nfds: 50, timeout_msecs: 4294967295) ... 26.917 (0.080 ms): Xorg/2025 select(n: 512, inp: 0x83a8e0, tvp: 0x8316a0 ) ... 27.291 (0.355 ms): qemu-system-x8/10065 ppoll(ufds: 0x55c98b39e400, nfds: 72, tsp: 0x7fffe4e4fe60, sigsetsize: 8) ... 27.336 (0.012 ms): SoftwareVsyncT/24369 futex(uaddr: 0x7f5ec5df8c14, op: WAIT_BITSET|PRIV, val: 1, utime: 0x7f5ec5df8b68, val3: 4294967295) ... 33.370 (5.958 ms): firefox/24321 poll(ufds: 0x7f5ec388b460, nfds: 6, timeout_msecs: 4294967295) ... 33.866 (0.021 ms): Xorg/2025 select(n: 512, inp: 0x83a8e0, tvp: 0x8316a0 ) ... 35.762 (1.611 ms): gnome-shell/2287 poll(ufds: 0x55e623431220, nfds: 50, timeout_msecs: 8 ) ... 38.765 (2.910 ms): Xorg/2025 select(n: 512, inp: 0x83a8e0, tvp: 0x8316a0 ) ...
After:
# trace --duration 100
238.292 (153.226 ms): hexchat/2786 poll(ufds: 0x559ea372f370, nfds: 6, timeout_msecs: 153) = 0 Timeout
249.634 (199.433 ms): Xorg/2025 select(n: 512, inp: 0x83a8e0, tvp: 0x7ffdcbb63610 ) = 1
385.583 (147.257 ms): hexchat/2786 poll(ufds: 0x559ea372f370, nfds: 6, timeout_msecs: 147) = 0 Timeout 397.166 (110.779 ms): gnome-shell/2287 poll(ufds: 0x55e623431220, nfds: 50, timeout_msecs: 4294967295) = 1
601.839 (132.066 ms): Xorg/2025 select(n: 512, inp: 0x83a8e0, tvp: 0x8316a0 ) = 1
602.445 (132.679 ms): gnome-shell/2287 poll(ufds: 0x55e623431220, nfds: 50, timeout_msecs: 4294967295) = 1 686.122 (300.418 ms): hexchat/2786 poll(ufds: 0x559ea372f370, nfds: 6, timeout_msecs: 300) = 0 Timeout
815.033 (184.641 ms): JS Helper/24352 futex(uaddr: 0x7f5ed98e584c, op: WAIT|PRIV, val: 1149859) = 0 825.868 (195.469 ms): JS Helper/24351 futex(uaddr: 0x7f5ed98e584c, op: WAIT|PRIV, val: 1149860) = 0 840.738 (210.335 ms): JS Helper/24350 futex(uaddr: 0x7f5ed98e584c, op: WAIT|PRIV, val: 1149861) = 0
914.898 (158.692 ms): Compositor/24363 futex(uaddr: 0x7f5ec8dfebf4, op: WAIT|PRIV, val: 1) = 0
915.199 (100.747 ms): Timer/24358 futex(uaddr: 0x7f5ed98e56cc, op: WAIT_BITSET|PRIV|CLKRT, val: 2545397, utime: 0x7f5ecdbfec30, val3: 4294967295) = 0 986.639 (247.325 ms): hexchat/2786 poll(ufds: 0x559ea372f370, nfds: 6, timeout_msecs: 247) = 0 Timeout
996.239 (500.591 ms): chrome/16237 poll(ufds: 0x3ecd739bd0, nfds: 5, timeout_msecs: 500) = 0 Timeout
1042.890 (120.076 ms): Timer/24358 futex(uaddr: 0x7f5ed98e56cc, op: WAIT_BITSET|PRIV|CLKRT, val: 2545403, utime: 0x7f5ecdbfec30, val3: 4294967295) = -1 ETIMEDOUT Connection timed out
--- tools/perf/builtin-trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-trace.c +1 -1
@@ -1849,7 +1849,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, goto out_put; } -if (!trace->summary_only) +if (!(trace->duration_filter || trace->summary_only))trace__printf_interrupted_entry (trace, sample); ttrace->entry_time = sample->time;
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 11/15 perf trace: Introduce --min-stack filter
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Counterpart to --max-stack, to help focusing on deeply nested calls. Can be combined with --duration, etc.
E.g.:
System wide syscall tracing looking for call stacks longer than 66:
# trace --mmap-pages 32768 --filter-pid 2711 --call-graph dwarf,16384 --min-stack 66
Or more compactly:
# trace -m 32768 --filt 2711 --call dwarf,16384 --min-st 66
363.027 ( 0.002 ms): gnome-shell/2287 poll(ufds: 0x7ffc5ea24230, nfds: 1, timeout_msecs: 4294967295 ) = 1
[0xf6fdd] (/usr/lib64/libc-2.22.so)
_xcb_conn_wait+0x92 (/usr/lib64/libxcb.so.1.1.0)
_xcb_out_send+0x4d (/usr/lib64/libxcb.so.1.1.0)
xcb_writev+0x45 (/usr/lib64/libxcb.so.1.1.0)
_XSend+0x19e (/usr/lib64/libX11.so.6.3.0)
_XReply+0x82 (/usr/lib64/libX11.so.6.3.0)
XSync+0x4d (/usr/lib64/libX11.so.6.3.0)
dri3_bind_tex_image+0x42 (/usr/lib64/libGL.so.1.2.0)
_cogl_winsys_texture_pixmap_x11_update+0x117 (/usr/lib64/libcogl.so.20.4.1)
_cogl_texture_pixmap_x11_update+0x67 (/usr/lib64/libcogl.so.20.4.1)
_cogl_texture_pixmap_x11_pre_paint+0x13 (/usr/lib64/libcogl.so.20.4.1)
_cogl_pipeline_layer_pre_paint+0x5e (/usr/lib64/libcogl.so.20.4.1)
_cogl_rectangles_validate_layer_cb+0x1b (/usr/lib64/libcogl.so.20.4.1)
cogl_pipeline_foreach_layer+0xbe (/usr/lib64/libcogl.so.20.4.1)
_cogl_framebuffer_draw_multitextured_rectangles+0x77 (/usr/lib64/libcogl.so.20.4.1)
cogl_framebuffer_draw_multitextured_rectangle+0x51 (/usr/lib64/libcogl.so.20.4.1)
paint_clipped_rectangle+0xb6 (/usr/lib64/libmutter.so.0.0.0)
meta_shaped_texture_paint+0x3e3 (/usr/lib64/libmutter.so.0.0.0)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_real_paint+0x20 (/usr/lib64/libclutter-1.0.so.0.2400.2)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_real_paint+0x20 (/usr/lib64/libclutter-1.0.so.0.2400.2)
meta_window_actor_paint+0x14b (/usr/lib64/libmutter.so.0.0.0)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_real_paint+0x20 (/usr/lib64/libclutter-1.0.so.0.2400.2)
meta_window_group_paint+0x19f (/usr/lib64/libmutter.so.0.0.0)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
[0x3d970] (/usr/lib64/gnome-shell/libgnome-shell.so)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_stage_paint+0x3a (/usr/lib64/libclutter-1.0.so.0.2400.2)
meta_stage_paint+0x45 (/usr/lib64/libmutter.so.0.0.0)
_g_closure_invoke_va+0x164 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
_clutter_stage_do_paint+0x17b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_stage_cogl_redraw+0x496 (/usr/lib64/libclutter-1.0.so.0.2400.2)
_clutter_stage_do_update+0x117 (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_clock_dispatch+0x169 (/usr/lib64/libclutter-1.0.so.0.2400.2)
g_main_context_dispatch+0x15a (/usr/lib64/libglib-2.0.so.0.4600.2)
g_main_context_iterate.isra.29+0x1e0 (/usr/lib64/libglib-2.0.so.0.4600.2)
g_main_loop_run+0xc2 (/usr/lib64/libglib-2.0.so.0.4600.2)
meta_run+0x2c (/usr/lib64/libmutter.so.0.0.0)
main+0x3f7 (/usr/bin/gnome-shell)
__libc_start_main+0xf0 (/usr/lib64/libc-2.22.so)
[0x2909] (/usr/bin/gnome-shell)
363.038 ( 0.006 ms): gnome-shell/2287 writev(fd: 5<socket:[32540]>, vec: 0x7ffc5ea243a0, vlen: 3 ) = 4
__GI___writev+0x2d (/usr/lib64/libc-2.22.so)
_xcb_conn_wait+0x359 (/usr/lib64/libxcb.so.1.1.0)
_xcb_out_send+0x4d (/usr/lib64/libxcb.so.1.1.0)
xcb_writev+0x45 (/usr/lib64/libxcb.so.1.1.0)
_XSend+0x19e (/usr/lib64/libX11.so.6.3.0)
_XReply+0x82 (/usr/lib64/libX11.so.6.3.0)
XSync+0x4d (/usr/lib64/libX11.so.6.3.0)
dri3_bind_tex_image+0x42 (/usr/lib64/libGL.so.1.2.0)
_cogl_winsys_texture_pixmap_x11_update+0x117 (/usr/lib64/libcogl.so.20.4.1)
_cogl_texture_pixmap_x11_update+0x67 (/usr/lib64/libcogl.so.20.4.1)
_cogl_texture_pixmap_x11_pre_paint+0x13 (/usr/lib64/libcogl.so.20.4.1)
_cogl_pipeline_layer_pre_paint+0x5e (/usr/lib64/libcogl.so.20.4.1)
_cogl_rectangles_validate_layer_cb+0x1b (/usr/lib64/libcogl.so.20.4.1)
cogl_pipeline_foreach_layer+0xbe (/usr/lib64/libcogl.so.20.4.1)
_cogl_framebuffer_draw_multitextured_rectangles+0x77 (/usr/lib64/libcogl.so.20.4.1)
cogl_framebuffer_draw_multitextured_rectangle+0x51 (/usr/lib64/libcogl.so.20.4.1)
paint_clipped_rectangle+0xb6 (/usr/lib64/libmutter.so.0.0.0)
meta_shaped_texture_paint+0x3e3 (/usr/lib64/libmutter.so.0.0.0)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_real_paint+0x20 (/usr/lib64/libclutter-1.0.so.0.2400.2)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_real_paint+0x20 (/usr/lib64/libclutter-1.0.so.0.2400.2)
meta_window_actor_paint+0x14b (/usr/lib64/libmutter.so.0.0.0)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_real_paint+0x20 (/usr/lib64/libclutter-1.0.so.0.2400.2)
meta_window_group_paint+0x19f (/usr/lib64/libmutter.so.0.0.0)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
[0x3d970] (/usr/lib64/gnome-shell/libgnome-shell.so)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_stage_paint+0x3a (/usr/lib64/libclutter-1.0.so.0.2400.2)
meta_stage_paint+0x45 (/usr/lib64/libmutter.so.0.0.0)
_g_closure_invoke_va+0x164 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
_clutter_stage_do_paint+0x17b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_stage_cogl_redraw+0x496 (/usr/lib64/libclutter-1.0.so.0.2400.2)
_clutter_stage_do_update+0x117 (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_clock_dispatch+0x169 (/usr/lib64/libclutter-1.0.so.0.2400.2)
g_main_context_dispatch+0x15a (/usr/lib64/libglib-2.0.so.0.4600.2)
g_main_context_iterate.isra.29+0x1e0 (/usr/lib64/libglib-2.0.so.0.4600.2)
g_main_loop_run+0xc2 (/usr/lib64/libglib-2.0.so.0.4600.2)
meta_run+0x2c (/usr/lib64/libmutter.so.0.0.0)
main+0x3f7 (/usr/bin/gnome-shell)
__libc_start_main+0xf0 (/usr/lib64/libc-2.22.so)
[0x2909] (/usr/bin/gnome-shell)
363.086 ( 0.042 ms): gnome-shell/2287 poll(ufds: 0x7ffc5ea24250, nfds: 1, timeout_msecs: 4294967295 ) = 1
[0xf6fdd] (/usr/lib64/libc-2.22.so)
_xcb_conn_wait+0x92 (/usr/lib64/libxcb.so.1.1.0)
wait_for_reply+0xb7 (/usr/lib64/libxcb.so.1.1.0)
xcb_wait_for_reply+0x61 (/usr/lib64/libxcb.so.1.1.0)
_XReply+0x127 (/usr/lib64/libX11.so.6.3.0)
XSync+0x4d (/usr/lib64/libX11.so.6.3.0)
dri3_bind_tex_image+0x42 (/usr/lib64/libGL.so.1.2.0)
_cogl_winsys_texture_pixmap_x11_update+0x117 (/usr/lib64/libcogl.so.20.4.1)
_cogl_texture_pixmap_x11_update+0x67 (/usr/lib64/libcogl.so.20.4.1)
_cogl_texture_pixmap_x11_pre_paint+0x13 (/usr/lib64/libcogl.so.20.4.1)
_cogl_pipeline_layer_pre_paint+0x5e (/usr/lib64/libcogl.so.20.4.1)
_cogl_rectangles_validate_layer_cb+0x1b (/usr/lib64/libcogl.so.20.4.1)
cogl_pipeline_foreach_layer+0xbe (/usr/lib64/libcogl.so.20.4.1)
_cogl_framebuffer_draw_multitextured_rectangles+0x77 (/usr/lib64/libcogl.so.20.4.1)
cogl_framebuffer_draw_multitextured_rectangle+0x51 (/usr/lib64/libcogl.so.20.4.1)
paint_clipped_rectangle+0xb6 (/usr/lib64/libmutter.so.0.0.0)
meta_shaped_texture_paint+0x3e3 (/usr/lib64/libmutter.so.0.0.0)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_real_paint+0x20 (/usr/lib64/libclutter-1.0.so.0.2400.2)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_real_paint+0x20 (/usr/lib64/libclutter-1.0.so.0.2400.2)
meta_window_actor_paint+0x14b (/usr/lib64/libmutter.so.0.0.0)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_real_paint+0x20 (/usr/lib64/libclutter-1.0.so.0.2400.2)
meta_window_group_paint+0x19f (/usr/lib64/libmutter.so.0.0.0)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
[0x3d970] (/usr/lib64/gnome-shell/libgnome-shell.so)
_g_closure_invoke_va+0xb2 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_stage_paint+0x3a (/usr/lib64/libclutter-1.0.so.0.2400.2)
meta_stage_paint+0x45 (/usr/lib64/libmutter.so.0.0.0)
_g_closure_invoke_va+0x164 (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit_valist+0xc0d (/usr/lib64/libgobject-2.0.so.0.4600.2)
g_signal_emit+0x8f (/usr/lib64/libgobject-2.0.so.0.4600.2)
clutter_actor_continue_paint+0x2bb (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_actor_paint.part.41+0x47b (/usr/lib64/libclutter-1.0.so.0.2400.2)
_clutter_stage_do_paint+0x17b (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_stage_cogl_redraw+0x496 (/usr/lib64/libclutter-1.0.so.0.2400.2)
_clutter_stage_do_update+0x117 (/usr/lib64/libclutter-1.0.so.0.2400.2)
clutter_clock_dispatch+0x169 (/usr/lib64/libclutter-1.0.so.0.2400.2)
g_main_context_dispatch+0x15a (/usr/lib64/libglib-2.0.so.0.4600.2)
g_main_context_iterate.isra.29+0x1e0 (/usr/lib64/libglib-2.0.so.0.4600.2)
g_main_loop_run+0xc2 (/usr/lib64/libglib-2.0.so.0.4600.2)
meta_run+0x2c (/usr/lib64/libmutter.so.0.0.0)
main+0x3f7 (/usr/bin/gnome-shell)
__libc_start_main+0xf0 (/usr/lib64/libc-2.22.so)
[0x2909] (/usr/bin/gnome-shell)--- tools/perf/Documentation/perf-trace.txt | 4 +++ tools/perf/builtin-trace.c | 55 ++++++++++++++++++++++----------- 2 files changed, 41 insertions(+), 18 deletions(-)
tools/perf/Documentation/perf-trace.txt +4 -0
@@ -138,6 +138,10 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs. Default: 127 +--min-stack:: + Set the stack depth limit when parsing the callchain, anything + below the specified depth will be ignored. Disabled by default. + --proc-map-timeout:: When processing pre-existing threads /proc/XXX/mmap, it may take a long time, because the file may be huge. A time out is needed in such cases.
tools/perf/builtin-trace.c +37 -18
116 lines not on this page · raw message
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 12/15 perf record: Export record_opts based callchain parsing helper
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To be able to call it outside option parsing, like when setting a default --call-graph parameter in 'perf trace' when just --min-stack is used.
--- tools/perf/builtin-record.c | 35 ++++++++++++++++++++--------------- tools/perf/util/callchain.h | 6 ++++++ 2 files changed, 26 insertions(+), 15 deletions(-)
tools/perf/builtin-record.c +20 -15
@@ -930,45 +930,50 @@ out_delete_session:return status; } -static void callchain_debug (void ) +static void callchain_debug (struct callchain_param *callchain) {static const char *str[CALLCHAIN_MAX ] = {"NONE" ,"FP" ,"DWARF" ,"LBR" }; -pr_debug ("callchain: type %s\n" , str[callchain_param.record_mode]); +pr_debug ("callchain: type %s\n" , str[callchain->record_mode]); -if (callchain_param.record_mode ==CALLCHAIN_DWARF ) +if (callchain->record_mode ==CALLCHAIN_DWARF )pr_debug ("callchain: stack dump size %d\n" , - callchain_param.dump_size); + callchain->dump_size); } -int record_parse_callchain_opt (const struct option *opt, -const char *arg, -int unset) +int record_opts__parse_callchain (struct record_opts *record, +struct callchain_param *callchain, +const char *arg,bool unset) {int ret; -struct record_opts *record = (struct record_opts *)opt->value; - record->callgraph_set = true; - callchain_param.enabled = !unset; + callchain->enabled = !unset;/* --no-call-graph */ if (unset) { - callchain_param.record_mode =CALLCHAIN_NONE ; + callchain->record_mode =CALLCHAIN_NONE ;pr_debug ("callchain: disabled\n" );return 0 ; } - ret =parse_callchain_record_opt (arg, &callchain_param); + ret =parse_callchain_record_opt (arg, callchain);if (!ret) {/* Enable data address sampling for DWARF unwind. */ -if (callchain_param.record_mode ==CALLCHAIN_DWARF ) +if (callchain->record_mode ==CALLCHAIN_DWARF ) record->sample_address = true; -callchain_debug (); +callchain_debug (callchain); }return ret; } +int record_parse_callchain_opt (const struct option *opt, +const char *arg, +int unset) +{ +return record_opts__parse_callchain (opt->value, &callchain_param, arg, unset); +} +int record_callchain_opt (const struct option *opt,const char *arg__maybe_unused ,int unset__maybe_unused )
@@ -981,7 +986,7 @@ int record_callchain_opt(const struct option *opt,if (callchain_param.record_mode ==CALLCHAIN_NONE ) callchain_param.record_mode =CALLCHAIN_FP ; -callchain_debug (); +callchain_debug (&callchain_param);return 0 ; }
tools/perf/util/callchain.h +6 -0
@@ -212,6 +212,12 @@ struct hist_entry;int record_parse_callchain_opt (const struct option *opt,const char *arg,int unset);int record_callchain_opt (const struct option *opt,const char *arg,int unset); +struct record_opts ; + +int record_opts__parse_callchain (struct record_opts *record, +struct callchain_param *callchain, +const char *arg,bool unset); + int sample__resolve_callchain(struct perf_sample *sample, struct callchain_cursor *cursor, struct symbol **parent, struct perf_evsel *evsel, struct addr_location *al,
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 13/15 perf trace: Make --(min,max}-stack imply "--call-graph dwarf"
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
If one uses:
# perf trace --min-stack 16
Then it implicitly means that callgraphs should be enabled, and the best option in terms of widespread availability is "dwarf".
Further work needed to choose a better alternative, LBR, in capable systems.
--- tools/perf/Documentation/perf-trace.txt | 6 ++++++ tools/perf/builtin-trace.c | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-trace.txt +6 -0
@@ -136,12 +136,18 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs. not limiting, the overhead of callchains needs to be set via the knobs in --call-graph dwarf. + Implies '--call-graph dwarf' when --call-graph not present on the + command line, on systems where DWARF unwinding was built in. + Default: 127 --min-stack:: Set the stack depth limit when parsing the callchain, anything below the specified depth will be ignored. Disabled by default. + Implies '--call-graph dwarf' when --call-graph not present on the + command line, on systems where DWARF unwinding was built in. + --proc-map-timeout:: When processing pre-existing threads /proc/XXX/mmap, it may take a long time, because the file may be huge. A time out is needed in such cases.
tools/perf/builtin-trace.c +12 -1
@@ -3047,7 +3047,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) .show_comm = true, .trace_syscalls = true, .kernel_syscallchains = false, - .max_stack = PERF_MAX_STACK_DEPTH, + .max_stack = UINT_MAX, };const char *output_name =NULL ;const char *ev_qualifier_str =NULL ;
@@ -3109,6 +3109,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) "per thread proc mmap processing timeout in ms"), OPT_END() }; +bool max_stack_user_set = true;const char *const trace_subcommands[] = {"record" ,NULL };int err;char bf[BUFSIZ ];
@@ -3142,6 +3143,16 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) trace.opts.sample_time = true; } +if (trace.max_stack ==UINT_MAX ) { + trace.max_stack =PERF_MAX_STACK_DEPTH ; + max_stack_user_set = false; + } + +#ifdef HAVE_DWARF_UNWIND_SUPPORT +if ((trace.min_stack || max_stack_user_set) && !trace.opts.callgraph_set) +record_opts__parse_callchain (&trace.opts, &callchain_param,"dwarf" , false); +#endif +if (trace.opts.callgraph_set) symbol_conf.use_callchain = true;
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 14/15 perf evlist: Expose perf_event_mlock_kb_in_pages() helper
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
When the user doesn't set --mmap-pages, perf_evlist__mmap() will do it by reading the maximum possible for a non-root user from the /proc/sys/kernel/perf_event_mlock_kb file.
Expose that function so that 'perf trace' can, for root users, to bump mmap-pages to a higher value for root, based on the contents of this proc file.
--- tools/perf/util/evlist.c | 42 +++++++++++++++++++++++++----------------- tools/perf/util/evlist.h | 2 ++ 2 files changed, 27 insertions(+), 17 deletions(-)
tools/perf/util/evlist.c +25 -17
@@ -986,26 +986,34 @@ out_unmap:return -1 ; } -static size_t perf_evlist__mmap_size (unsigned long pages) +unsigned long perf_event_mlock_kb_in_pages (void ) { -if (pages ==UINT_MAX ) { -int max; +unsigned long pages; +int max; -if (sysctl__read_int ("kernel/perf_event_mlock_kb" , &max) <0 ) { -/* -* Pick a once upon a time good value, i.e. things look -* strange since we can't read a sysctl value, but lets not -* die yet... -*/ - max =512 ; - }else { - max -= (page_size /1024 ); - } +if (sysctl__read_int ("kernel/perf_event_mlock_kb" , &max) <0 ) { +/* +* Pick a once upon a time good value, i.e. things look +* strange since we can't read a sysctl value, but lets not +* die yet... +*/ + max =512 ; + }else { + max -= (page_size /1024 ); + } + + pages = (max *1024 ) / page_size; +if (!is_power_of_2 (pages)) + pages =rounddown_pow_of_two (pages); - pages = (max *1024 ) / page_size; -if (!is_power_of_2 (pages)) - pages =rounddown_pow_of_two (pages); - }else if (!is_power_of_2 (pages)) +return pages; +} + +static size_t perf_evlist__mmap_size (unsigned long pages) +{ +if (pages ==UINT_MAX ) + pages =perf_event_mlock_kb_in_pages (); +else if (!is_power_of_2 (pages))return 0 ;return (pages +1 ) * page_size;
tools/perf/util/evlist.h +2 -0
@@ -158,6 +158,8 @@ int perf_evlist__parse_mmap_pages(const struct option *opt,const char *str, int unset); +unsigned long perf_event_mlock_kb_in_pages (void ); +int perf_evlist__mmap_ex (struct perf_evlist *evlist,unsigned int pages,bool overwrite,unsigned int auxtrace_pages,bool auxtrace_overwrite);
Signature · 1 line
2.5.5
Arnaldo Carvalho de Melo
maintainerPATCH 15/15 perf trace: Bump --mmap-pages when --call-graph is used by the root user
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To reduce the chances we'll overflow the mmap buffer, manual fine tuning trumps this.
--- tools/perf/Documentation/perf-trace.txt | 4 ++++ tools/perf/builtin-trace.c | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-trace.txt +4 -0
@@ -123,6 +123,10 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs. man pages for details. The ones that are most useful in 'perf trace' are 'dwarf' and 'lbr', where available, try: 'perf trace --call-graph dwarf'. + Using this will, for the root user, bump the value of --mmap-pages to 4 + times the maximum for non-root users, based on the kernel.perf_event_mlock_kb + sysctl. This is done only if the user doesn't specify a --mmap-pages value. + --kernel-syscall-graph:: Show the kernel callchains on the syscall exit path.
tools/perf/builtin-trace.c +9 -1
@@ -3110,6 +3110,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) OPT_END() };bool max_stack_user_set = true; +bool mmap_pages_user_set = true;const char *const trace_subcommands[] = {"record" ,NULL };int err;char bf[BUFSIZ ];
@@ -3143,6 +3144,9 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) trace.opts.sample_time = true; } +if (trace.opts.mmap_pages ==UINT_MAX ) + mmap_pages_user_set = false; +if (trace.max_stack ==UINT_MAX ) { trace.max_stack =PERF_MAX_STACK_DEPTH ; max_stack_user_set = false;
@@ -3153,8 +3157,12 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)record_opts__parse_callchain (&trace.opts, &callchain_param,"dwarf" , false);#endif -if (trace.opts.callgraph_set) +if (trace.opts.callgraph_set) { +if (!mmap_pages_user_set &&geteuid () ==0 ) + trace.opts.mmap_pages =perf_event_mlock_kb_in_pages () *4 ; + symbol_conf.use_callchain = true; + }if (trace.evlist->nr_entries >0 )evlist__set_evsel_handler (trace.evlist, trace__event_handler);
Signature · 1 line
2.5.5
Quoted 104 lines · Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit
0b22cd276cec21107d9d69453fa58abba73e71df:Merge tag 'perf-core-for-mingo-20160414' of
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linuxinto perf/core (2016-04-14 15:30:59 +0200)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-core-for-mingo-20160415for you to fetch changes up to
f3e459d16a8493b617ccf2a940330279679e0291:perf trace: Bump --mmap-pages when --call-graph is used by the root user (2016-04-15 17:52:34 -0300)
----------------------------------------------------------------
perf/core improvements:User visible:
- Wire the callchain unwinding "max-stack" know to 'perf script --max-stack', allowing to limit the depth of callchains, possibly reducing processing time (Arnaldo Carvalho de Melo)
- Ditto for 'perf trace --max-stack' (Arnaldo Carvalho de Melo)
- Introduce a --min-stack filter for 'perf trace', to show syscalls that
had a userspace callchain leading to it at least min-stack deep (Arnaldo Carvalho de Melo)- Make 'perf trace' work with multiple threads and the --duration filter, i.e. do not print the start of an interrupted syscall followed by ... to print interrupts from other threads, as we need to wait the
sys_exitsyscall tracepoint to calculate the duration, duh. (Arnaldo Carvalho de Melo)System wide --duration now works as expected:
[root@jouet ~]# trace --duration 100 152.393 (145.147 ms): Timer/24358 futex(uaddr: 0x7f5ed98e56cc, op: WAIT_BITSET|PRIV|CLKRT, val: 7055125, utime: 0x7f5ecdbfec30, val3: 4294967295) = -1 ETIMEDOUT Connection timed out 152.438 (145.040 ms): firefox/24321 poll(ufds: 0x7f5ec388b460, nfds: 6, timeout_msecs: 4294967295) = 1 358.580 (158.279 ms): Xorg/2025 select(n: 512, inp: 0x83a8e0, tvp: 0x7ffdcbb63610) = 0 Timeout 358.687 (148.285 ms): gnome-terminal/2711 poll(ufds: 0x55b7e6811ad0, nfds: 15, timeout_msecs: 249) = 1 370.150 (169.569 ms): gnome-shell/2287 poll(ufds: 0x55e623d65490, nfds: 86, timeout_msecs: 4294967295) = 1- Now 'perf trace's --max-stack and --min-stack will automatically set "--call-graph dwarf", if --call-graph is not present on the command line:
[root@jouet ~]# perf trace -e nanosleep --max-stack 3 usleep 1 0.299 ( 0.057 ms): usleep/29658 nanosleep(rqtp: 0x7fff80f3b230) = 0 __nanosleep+0x10 (/usr/lib64/libc-2.22.so) usleep+0x34 (/usr/lib64/libc-2.22.so) main+0x1eb (/usr/bin/usleep) [root@jouet ~]#- Bump 'perf trace --mmap-pages' for root when using callchains and not specifying --mmap-pages explicitely (Arnaldo Carvalho de Melo)
Build fixes:
- The python binding object had missing symbols, to some refactoring to fix that (Arnaldo Carvalho de Melo)
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Arnaldo Carvalho de Melo (15):
perf trace: Movesocket_typebeautifier totools/perf/trace/beauty/perf callchain: Start moving away from global per thread cursors
perf evsel: Removesymbol_confusage
perf symbols: Move fprintf routines to separate object file
perf evsel: Require that callchains be resolved before calling fprintf_{sym,callchain} perf tools: Removeaddr_locationargument tosample__fprintf_callchainperf script: Add --max-stack knob
perf trace: Add --max-stack knob
perf evsel: Move fprintf methods to separate source file
perf trace: Do not print interrupted syscalls when using --duration perf trace: Introduce --min-stack filter
perf record: Exportrecord_optsbased callchain parsing helper
perf trace: Make --(min,max}-stack imply "--call-graph dwarf"
perf evlist: Exposeperf_event_mlock_kb_in_pages()helper
perf trace: Bump --mmap-pages when --call-graph is used by the root usertools/perf/Documentation/perf-script.txt | 10 + tools/perf/Documentation/perf-trace.txt | 23 +++ tools/perf/builtin-kmem.c | 2 +- tools/perf/builtin-record.c | 35 ++-- tools/perf/builtin-script.c | 39 ++-- tools/perf/builtin-trace.c | 144 +++++++------- tools/perf/trace/beauty/socket_type.c | 60 ++++++ tools/perf/util/Build | 2 + tools/perf/util/callchain.c | 5 +- tools/perf/util/callchain.h | 9 +- tools/perf/util/evlist.c | 42 ++-- tools/perf/util/evlist.h | 2 + tools/perf/util/evsel.c | 220 --------------------- tools/perf/util/evsel.h | 19 +- tools/perf/util/evsel_fprintf.c | 212 ++++++++++++++++++++ tools/perf/util/hist.c | 2 +- tools/perf/util/machine.c | 26 +-- tools/perf/util/machine.h | 4 + tools/perf/util/python-ext-sources | 1 + .../perf/util/scripting-engines/trace-event-perl.c | 2 +-
Quoted 8 lines
.../util/scripting-engines/trace-event-python.c | 2 +- tools/perf/util/symbol.c | 71 ------- tools/perf/util/symbol.h | 5 + tools/perf/util/symbol_fprintf.c | 71 +++++++ 24 files changed, 565 insertions(+), 443 deletions(-) create mode 100644 tools/perf/trace/beauty/socket_type.c create mode 100644 tools/perf/util/evsel_fprintf.c create mode 100644 tools/perf/util/symbol_fprintf.c
Pulled, thanks a lot Arnaldo!
Ingo