diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-01-30 14:15:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-01-30 14:15:14 -0500 |
commit | d8b91dde38f4c43bd0bbbf17a90f735b16aaff2c (patch) | |
tree | bd72dabf6e4b23e060fce429c87e60504f69de54 /tools/perf/util/annotate.h | |
parent | 5e7481a25e90b661d1dbbba18be3fd3dfe12ec6f (diff) | |
parent | e4c1091cb495d9cbec8956d642644a71a1689958 (diff) |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar:
"Kernel side changes:
- Clean up the x86 instruction decoder (Masami Hiramatsu)
- Add new uprobes optimization for PUSH instructions on x86 (Yonghong
Song)
- Add MSR_IA32_THERM_STATUS to the MSR events (Stephane Eranian)
- Fix misc bugs, update documentation, plus various cleanups (Jiri
Olsa)
There's a large number of tooling side improvements:
- Intel-PT/BTS improvements (Adrian Hunter)
- Numerous 'perf trace' improvements (Arnaldo Carvalho de Melo)
- Introduce an errno code to string facility (Hendrik Brueckner)
- Various build system improvements (Jiri Olsa)
- Add support for CoreSight trace decoding by making the perf tools
use the external openCSD (Mathieu Poirier, Tor Jeremiassen)
- Add ARM Statistical Profiling Extensions (SPE) support (Kim
Phillips)
- libtraceevent updates (Steven Rostedt)
- Intel vendor event JSON updates (Andi Kleen)
- Introduce 'perf report --mmaps' and 'perf report --tasks' to show
info present in 'perf.data' (Jiri Olsa, Arnaldo Carvalho de Melo)
- Add infrastructure to record first and last sample time to the
perf.data file header, so that when processing all samples in a
'perf record' session, such as when doing build-id processing, or
when specifically requesting that that info be recorded, use that
in 'perf report --time', that also got support for percent slices
in addition to absolute ones.
I.e. now it is possible to ask for the samples in the 10%-20% time
slice of a perf.data file (Jin Yao)
- Allow system wide 'perf stat --per-thread', sorting the result (Jin
Yao)
E.g.:
[root@jouet ~]# perf stat --per-thread --metrics IPC
^C
Performance counter stats for 'system wide':
make-22229 23,012,094,032 inst_retired.any # 0.8 IPC
cc1-22419 692,027,497 inst_retired.any # 0.8 IPC
gcc-22418 328,231,855 inst_retired.any # 0.9 IPC
cc1-22509 220,853,647 inst_retired.any # 0.8 IPC
gcc-22486 199,874,810 inst_retired.any # 1.0 IPC
as-22466 177,896,365 inst_retired.any # 0.9 IPC
cc1-22465 150,732,374 inst_retired.any # 0.8 IPC
gcc-22508 112,555,593 inst_retired.any # 0.9 IPC
cc1-22487 108,964,079 inst_retired.any # 0.7 IPC
qemu-system-x86-2697 21,330,550 inst_retired.any # 0.3 IPC
systemd-journal-551 20,642,951 inst_retired.any # 0.4 IPC
docker-containe-17651 9,552,892 inst_retired.any # 0.5 IPC
dockerd-current-9809 7,528,586 inst_retired.any # 0.5 IPC
make-22153 12,504,194,380 inst_retired.any # 0.8 IPC
python2-22429 12,081,290,954 inst_retired.any # 0.8 IPC
<SNIP>
python2-22429 15,026,328,103 cpu_clk_unhalted.thread
cc1-22419 826,660,193 cpu_clk_unhalted.thread
gcc-22418 365,321,295 cpu_clk_unhalted.thread
cc1-22509 279,169,362 cpu_clk_unhalted.thread
gcc-22486 210,156,950 cpu_clk_unhalted.thread
<SNIP>
5.638075538 seconds time elapsed
[root@jouet ~]#
- Improve shell auto-completion of perf events (Jin Yao)
- 'perf probe' improvements (Masami Hiramatsu)
- Improve PMU infrastructure to support amp64's ThunderX2
implementation defined core events (Ganapatrao Kulkarni)
- Various annotation related improvements and fixes (Thomas Richter)
- Clarify usage of 'overwrite' and 'backward' in the evlist/mmap
code, removing the 'overwrite' parameter from several functions as
it was always used it as 'false' (Wang Nan)
- Fix/improve 'perf record' reverse recording support (Wang Nan)
- Improve command line options documentation (Sihyeon Jang)
- Optimize sample parsing for ordering events, where we don't need to
parse all the PERF_SAMPLE_ bits, just the ones leading to the
timestamp needed to reorder events (Jiri Olsa)
- Generalize the annotation code to support other source information
besides objdump/DWARF obtained ones, starting with python scripts,
that will is slated to be merged soon (Jiri Olsa)
- ... and a lot more that I failed to list, see the shortlog and
changelog for details"
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (262 commits)
perf trace beauty flock: Move to separate object file
perf evlist: Remove fcntl.h from evlist.h
perf trace beauty futex: Beautify FUTEX_BITSET_MATCH_ANY
perf trace: Do not print from time delta for interrupted syscall lines
perf trace: Add --print-sample
perf bpf: Remove misplaced __maybe_unused attribute
MAINTAINERS: Adding entry for CoreSight trace decoding
perf tools: Add mechanic to synthesise CoreSight trace packets
perf tools: Add full support for CoreSight trace decoding
pert tools: Add queue management functionality
perf tools: Add functionality to communicate with the openCSD decoder
perf tools: Add support for decoding CoreSight trace data
perf tools: Add decoder mechanic to support dumping trace data
perf tools: Add processing of coresight metadata
perf tools: Add initial entry point for decoder CoreSight traces
perf tools: Integrating the CoreSight decoding library
perf vendor events intel: Update IvyTown files to V20
perf vendor events intel: Update IvyBridge files to V20
perf vendor events intel: Update BroadwellDE events to V7
perf vendor events intel: Update SkylakeX events to V1.06
...
Diffstat (limited to 'tools/perf/util/annotate.h')
-rw-r--r-- | tools/perf/util/annotate.h | 76 |
1 files changed, 42 insertions, 34 deletions
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index f6ba3560de5e..ce427445671f 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -59,33 +59,55 @@ bool ins__is_fused(struct arch *arch, const char *ins1, const char *ins2); | |||
59 | 59 | ||
60 | struct annotation; | 60 | struct annotation; |
61 | 61 | ||
62 | struct sym_hist_entry { | ||
63 | u64 nr_samples; | ||
64 | u64 period; | ||
65 | }; | ||
66 | |||
67 | struct annotation_data { | ||
68 | double percent; | ||
69 | double percent_sum; | ||
70 | struct sym_hist_entry he; | ||
71 | }; | ||
72 | |||
73 | struct annotation_line { | ||
74 | struct list_head node; | ||
75 | struct rb_node rb_node; | ||
76 | s64 offset; | ||
77 | char *line; | ||
78 | int line_nr; | ||
79 | float ipc; | ||
80 | u64 cycles; | ||
81 | size_t privsize; | ||
82 | char *path; | ||
83 | int samples_nr; | ||
84 | struct annotation_data samples[0]; | ||
85 | }; | ||
86 | |||
62 | struct disasm_line { | 87 | struct disasm_line { |
63 | struct list_head node; | 88 | struct ins ins; |
64 | s64 offset; | 89 | struct ins_operands ops; |
65 | char *line; | 90 | |
66 | struct ins ins; | 91 | /* This needs to be at the end. */ |
67 | int line_nr; | 92 | struct annotation_line al; |
68 | float ipc; | ||
69 | u64 cycles; | ||
70 | struct ins_operands ops; | ||
71 | }; | 93 | }; |
72 | 94 | ||
95 | static inline struct disasm_line *disasm_line(struct annotation_line *al) | ||
96 | { | ||
97 | return al ? container_of(al, struct disasm_line, al) : NULL; | ||
98 | } | ||
99 | |||
73 | static inline bool disasm_line__has_offset(const struct disasm_line *dl) | 100 | static inline bool disasm_line__has_offset(const struct disasm_line *dl) |
74 | { | 101 | { |
75 | return dl->ops.target.offset_avail; | 102 | return dl->ops.target.offset_avail; |
76 | } | 103 | } |
77 | 104 | ||
78 | struct sym_hist_entry { | ||
79 | u64 nr_samples; | ||
80 | u64 period; | ||
81 | }; | ||
82 | |||
83 | void disasm_line__free(struct disasm_line *dl); | 105 | void disasm_line__free(struct disasm_line *dl); |
84 | struct disasm_line *disasm__get_next_ip_line(struct list_head *head, struct disasm_line *pos); | 106 | struct annotation_line * |
107 | annotation_line__next(struct annotation_line *pos, struct list_head *head); | ||
85 | int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw); | 108 | int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw); |
86 | size_t disasm__fprintf(struct list_head *head, FILE *fp); | 109 | size_t disasm__fprintf(struct list_head *head, FILE *fp); |
87 | double disasm__calc_percent(struct annotation *notes, int evidx, s64 offset, | 110 | void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel); |
88 | s64 end, const char **path, struct sym_hist_entry *sample); | ||
89 | 111 | ||
90 | struct sym_hist { | 112 | struct sym_hist { |
91 | u64 nr_samples; | 113 | u64 nr_samples; |
@@ -104,19 +126,6 @@ struct cyc_hist { | |||
104 | u16 reset; | 126 | u16 reset; |
105 | }; | 127 | }; |
106 | 128 | ||
107 | struct source_line_samples { | ||
108 | double percent; | ||
109 | double percent_sum; | ||
110 | u64 nr; | ||
111 | }; | ||
112 | |||
113 | struct source_line { | ||
114 | struct rb_node node; | ||
115 | char *path; | ||
116 | int nr_pcnt; | ||
117 | struct source_line_samples samples[1]; | ||
118 | }; | ||
119 | |||
120 | /** struct annotated_source - symbols with hits have this attached as in sannotation | 129 | /** struct annotated_source - symbols with hits have this attached as in sannotation |
121 | * | 130 | * |
122 | * @histogram: Array of addr hit histograms per event being monitored | 131 | * @histogram: Array of addr hit histograms per event being monitored |
@@ -132,7 +141,6 @@ struct source_line { | |||
132 | */ | 141 | */ |
133 | struct annotated_source { | 142 | struct annotated_source { |
134 | struct list_head source; | 143 | struct list_head source; |
135 | struct source_line *lines; | ||
136 | int nr_histograms; | 144 | int nr_histograms; |
137 | size_t sizeof_sym_hist; | 145 | size_t sizeof_sym_hist; |
138 | struct cyc_hist *cycles_hist; | 146 | struct cyc_hist *cycles_hist; |
@@ -169,9 +177,9 @@ int hist_entry__inc_addr_samples(struct hist_entry *he, struct perf_sample *samp | |||
169 | int symbol__alloc_hist(struct symbol *sym); | 177 | int symbol__alloc_hist(struct symbol *sym); |
170 | void symbol__annotate_zero_histograms(struct symbol *sym); | 178 | void symbol__annotate_zero_histograms(struct symbol *sym); |
171 | 179 | ||
172 | int symbol__disassemble(struct symbol *sym, struct map *map, | 180 | int symbol__annotate(struct symbol *sym, struct map *map, |
173 | const char *arch_name, size_t privsize, | 181 | struct perf_evsel *evsel, size_t privsize, |
174 | struct arch **parch, char *cpuid); | 182 | struct arch **parch); |
175 | 183 | ||
176 | enum symbol_disassemble_errno { | 184 | enum symbol_disassemble_errno { |
177 | SYMBOL_ANNOTATE_ERRNO__SUCCESS = 0, | 185 | SYMBOL_ANNOTATE_ERRNO__SUCCESS = 0, |
@@ -198,7 +206,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, | |||
198 | int min_pcnt, int max_lines, int context); | 206 | int min_pcnt, int max_lines, int context); |
199 | void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); | 207 | void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); |
200 | void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); | 208 | void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); |
201 | void disasm__purge(struct list_head *head); | 209 | void annotated_source__purge(struct annotated_source *as); |
202 | 210 | ||
203 | bool ui__has_annotation(void); | 211 | bool ui__has_annotation(void); |
204 | 212 | ||