aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-10-24 14:42:42 -0400
committerIngo Molnar <mingo@kernel.org>2016-10-24 14:42:42 -0400
commit76e2d2617d767c445498c4c4b1162eb2201cdd77 (patch)
treee03764dba70ea6993366e25d16e1735b2d40cd26 /tools/perf/builtin-script.c
parente9c848928abf4cb60601e9ae7d336f0333c98bca (diff)
parent04b553ad7dc347eabd3cb4705932272453175a80 (diff)
Merge tag 'perf-core-for-mingo-20161024' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: New features: - Dynamicly change verbosity level by pressing 'V' in the 'perf top/report' hists TUI browser (Alexis Berlemont) - Implement 'perf trace --delay' in the same fashion as in 'perf record --delay', to skip sampling workload initialization events (Alexis Berlemont) - Make vendor named events case insensitive in 'perf list', i.e. 'perf list LONGEST_LAT' works just the same as 'perf list longest_lat' (Andi Kleen) - Show instruction bytes and lenght in 'perf script' for Intel PT and BTS (Andi Kleen, Adrian Hunter) E.g: % perf record -e intel_pt// foo % perf script --itrace=i0ns -F ip,insn,insnlen ffffffff8101232f ilen: 5 insn: 0f 1f 44 00 00 ffffffff81012334 ilen: 1 insn: 5b ffffffff81012335 ilen: 1 insn: 5d ffffffff81012336 ilen: 1 insn: c3 ffffffff810123e3 ilen: 1 insn: 5b ffffffff810123e4 ilen: 2 insn: 41 5c ffffffff810123e6 ilen: 1 insn: 5d ffffffff810123e7 ilen: 1 insn: c3 ffffffff810124a6 ilen: 2 insn: 31 c0 ffffffff810124a8 ilen: 9 insn: 41 83 bc 24 a8 01 00 00 01 ffffffff810124b1 ilen: 2 insn: 75 87 - Allow enabling the perf_event_attr.branch_type attribute member: (Andi Kleen) perf record -e sched:sched_switch,cpu/cpu-cycles,branch_type=any/ ... - Add unwinding support for jitdump (Stefano Sanfilippo) Fixes: - Use raw_syscall:sys_enter timestamp in 'perf trace' (Arnaldo Carvalho de Melo) Infrastructure: - Allow jitdump to be built without libdwarf (Maciej Debski) - Sync x86's syscall table tools/ copy (Arnaldo Carvalho de Melo) - Fixes to avoid calling die() in library fuctions already propagating other errors (Arnaldo Carvalho de Melo) - Improvements to allow libtraceevent to be properly installed in distro packages (Jiri Olsa) - Removing coresight miscellaneous debug output (Mathieu Poirier) - Cache align the 'perf bench futex' worker struct (Sebastian Andrzej Siewior) Documentation: - Minor improvements on the documentation of event parameters (Andi Kleen) - Add jitdump format specification document (Stephane Eranian) Spelling fixes: - Fix typo "No enough" to "Not enough" (Alexander Alemayhu) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r--tools/perf/builtin-script.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 7228d141a789..412fb6e65ac0 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -66,6 +66,8 @@ enum perf_output_field {
66 PERF_OUTPUT_WEIGHT = 1U << 18, 66 PERF_OUTPUT_WEIGHT = 1U << 18,
67 PERF_OUTPUT_BPF_OUTPUT = 1U << 19, 67 PERF_OUTPUT_BPF_OUTPUT = 1U << 19,
68 PERF_OUTPUT_CALLINDENT = 1U << 20, 68 PERF_OUTPUT_CALLINDENT = 1U << 20,
69 PERF_OUTPUT_INSN = 1U << 21,
70 PERF_OUTPUT_INSNLEN = 1U << 22,
69}; 71};
70 72
71struct output_option { 73struct output_option {
@@ -93,6 +95,8 @@ struct output_option {
93 {.str = "weight", .field = PERF_OUTPUT_WEIGHT}, 95 {.str = "weight", .field = PERF_OUTPUT_WEIGHT},
94 {.str = "bpf-output", .field = PERF_OUTPUT_BPF_OUTPUT}, 96 {.str = "bpf-output", .field = PERF_OUTPUT_BPF_OUTPUT},
95 {.str = "callindent", .field = PERF_OUTPUT_CALLINDENT}, 97 {.str = "callindent", .field = PERF_OUTPUT_CALLINDENT},
98 {.str = "insn", .field = PERF_OUTPUT_INSN},
99 {.str = "insnlen", .field = PERF_OUTPUT_INSNLEN},
96}; 100};
97 101
98/* default set to maintain compatibility with current format */ 102/* default set to maintain compatibility with current format */
@@ -624,6 +628,20 @@ static void print_sample_callindent(struct perf_sample *sample,
624 printf("%*s", spacing - len, ""); 628 printf("%*s", spacing - len, "");
625} 629}
626 630
631static void print_insn(struct perf_sample *sample,
632 struct perf_event_attr *attr)
633{
634 if (PRINT_FIELD(INSNLEN))
635 printf(" ilen: %d", sample->insn_len);
636 if (PRINT_FIELD(INSN)) {
637 int i;
638
639 printf(" insn:");
640 for (i = 0; i < sample->insn_len; i++)
641 printf(" %02x", (unsigned char)sample->insn[i]);
642 }
643}
644
627static void print_sample_bts(struct perf_sample *sample, 645static void print_sample_bts(struct perf_sample *sample,
628 struct perf_evsel *evsel, 646 struct perf_evsel *evsel,
629 struct thread *thread, 647 struct thread *thread,
@@ -668,6 +686,8 @@ static void print_sample_bts(struct perf_sample *sample,
668 if (print_srcline_last) 686 if (print_srcline_last)
669 map__fprintf_srcline(al->map, al->addr, "\n ", stdout); 687 map__fprintf_srcline(al->map, al->addr, "\n ", stdout);
670 688
689 print_insn(sample, attr);
690
671 printf("\n"); 691 printf("\n");
672} 692}
673 693
@@ -911,7 +931,7 @@ static void process_event(struct perf_script *script,
911 931
912 if (perf_evsel__is_bpf_output(evsel) && PRINT_FIELD(BPF_OUTPUT)) 932 if (perf_evsel__is_bpf_output(evsel) && PRINT_FIELD(BPF_OUTPUT))
913 print_sample_bpf_output(sample); 933 print_sample_bpf_output(sample);
914 934 print_insn(sample, attr);
915 printf("\n"); 935 printf("\n");
916} 936}
917 937
@@ -2124,7 +2144,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
2124 "Valid types: hw,sw,trace,raw. " 2144 "Valid types: hw,sw,trace,raw. "
2125 "Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso," 2145 "Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso,"
2126 "addr,symoff,period,iregs,brstack,brstacksym,flags," 2146 "addr,symoff,period,iregs,brstack,brstacksym,flags,"
2127 "bpf-output,callindent", parse_output_fields), 2147 "bpf-output,callindent,insn,insnlen", parse_output_fields),
2128 OPT_BOOLEAN('a', "all-cpus", &system_wide, 2148 OPT_BOOLEAN('a', "all-cpus", &system_wide,
2129 "system-wide collection from all CPUs"), 2149 "system-wide collection from all CPUs"),
2130 OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]", 2150 OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]",