diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-02-14 01:29:38 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-02-14 01:29:38 -0500 |
commit | 277d6f1dcae09aed63cd4c7900a280b0e18cf2ca (patch) | |
tree | fef746abe14f0cff91621405e501855df85d915d /tools | |
parent | 210f400d68a14bc89e2e61dc2e06cdd67cfeb5f6 (diff) | |
parent | a734fb5d60067a73dd7099a58756847c07f9cd68 (diff) |
Merge tag 'perf-core-for-mingo-4.11-20170213' 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:
- Introduce the 'delta-abs' 'perf diff' compute method, that orders the
histogram entries by the absolute value of the percentage delta for a
function in two perf.data files, i.e. the functions that changed the
most (increase or decrease in samples) comes first (Namhyung Kim)
User visible changes:
- Improve message about tweaking the kernel.perf_event_paranoid setting,
telling how to make the change permanent by editing /etc/sysctl.conf
(Arnaldo Carvalho de Melo)
Infrastructure changes:
- Introduce linux/compiler-gcc.h as a counterpart to the kernel's,
initially containing the definition of __fallthrough, more to
come (__maybe_unused, etc) (Arnaldo Carvalho de Melo)
- Fixes for problems uncovered by building tools/perf with clang, such
as always true tests of arrays against NULL and variables that sometimes
were used without being initialized (Arnaldo Carvalho de Melo, Steven Rostedt)
- Before loading a new ELF, clear global variables set by the
samples/bpf loader (Mickaël Salaün)
- Ignore already processed ELF sections in the samples/bpf
loader (Mickaël Salaün)
- Fix compile error in the scripting code with some perl5
versions (Wang YanQing)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/include/linux/compiler-gcc.h | 14 | ||||
-rw-r--r-- | tools/include/linux/compiler.h | 10 | ||||
-rw-r--r-- | tools/lib/traceevent/kbuffer-parse.c | 1 | ||||
-rw-r--r-- | tools/lib/traceevent/plugin_function.c | 2 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-config.txt | 12 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-diff.txt | 15 | ||||
-rw-r--r-- | tools/perf/MANIFEST | 1 | ||||
-rw-r--r-- | tools/perf/builtin-diff.c | 78 | ||||
-rw-r--r-- | tools/perf/builtin-kmem.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-sched.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-stat.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/perf-record.c | 2 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 4 | ||||
-rw-r--r-- | tools/perf/util/evsel_fprintf.c | 1 | ||||
-rw-r--r-- | tools/perf/util/machine.c | 2 | ||||
-rw-r--r-- | tools/perf/util/map.c | 4 | ||||
-rw-r--r-- | tools/perf/util/scripting-engines/Build | 2 | ||||
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-perl.c | 4 | ||||
-rw-r--r-- | tools/perf/util/symbol_fprintf.c | 2 |
21 files changed, 137 insertions, 29 deletions
diff --git a/tools/include/linux/compiler-gcc.h b/tools/include/linux/compiler-gcc.h new file mode 100644 index 000000000000..48af2f10a42d --- /dev/null +++ b/tools/include/linux/compiler-gcc.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef _TOOLS_LINUX_COMPILER_H_ | ||
2 | #error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead." | ||
3 | #endif | ||
4 | |||
5 | /* | ||
6 | * Common definitions for all gcc versions go here. | ||
7 | */ | ||
8 | #define GCC_VERSION (__GNUC__ * 10000 \ | ||
9 | + __GNUC_MINOR__ * 100 \ | ||
10 | + __GNUC_PATCHLEVEL__) | ||
11 | |||
12 | #if GCC_VERSION >= 70000 && !defined(__CHECKER__) | ||
13 | # define __fallthrough __attribute__ ((fallthrough)) | ||
14 | #endif | ||
diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h index d94179f94caa..6326ede9aece 100644 --- a/tools/include/linux/compiler.h +++ b/tools/include/linux/compiler.h | |||
@@ -1,6 +1,10 @@ | |||
1 | #ifndef _TOOLS_LINUX_COMPILER_H_ | 1 | #ifndef _TOOLS_LINUX_COMPILER_H_ |
2 | #define _TOOLS_LINUX_COMPILER_H_ | 2 | #define _TOOLS_LINUX_COMPILER_H_ |
3 | 3 | ||
4 | #ifdef __GNUC__ | ||
5 | #include <linux/compiler-gcc.h> | ||
6 | #endif | ||
7 | |||
4 | /* Optimization barrier */ | 8 | /* Optimization barrier */ |
5 | /* The "volatile" is due to gcc bugs */ | 9 | /* The "volatile" is due to gcc bugs */ |
6 | #define barrier() __asm__ __volatile__("": : :"memory") | 10 | #define barrier() __asm__ __volatile__("": : :"memory") |
@@ -128,11 +132,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s | |||
128 | 132 | ||
129 | 133 | ||
130 | #ifndef __fallthrough | 134 | #ifndef __fallthrough |
131 | # if defined(__GNUC__) && __GNUC__ >= 7 | 135 | # define __fallthrough |
132 | # define __fallthrough __attribute__ ((fallthrough)) | ||
133 | # else | ||
134 | # define __fallthrough | ||
135 | # endif | ||
136 | #endif | 136 | #endif |
137 | 137 | ||
138 | #endif /* _TOOLS_LINUX_COMPILER_H */ | 138 | #endif /* _TOOLS_LINUX_COMPILER_H */ |
diff --git a/tools/lib/traceevent/kbuffer-parse.c b/tools/lib/traceevent/kbuffer-parse.c index 65984f1c2974..c94e3641b046 100644 --- a/tools/lib/traceevent/kbuffer-parse.c +++ b/tools/lib/traceevent/kbuffer-parse.c | |||
@@ -315,6 +315,7 @@ static unsigned int old_update_pointers(struct kbuffer *kbuf) | |||
315 | extend += delta; | 315 | extend += delta; |
316 | delta = extend; | 316 | delta = extend; |
317 | ptr += 4; | 317 | ptr += 4; |
318 | length = 0; | ||
318 | break; | 319 | break; |
319 | 320 | ||
320 | case OLD_RINGBUF_TYPE_TIME_STAMP: | 321 | case OLD_RINGBUF_TYPE_TIME_STAMP: |
diff --git a/tools/lib/traceevent/plugin_function.c b/tools/lib/traceevent/plugin_function.c index a00ec190821a..42dbf73758f3 100644 --- a/tools/lib/traceevent/plugin_function.c +++ b/tools/lib/traceevent/plugin_function.c | |||
@@ -130,7 +130,7 @@ static int function_handler(struct trace_seq *s, struct pevent_record *record, | |||
130 | unsigned long long pfunction; | 130 | unsigned long long pfunction; |
131 | const char *func; | 131 | const char *func; |
132 | const char *parent; | 132 | const char *parent; |
133 | int index; | 133 | int index = 0; |
134 | 134 | ||
135 | if (pevent_get_field_val(s, event, "ip", record, &function, 1)) | 135 | if (pevent_get_field_val(s, event, "ip", record, &function, 1)) |
136 | return trace_seq_putc(s, '!'); | 136 | return trace_seq_putc(s, '!'); |
diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt index 9365b75fd04f..5b4fff3adc4b 100644 --- a/tools/perf/Documentation/perf-config.txt +++ b/tools/perf/Documentation/perf-config.txt | |||
@@ -498,6 +498,18 @@ record.*:: | |||
498 | But if this option is 'no-cache', it will not update the build-id cache. | 498 | But if this option is 'no-cache', it will not update the build-id cache. |
499 | 'skip' skips post-processing and does not update the cache. | 499 | 'skip' skips post-processing and does not update the cache. |
500 | 500 | ||
501 | diff.*:: | ||
502 | diff.order:: | ||
503 | This option sets the number of columns to sort the result. | ||
504 | The default is 0, which means sorting by baseline. | ||
505 | Setting it to 1 will sort the result by delta (or other | ||
506 | compute method selected). | ||
507 | |||
508 | diff.compute:: | ||
509 | This options sets the method for computing the diff result. | ||
510 | Possible values are 'delta', 'delta-abs', 'ratio' and | ||
511 | 'wdiff'. Default is 'delta'. | ||
512 | |||
501 | SEE ALSO | 513 | SEE ALSO |
502 | -------- | 514 | -------- |
503 | linkperf:perf[1] | 515 | linkperf:perf[1] |
diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt index 3e9490b9c533..66dbe3dee74b 100644 --- a/tools/perf/Documentation/perf-diff.txt +++ b/tools/perf/Documentation/perf-diff.txt | |||
@@ -86,8 +86,9 @@ OPTIONS | |||
86 | 86 | ||
87 | -c:: | 87 | -c:: |
88 | --compute:: | 88 | --compute:: |
89 | Differential computation selection - delta,ratio,wdiff (default is delta). | 89 | Differential computation selection - delta, ratio, wdiff, delta-abs |
90 | See COMPARISON METHODS section for more info. | 90 | (default is delta-abs). Default can be changed using diff.compute |
91 | config option. See COMPARISON METHODS section for more info. | ||
91 | 92 | ||
92 | -p:: | 93 | -p:: |
93 | --period:: | 94 | --period:: |
@@ -99,7 +100,11 @@ OPTIONS | |||
99 | 100 | ||
100 | -o:: | 101 | -o:: |
101 | --order:: | 102 | --order:: |
102 | Specify compute sorting column number. | 103 | Specify compute sorting column number. 0 means sorting by baseline |
104 | overhead and 1 (default) means sorting by computed value of column 1 | ||
105 | (data from the first file other base baseline). Values more than 1 | ||
106 | can be used only if enough data files are provided. | ||
107 | The default value can be set using the diff.order config option. | ||
103 | 108 | ||
104 | --percentage:: | 109 | --percentage:: |
105 | Determine how to display the overhead percentage of filtered entries. | 110 | Determine how to display the overhead percentage of filtered entries. |
@@ -181,6 +186,10 @@ with: | |||
181 | relative to how entries are filtered. Use --percentage=absolute to | 186 | relative to how entries are filtered. Use --percentage=absolute to |
182 | prevent such fluctuation. | 187 | prevent such fluctuation. |
183 | 188 | ||
189 | delta-abs | ||
190 | ~~~~~~~~~ | ||
191 | Same as 'delta` method, but sort the result with the absolute values. | ||
192 | |||
184 | ratio | 193 | ratio |
185 | ~~~~~ | 194 | ~~~~~ |
186 | If specified the 'Ratio' column is displayed with value 'r' computed as: | 195 | If specified the 'Ratio' column is displayed with value 'r' computed as: |
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST index a511e5f31e36..8672f835ae4e 100644 --- a/tools/perf/MANIFEST +++ b/tools/perf/MANIFEST | |||
@@ -61,6 +61,7 @@ tools/include/asm-generic/bitops.h | |||
61 | tools/include/linux/atomic.h | 61 | tools/include/linux/atomic.h |
62 | tools/include/linux/bitops.h | 62 | tools/include/linux/bitops.h |
63 | tools/include/linux/compiler.h | 63 | tools/include/linux/compiler.h |
64 | tools/include/linux/compiler-gcc.h | ||
64 | tools/include/linux/coresight-pmu.h | 65 | tools/include/linux/coresight-pmu.h |
65 | tools/include/linux/filter.h | 66 | tools/include/linux/filter.h |
66 | tools/include/linux/hash.h | 67 | tools/include/linux/hash.h |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 933aeec46f4a..70a289347591 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "util/symbol.h" | 17 | #include "util/symbol.h" |
18 | #include "util/util.h" | 18 | #include "util/util.h" |
19 | #include "util/data.h" | 19 | #include "util/data.h" |
20 | #include "util/config.h" | ||
20 | 21 | ||
21 | #include <stdlib.h> | 22 | #include <stdlib.h> |
22 | #include <math.h> | 23 | #include <math.h> |
@@ -30,6 +31,7 @@ enum { | |||
30 | PERF_HPP_DIFF__RATIO, | 31 | PERF_HPP_DIFF__RATIO, |
31 | PERF_HPP_DIFF__WEIGHTED_DIFF, | 32 | PERF_HPP_DIFF__WEIGHTED_DIFF, |
32 | PERF_HPP_DIFF__FORMULA, | 33 | PERF_HPP_DIFF__FORMULA, |
34 | PERF_HPP_DIFF__DELTA_ABS, | ||
33 | 35 | ||
34 | PERF_HPP_DIFF__MAX_INDEX | 36 | PERF_HPP_DIFF__MAX_INDEX |
35 | }; | 37 | }; |
@@ -64,7 +66,7 @@ static bool force; | |||
64 | static bool show_period; | 66 | static bool show_period; |
65 | static bool show_formula; | 67 | static bool show_formula; |
66 | static bool show_baseline_only; | 68 | static bool show_baseline_only; |
67 | static unsigned int sort_compute; | 69 | static unsigned int sort_compute = 1; |
68 | 70 | ||
69 | static s64 compute_wdiff_w1; | 71 | static s64 compute_wdiff_w1; |
70 | static s64 compute_wdiff_w2; | 72 | static s64 compute_wdiff_w2; |
@@ -73,19 +75,22 @@ enum { | |||
73 | COMPUTE_DELTA, | 75 | COMPUTE_DELTA, |
74 | COMPUTE_RATIO, | 76 | COMPUTE_RATIO, |
75 | COMPUTE_WEIGHTED_DIFF, | 77 | COMPUTE_WEIGHTED_DIFF, |
78 | COMPUTE_DELTA_ABS, | ||
76 | COMPUTE_MAX, | 79 | COMPUTE_MAX, |
77 | }; | 80 | }; |
78 | 81 | ||
79 | const char *compute_names[COMPUTE_MAX] = { | 82 | const char *compute_names[COMPUTE_MAX] = { |
80 | [COMPUTE_DELTA] = "delta", | 83 | [COMPUTE_DELTA] = "delta", |
84 | [COMPUTE_DELTA_ABS] = "delta-abs", | ||
81 | [COMPUTE_RATIO] = "ratio", | 85 | [COMPUTE_RATIO] = "ratio", |
82 | [COMPUTE_WEIGHTED_DIFF] = "wdiff", | 86 | [COMPUTE_WEIGHTED_DIFF] = "wdiff", |
83 | }; | 87 | }; |
84 | 88 | ||
85 | static int compute; | 89 | static int compute = COMPUTE_DELTA_ABS; |
86 | 90 | ||
87 | static int compute_2_hpp[COMPUTE_MAX] = { | 91 | static int compute_2_hpp[COMPUTE_MAX] = { |
88 | [COMPUTE_DELTA] = PERF_HPP_DIFF__DELTA, | 92 | [COMPUTE_DELTA] = PERF_HPP_DIFF__DELTA, |
93 | [COMPUTE_DELTA_ABS] = PERF_HPP_DIFF__DELTA_ABS, | ||
89 | [COMPUTE_RATIO] = PERF_HPP_DIFF__RATIO, | 94 | [COMPUTE_RATIO] = PERF_HPP_DIFF__RATIO, |
90 | [COMPUTE_WEIGHTED_DIFF] = PERF_HPP_DIFF__WEIGHTED_DIFF, | 95 | [COMPUTE_WEIGHTED_DIFF] = PERF_HPP_DIFF__WEIGHTED_DIFF, |
91 | }; | 96 | }; |
@@ -111,6 +116,10 @@ static struct header_column { | |||
111 | .name = "Delta", | 116 | .name = "Delta", |
112 | .width = 7, | 117 | .width = 7, |
113 | }, | 118 | }, |
119 | [PERF_HPP_DIFF__DELTA_ABS] = { | ||
120 | .name = "Delta Abs", | ||
121 | .width = 7, | ||
122 | }, | ||
114 | [PERF_HPP_DIFF__RATIO] = { | 123 | [PERF_HPP_DIFF__RATIO] = { |
115 | .name = "Ratio", | 124 | .name = "Ratio", |
116 | .width = 14, | 125 | .width = 14, |
@@ -298,6 +307,7 @@ static int formula_fprintf(struct hist_entry *he, struct hist_entry *pair, | |||
298 | { | 307 | { |
299 | switch (compute) { | 308 | switch (compute) { |
300 | case COMPUTE_DELTA: | 309 | case COMPUTE_DELTA: |
310 | case COMPUTE_DELTA_ABS: | ||
301 | return formula_delta(he, pair, buf, size); | 311 | return formula_delta(he, pair, buf, size); |
302 | case COMPUTE_RATIO: | 312 | case COMPUTE_RATIO: |
303 | return formula_ratio(he, pair, buf, size); | 313 | return formula_ratio(he, pair, buf, size); |
@@ -461,6 +471,7 @@ static void hists__precompute(struct hists *hists) | |||
461 | 471 | ||
462 | switch (compute) { | 472 | switch (compute) { |
463 | case COMPUTE_DELTA: | 473 | case COMPUTE_DELTA: |
474 | case COMPUTE_DELTA_ABS: | ||
464 | compute_delta(he, pair); | 475 | compute_delta(he, pair); |
465 | break; | 476 | break; |
466 | case COMPUTE_RATIO: | 477 | case COMPUTE_RATIO: |
@@ -498,6 +509,13 @@ __hist_entry__cmp_compute(struct hist_entry *left, struct hist_entry *right, | |||
498 | 509 | ||
499 | return cmp_doubles(l, r); | 510 | return cmp_doubles(l, r); |
500 | } | 511 | } |
512 | case COMPUTE_DELTA_ABS: | ||
513 | { | ||
514 | double l = fabs(left->diff.period_ratio_delta); | ||
515 | double r = fabs(right->diff.period_ratio_delta); | ||
516 | |||
517 | return cmp_doubles(l, r); | ||
518 | } | ||
501 | case COMPUTE_RATIO: | 519 | case COMPUTE_RATIO: |
502 | { | 520 | { |
503 | double l = left->diff.period_ratio; | 521 | double l = left->diff.period_ratio; |
@@ -564,7 +582,7 @@ hist_entry__cmp_compute_idx(struct hist_entry *left, struct hist_entry *right, | |||
564 | if (!p_left || !p_right) | 582 | if (!p_left || !p_right) |
565 | return p_left ? -1 : 1; | 583 | return p_left ? -1 : 1; |
566 | 584 | ||
567 | if (c != COMPUTE_DELTA) { | 585 | if (c != COMPUTE_DELTA && c != COMPUTE_DELTA_ABS) { |
568 | /* | 586 | /* |
569 | * The delta can be computed without the baseline, but | 587 | * The delta can be computed without the baseline, but |
570 | * others are not. Put those entries which have no | 588 | * others are not. Put those entries which have no |
@@ -607,6 +625,15 @@ hist_entry__cmp_delta(struct perf_hpp_fmt *fmt, | |||
607 | } | 625 | } |
608 | 626 | ||
609 | static int64_t | 627 | static int64_t |
628 | hist_entry__cmp_delta_abs(struct perf_hpp_fmt *fmt, | ||
629 | struct hist_entry *left, struct hist_entry *right) | ||
630 | { | ||
631 | struct data__file *d = fmt_to_data_file(fmt); | ||
632 | |||
633 | return hist_entry__cmp_compute(right, left, COMPUTE_DELTA_ABS, d->idx); | ||
634 | } | ||
635 | |||
636 | static int64_t | ||
610 | hist_entry__cmp_ratio(struct perf_hpp_fmt *fmt, | 637 | hist_entry__cmp_ratio(struct perf_hpp_fmt *fmt, |
611 | struct hist_entry *left, struct hist_entry *right) | 638 | struct hist_entry *left, struct hist_entry *right) |
612 | { | 639 | { |
@@ -633,6 +660,14 @@ hist_entry__cmp_delta_idx(struct perf_hpp_fmt *fmt __maybe_unused, | |||
633 | } | 660 | } |
634 | 661 | ||
635 | static int64_t | 662 | static int64_t |
663 | hist_entry__cmp_delta_abs_idx(struct perf_hpp_fmt *fmt __maybe_unused, | ||
664 | struct hist_entry *left, struct hist_entry *right) | ||
665 | { | ||
666 | return hist_entry__cmp_compute_idx(right, left, COMPUTE_DELTA_ABS, | ||
667 | sort_compute); | ||
668 | } | ||
669 | |||
670 | static int64_t | ||
636 | hist_entry__cmp_ratio_idx(struct perf_hpp_fmt *fmt __maybe_unused, | 671 | hist_entry__cmp_ratio_idx(struct perf_hpp_fmt *fmt __maybe_unused, |
637 | struct hist_entry *left, struct hist_entry *right) | 672 | struct hist_entry *left, struct hist_entry *right) |
638 | { | 673 | { |
@@ -775,7 +810,7 @@ static const struct option options[] = { | |||
775 | OPT_BOOLEAN('b', "baseline-only", &show_baseline_only, | 810 | OPT_BOOLEAN('b', "baseline-only", &show_baseline_only, |
776 | "Show only items with match in baseline"), | 811 | "Show only items with match in baseline"), |
777 | OPT_CALLBACK('c', "compute", &compute, | 812 | OPT_CALLBACK('c', "compute", &compute, |
778 | "delta,ratio,wdiff:w1,w2 (default delta)", | 813 | "delta,delta-abs,ratio,wdiff:w1,w2 (default delta-abs)", |
779 | "Entries differential computation selection", | 814 | "Entries differential computation selection", |
780 | setup_compute), | 815 | setup_compute), |
781 | OPT_BOOLEAN('p', "period", &show_period, | 816 | OPT_BOOLEAN('p', "period", &show_period, |
@@ -945,6 +980,7 @@ hpp__entry_pair(struct hist_entry *he, struct hist_entry *pair, | |||
945 | 980 | ||
946 | switch (idx) { | 981 | switch (idx) { |
947 | case PERF_HPP_DIFF__DELTA: | 982 | case PERF_HPP_DIFF__DELTA: |
983 | case PERF_HPP_DIFF__DELTA_ABS: | ||
948 | if (pair->diff.computed) | 984 | if (pair->diff.computed) |
949 | diff = pair->diff.period_ratio_delta; | 985 | diff = pair->diff.period_ratio_delta; |
950 | else | 986 | else |
@@ -1118,6 +1154,10 @@ static void data__hpp_register(struct data__file *d, int idx) | |||
1118 | fmt->color = hpp__color_wdiff; | 1154 | fmt->color = hpp__color_wdiff; |
1119 | fmt->sort = hist_entry__cmp_wdiff; | 1155 | fmt->sort = hist_entry__cmp_wdiff; |
1120 | break; | 1156 | break; |
1157 | case PERF_HPP_DIFF__DELTA_ABS: | ||
1158 | fmt->color = hpp__color_delta; | ||
1159 | fmt->sort = hist_entry__cmp_delta_abs; | ||
1160 | break; | ||
1121 | default: | 1161 | default: |
1122 | fmt->sort = hist_entry__cmp_nop; | 1162 | fmt->sort = hist_entry__cmp_nop; |
1123 | break; | 1163 | break; |
@@ -1195,6 +1235,9 @@ static int ui_init(void) | |||
1195 | case COMPUTE_WEIGHTED_DIFF: | 1235 | case COMPUTE_WEIGHTED_DIFF: |
1196 | fmt->sort = hist_entry__cmp_wdiff_idx; | 1236 | fmt->sort = hist_entry__cmp_wdiff_idx; |
1197 | break; | 1237 | break; |
1238 | case COMPUTE_DELTA_ABS: | ||
1239 | fmt->sort = hist_entry__cmp_delta_abs_idx; | ||
1240 | break; | ||
1198 | default: | 1241 | default: |
1199 | BUG_ON(1); | 1242 | BUG_ON(1); |
1200 | } | 1243 | } |
@@ -1249,6 +1292,31 @@ static int data_init(int argc, const char **argv) | |||
1249 | return 0; | 1292 | return 0; |
1250 | } | 1293 | } |
1251 | 1294 | ||
1295 | static int diff__config(const char *var, const char *value, | ||
1296 | void *cb __maybe_unused) | ||
1297 | { | ||
1298 | if (!strcmp(var, "diff.order")) { | ||
1299 | sort_compute = perf_config_int(var, value); | ||
1300 | return 0; | ||
1301 | } | ||
1302 | if (!strcmp(var, "diff.compute")) { | ||
1303 | if (!strcmp(value, "delta")) { | ||
1304 | compute = COMPUTE_DELTA; | ||
1305 | } else if (!strcmp(value, "delta-abs")) { | ||
1306 | compute = COMPUTE_DELTA_ABS; | ||
1307 | } else if (!strcmp(value, "ratio")) { | ||
1308 | compute = COMPUTE_RATIO; | ||
1309 | } else if (!strcmp(value, "wdiff")) { | ||
1310 | compute = COMPUTE_WEIGHTED_DIFF; | ||
1311 | } else { | ||
1312 | pr_err("Invalid compute method: %s\n", value); | ||
1313 | return -1; | ||
1314 | } | ||
1315 | } | ||
1316 | |||
1317 | return 0; | ||
1318 | } | ||
1319 | |||
1252 | int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) | 1320 | int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) |
1253 | { | 1321 | { |
1254 | int ret = hists__init(); | 1322 | int ret = hists__init(); |
@@ -1256,6 +1324,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1256 | if (ret < 0) | 1324 | if (ret < 0) |
1257 | return ret; | 1325 | return ret; |
1258 | 1326 | ||
1327 | perf_config(diff__config, NULL); | ||
1328 | |||
1259 | argc = parse_options(argc, argv, options, diff_usage, 0); | 1329 | argc = parse_options(argc, argv, options, diff_usage, 0); |
1260 | 1330 | ||
1261 | if (symbol__init(NULL) < 0) | 1331 | if (symbol__init(NULL) < 0) |
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 29f4751a3574..6da8d083e4e5 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -1065,7 +1065,7 @@ static void __print_page_alloc_result(struct perf_session *session, int n_lines) | |||
1065 | 1065 | ||
1066 | data = rb_entry(next, struct page_stat, node); | 1066 | data = rb_entry(next, struct page_stat, node); |
1067 | sym = machine__find_kernel_function(machine, data->callsite, &map); | 1067 | sym = machine__find_kernel_function(machine, data->callsite, &map); |
1068 | if (sym && sym->name) | 1068 | if (sym) |
1069 | caller = sym->name; | 1069 | caller = sym->name; |
1070 | else | 1070 | else |
1071 | scnprintf(buf, sizeof(buf), "%"PRIx64, data->callsite); | 1071 | scnprintf(buf, sizeof(buf), "%"PRIx64, data->callsite); |
@@ -1107,7 +1107,7 @@ static void __print_page_caller_result(struct perf_session *session, int n_lines | |||
1107 | 1107 | ||
1108 | data = rb_entry(next, struct page_stat, node); | 1108 | data = rb_entry(next, struct page_stat, node); |
1109 | sym = machine__find_kernel_function(machine, data->callsite, &map); | 1109 | sym = machine__find_kernel_function(machine, data->callsite, &map); |
1110 | if (sym && sym->name) | 1110 | if (sym) |
1111 | caller = sym->name; | 1111 | caller = sym->name; |
1112 | else | 1112 | else |
1113 | scnprintf(buf, sizeof(buf), "%"PRIx64, data->callsite); | 1113 | scnprintf(buf, sizeof(buf), "%"PRIx64, data->callsite); |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index ffac8ca9fb01..2ddf189968dc 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -418,7 +418,7 @@ static int record__mmap(struct record *rec) | |||
418 | 418 | ||
419 | static int record__open(struct record *rec) | 419 | static int record__open(struct record *rec) |
420 | { | 420 | { |
421 | char msg[512]; | 421 | char msg[BUFSIZ]; |
422 | struct perf_evsel *pos; | 422 | struct perf_evsel *pos; |
423 | struct perf_evlist *evlist = rec->evlist; | 423 | struct perf_evlist *evlist = rec->evlist; |
424 | struct perf_session *session = rec->session; | 424 | struct perf_session *session = rec->session; |
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index daceb3202200..270eb2d8ca6b 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -2067,7 +2067,7 @@ static void save_task_callchain(struct perf_sched *sched, | |||
2067 | break; | 2067 | break; |
2068 | 2068 | ||
2069 | sym = node->sym; | 2069 | sym = node->sym; |
2070 | if (sym && sym->name) { | 2070 | if (sym) { |
2071 | if (!strcmp(sym->name, "schedule") || | 2071 | if (!strcmp(sym->name, "schedule") || |
2072 | !strcmp(sym->name, "__schedule") || | 2072 | !strcmp(sym->name, "__schedule") || |
2073 | !strcmp(sym->name, "preempt_schedule")) | 2073 | !strcmp(sym->name, "preempt_schedule")) |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index a02f2e965628..f28719178b51 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -533,7 +533,7 @@ static int store_counter_ids(struct perf_evsel *counter) | |||
533 | static int __run_perf_stat(int argc, const char **argv) | 533 | static int __run_perf_stat(int argc, const char **argv) |
534 | { | 534 | { |
535 | int interval = stat_config.interval; | 535 | int interval = stat_config.interval; |
536 | char msg[512]; | 536 | char msg[BUFSIZ]; |
537 | unsigned long long t0, t1; | 537 | unsigned long long t0, t1; |
538 | struct perf_evsel *counter; | 538 | struct perf_evsel *counter; |
539 | struct timespec ts; | 539 | struct timespec ts; |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index d90927f31ff6..5a7fd7af3a6d 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -859,7 +859,7 @@ static void perf_top__mmap_read(struct perf_top *top) | |||
859 | 859 | ||
860 | static int perf_top__start_counters(struct perf_top *top) | 860 | static int perf_top__start_counters(struct perf_top *top) |
861 | { | 861 | { |
862 | char msg[512]; | 862 | char msg[BUFSIZ]; |
863 | struct perf_evsel *counter; | 863 | struct perf_evsel *counter; |
864 | struct perf_evlist *evlist = top->evlist; | 864 | struct perf_evlist *evlist = top->evlist; |
865 | struct record_opts *opts = &top->record_opts; | 865 | struct record_opts *opts = &top->record_opts; |
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c index 8f2e1de6d0ea..541da7a68f91 100644 --- a/tools/perf/tests/perf-record.c +++ b/tools/perf/tests/perf-record.c | |||
@@ -66,7 +66,7 @@ int test__PERF_RECORD(int subtest __maybe_unused) | |||
66 | if (evlist == NULL) /* Fallback for kernels lacking PERF_COUNT_SW_DUMMY */ | 66 | if (evlist == NULL) /* Fallback for kernels lacking PERF_COUNT_SW_DUMMY */ |
67 | evlist = perf_evlist__new_default(); | 67 | evlist = perf_evlist__new_default(); |
68 | 68 | ||
69 | if (evlist == NULL || argv == NULL) { | 69 | if (evlist == NULL) { |
70 | pr_debug("Not enough memory to create evlist\n"); | 70 | pr_debug("Not enough memory to create evlist\n"); |
71 | goto out; | 71 | goto out; |
72 | } | 72 | } |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 04e536ae4d88..cd2fb42e5dd4 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -2469,7 +2469,9 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target, | |||
2469 | " -1: Allow use of (almost) all events by all users\n" | 2469 | " -1: Allow use of (almost) all events by all users\n" |
2470 | ">= 0: Disallow raw tracepoint access by users without CAP_IOC_LOCK\n" | 2470 | ">= 0: Disallow raw tracepoint access by users without CAP_IOC_LOCK\n" |
2471 | ">= 1: Disallow CPU event access by users without CAP_SYS_ADMIN\n" | 2471 | ">= 1: Disallow CPU event access by users without CAP_SYS_ADMIN\n" |
2472 | ">= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN", | 2472 | ">= 2: Disallow kernel profiling by users without CAP_SYS_ADMIN\n\n" |
2473 | "To make this setting permanent, edit /etc/sysctl.conf too, e.g.:\n\n" | ||
2474 | " kernel.perf_event_paranoid = -1\n" , | ||
2473 | target->system_wide ? "system-wide " : "", | 2475 | target->system_wide ? "system-wide " : "", |
2474 | perf_event_paranoid()); | 2476 | perf_event_paranoid()); |
2475 | case ENOENT: | 2477 | case ENOENT: |
diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c index 6b2925542c0a..4ef5184819a0 100644 --- a/tools/perf/util/evsel_fprintf.c +++ b/tools/perf/util/evsel_fprintf.c | |||
@@ -168,7 +168,6 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment, | |||
168 | 168 | ||
169 | if (symbol_conf.bt_stop_list && | 169 | if (symbol_conf.bt_stop_list && |
170 | node->sym && | 170 | node->sym && |
171 | node->sym->name && | ||
172 | strlist__has_entry(symbol_conf.bt_stop_list, | 171 | strlist__has_entry(symbol_conf.bt_stop_list, |
173 | node->sym->name)) { | 172 | node->sym->name)) { |
174 | break; | 173 | break; |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 747a034d1ff3..a1043cf9b89c 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -1565,7 +1565,7 @@ int machine__process_event(struct machine *machine, union perf_event *event, | |||
1565 | 1565 | ||
1566 | static bool symbol__match_regex(struct symbol *sym, regex_t *regex) | 1566 | static bool symbol__match_regex(struct symbol *sym, regex_t *regex) |
1567 | { | 1567 | { |
1568 | if (sym->name && !regexec(regex, sym->name, 0, NULL, 0)) | 1568 | if (!regexec(regex, sym->name, 0, NULL, 0)) |
1569 | return 1; | 1569 | return 1; |
1570 | return 0; | 1570 | return 0; |
1571 | } | 1571 | } |
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 4f9a71c63026..0a943e7b1ea7 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -387,10 +387,10 @@ size_t map__fprintf_dsoname(struct map *map, FILE *fp) | |||
387 | { | 387 | { |
388 | const char *dsoname = "[unknown]"; | 388 | const char *dsoname = "[unknown]"; |
389 | 389 | ||
390 | if (map && map->dso && (map->dso->name || map->dso->long_name)) { | 390 | if (map && map->dso) { |
391 | if (symbol_conf.show_kernel_path && map->dso->long_name) | 391 | if (symbol_conf.show_kernel_path && map->dso->long_name) |
392 | dsoname = map->dso->long_name; | 392 | dsoname = map->dso->long_name; |
393 | else if (map->dso->name) | 393 | else |
394 | dsoname = map->dso->name; | 394 | dsoname = map->dso->name; |
395 | } | 395 | } |
396 | 396 | ||
diff --git a/tools/perf/util/scripting-engines/Build b/tools/perf/util/scripting-engines/Build index 6516e220c247..82d28c67e0f3 100644 --- a/tools/perf/util/scripting-engines/Build +++ b/tools/perf/util/scripting-engines/Build | |||
@@ -1,6 +1,6 @@ | |||
1 | libperf-$(CONFIG_LIBPERL) += trace-event-perl.o | 1 | libperf-$(CONFIG_LIBPERL) += trace-event-perl.o |
2 | libperf-$(CONFIG_LIBPYTHON) += trace-event-python.o | 2 | libperf-$(CONFIG_LIBPYTHON) += trace-event-python.o |
3 | 3 | ||
4 | CFLAGS_trace-event-perl.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-undef -Wno-switch-default | 4 | CFLAGS_trace-event-perl.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-nested-externs -Wno-undef -Wno-switch-default |
5 | 5 | ||
6 | CFLAGS_trace-event-python.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow | 6 | CFLAGS_trace-event-python.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow |
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c index 014ecd6f67c4..c1555fd0035a 100644 --- a/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/tools/perf/util/scripting-engines/trace-event-perl.c | |||
@@ -309,10 +309,10 @@ static SV *perl_process_callchain(struct perf_sample *sample, | |||
309 | if (node->map) { | 309 | if (node->map) { |
310 | struct map *map = node->map; | 310 | struct map *map = node->map; |
311 | const char *dsoname = "[unknown]"; | 311 | const char *dsoname = "[unknown]"; |
312 | if (map && map->dso && (map->dso->name || map->dso->long_name)) { | 312 | if (map && map->dso) { |
313 | if (symbol_conf.show_kernel_path && map->dso->long_name) | 313 | if (symbol_conf.show_kernel_path && map->dso->long_name) |
314 | dsoname = map->dso->long_name; | 314 | dsoname = map->dso->long_name; |
315 | else if (map->dso->name) | 315 | else |
316 | dsoname = map->dso->name; | 316 | dsoname = map->dso->name; |
317 | } | 317 | } |
318 | if (!hv_stores(elem, "dso", newSVpv(dsoname,0))) { | 318 | if (!hv_stores(elem, "dso", newSVpv(dsoname,0))) { |
diff --git a/tools/perf/util/symbol_fprintf.c b/tools/perf/util/symbol_fprintf.c index 7c6b33e8e2d2..63694e174e5c 100644 --- a/tools/perf/util/symbol_fprintf.c +++ b/tools/perf/util/symbol_fprintf.c | |||
@@ -21,7 +21,7 @@ size_t __symbol__fprintf_symname_offs(const struct symbol *sym, | |||
21 | unsigned long offset; | 21 | unsigned long offset; |
22 | size_t length; | 22 | size_t length; |
23 | 23 | ||
24 | if (sym && sym->name) { | 24 | if (sym) { |
25 | length = fprintf(fp, "%s", sym->name); | 25 | length = fprintf(fp, "%s", sym->name); |
26 | if (al && print_offsets) { | 26 | if (al && print_offsets) { |
27 | if (al->addr < sym->end) | 27 | if (al->addr < sym->end) |