diff options
| author | Ingo Molnar <mingo@kernel.org> | 2018-07-12 09:52:35 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2018-07-12 09:52:35 -0400 |
| commit | 6e1d33b24a2b4aebcb05782e937ebc9a7a4a3f50 (patch) | |
| tree | 8f75c8e622d1e85a4cfb3b7695db41d7a6dca95e | |
| parent | 092150a25cb7bd6a79aa00bb1ad131063f58073d (diff) | |
| parent | 32aa928a7b817140c84987b726d5014911808fa4 (diff) | |
Merge tag 'perf-urgent-for-mingo-4.18-20180711' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
python interface fixes:
- Make 'perf script -g python' generate scripts that are compatible
with both python 2 and 3 (Jeremy Cline)
- Fix python dictionary reference counting (Janne Huttunen)
- Add python3 support for various python scripts (Jeremy Cline)
- Use python-config --includes rather than --cflags, fixing the build
on Fedora, where the python 3.7 started adding -flto to what
perf stat fixes:
- Remove needless extra header line in --interval_clear (Jiri Olsa)
python-config --cflags generate, breaking the perf build (Jeremy Cline)
Build fixes:
- Fix compilation errors on gcc8 (Jiri Olsa)
perf llvm-utils fixes:
- Remove bashism from kernel include fetch script (Kim Phillips)
perf test fixes: (Kim Phillips)
- Replace '|&' with '2>&1 |' to work with more shells
- Make perf's inet_pton test more portable
- Prevent temporary editor files from being considered test scripts
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
| -rw-r--r-- | tools/perf/Makefile.config | 3 | ||||
| -rw-r--r-- | tools/perf/arch/x86/util/perf_regs.c | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-stat.c | 2 | ||||
| -rw-r--r-- | tools/perf/jvmti/jvmti_agent.c | 3 | ||||
| -rw-r--r-- | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 40 | ||||
| -rwxr-xr-x | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py | 4 | ||||
| -rw-r--r-- | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py | 2 | ||||
| -rw-r--r-- | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 11 | ||||
| -rw-r--r-- | tools/perf/scripts/python/sched-migration.py | 14 | ||||
| -rw-r--r-- | tools/perf/tests/builtin-test.c | 2 | ||||
| -rwxr-xr-x | tools/perf/tests/shell/record+probe_libc_inet_pton.sh | 37 | ||||
| -rwxr-xr-x | tools/perf/tests/shell/trace+probe_vfs_getname.sh | 2 | ||||
| -rw-r--r-- | tools/perf/util/llvm-utils.c | 6 | ||||
| -rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 37 |
14 files changed, 84 insertions, 81 deletions
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index b5ac356ba323..f5a3b402589e 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config | |||
| @@ -207,8 +207,7 @@ ifdef PYTHON_CONFIG | |||
| 207 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) | 207 | PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) |
| 208 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) | 208 | PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) |
| 209 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil | 209 | PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil |
| 210 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) | 210 | PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null) |
| 211 | PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) | ||
| 212 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) | 211 | FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) |
| 213 | endif | 212 | endif |
| 214 | 213 | ||
diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c index 4b2caf6d48e7..fead6b3b4206 100644 --- a/tools/perf/arch/x86/util/perf_regs.c +++ b/tools/perf/arch/x86/util/perf_regs.c | |||
| @@ -226,7 +226,7 @@ int arch_sdt_arg_parse_op(char *old_op, char **new_op) | |||
| 226 | else if (rm[2].rm_so != rm[2].rm_eo) | 226 | else if (rm[2].rm_so != rm[2].rm_eo) |
| 227 | prefix[0] = '+'; | 227 | prefix[0] = '+'; |
| 228 | else | 228 | else |
| 229 | strncpy(prefix, "+0", 2); | 229 | scnprintf(prefix, sizeof(prefix), "+0"); |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | /* Rename register */ | 232 | /* Rename register */ |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 22547a490e1f..05be023c3f0e 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
| @@ -1742,7 +1742,7 @@ static void print_interval(char *prefix, struct timespec *ts) | |||
| 1742 | } | 1742 | } |
| 1743 | } | 1743 | } |
| 1744 | 1744 | ||
| 1745 | if ((num_print_interval == 0 && metric_only) || interval_clear) | 1745 | if ((num_print_interval == 0 || interval_clear) && metric_only) |
| 1746 | print_metric_headers(" ", true); | 1746 | print_metric_headers(" ", true); |
| 1747 | if (++num_print_interval == 25) | 1747 | if (++num_print_interval == 25) |
| 1748 | num_print_interval = 0; | 1748 | num_print_interval = 0; |
diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c index 0c6d1002b524..ac1bcdc17dae 100644 --- a/tools/perf/jvmti/jvmti_agent.c +++ b/tools/perf/jvmti/jvmti_agent.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <sys/mman.h> | 35 | #include <sys/mman.h> |
| 36 | #include <syscall.h> /* for gettid() */ | 36 | #include <syscall.h> /* for gettid() */ |
| 37 | #include <err.h> | 37 | #include <err.h> |
| 38 | #include <linux/kernel.h> | ||
| 38 | 39 | ||
| 39 | #include "jvmti_agent.h" | 40 | #include "jvmti_agent.h" |
| 40 | #include "../util/jitdump.h" | 41 | #include "../util/jitdump.h" |
| @@ -249,7 +250,7 @@ void *jvmti_open(void) | |||
| 249 | /* | 250 | /* |
| 250 | * jitdump file name | 251 | * jitdump file name |
| 251 | */ | 252 | */ |
| 252 | snprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid()); | 253 | scnprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid()); |
| 253 | 254 | ||
| 254 | fd = open(dump_path, O_CREAT|O_TRUNC|O_RDWR, 0666); | 255 | fd = open(dump_path, O_CREAT|O_TRUNC|O_RDWR, 0666); |
| 255 | if (fd == -1) | 256 | if (fd == -1) |
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py index 38dfb720fb6f..54ace2f6bc36 100644 --- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py +++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | |||
| @@ -31,10 +31,8 @@ def flag_str(event_name, field_name, value): | |||
| 31 | string = "" | 31 | string = "" |
| 32 | 32 | ||
| 33 | if flag_fields[event_name][field_name]: | 33 | if flag_fields[event_name][field_name]: |
| 34 | print_delim = 0 | 34 | print_delim = 0 |
| 35 | keys = flag_fields[event_name][field_name]['values'].keys() | 35 | for idx in sorted(flag_fields[event_name][field_name]['values']): |
| 36 | keys.sort() | ||
| 37 | for idx in keys: | ||
| 38 | if not value and not idx: | 36 | if not value and not idx: |
| 39 | string += flag_fields[event_name][field_name]['values'][idx] | 37 | string += flag_fields[event_name][field_name]['values'][idx] |
| 40 | break | 38 | break |
| @@ -51,14 +49,12 @@ def symbol_str(event_name, field_name, value): | |||
| 51 | string = "" | 49 | string = "" |
| 52 | 50 | ||
| 53 | if symbolic_fields[event_name][field_name]: | 51 | if symbolic_fields[event_name][field_name]: |
| 54 | keys = symbolic_fields[event_name][field_name]['values'].keys() | 52 | for idx in sorted(symbolic_fields[event_name][field_name]['values']): |
| 55 | keys.sort() | ||
| 56 | for idx in keys: | ||
| 57 | if not value and not idx: | 53 | if not value and not idx: |
| 58 | string = symbolic_fields[event_name][field_name]['values'][idx] | 54 | string = symbolic_fields[event_name][field_name]['values'][idx] |
| 59 | break | 55 | break |
| 60 | if (value == idx): | 56 | if (value == idx): |
| 61 | string = symbolic_fields[event_name][field_name]['values'][idx] | 57 | string = symbolic_fields[event_name][field_name]['values'][idx] |
| 62 | break | 58 | break |
| 63 | 59 | ||
| 64 | return string | 60 | return string |
| @@ -74,19 +70,17 @@ def trace_flag_str(value): | |||
| 74 | string = "" | 70 | string = "" |
| 75 | print_delim = 0 | 71 | print_delim = 0 |
| 76 | 72 | ||
| 77 | keys = trace_flags.keys() | 73 | for idx in trace_flags: |
| 78 | 74 | if not value and not idx: | |
| 79 | for idx in keys: | 75 | string += "NONE" |
| 80 | if not value and not idx: | 76 | break |
| 81 | string += "NONE" | 77 | |
| 82 | break | 78 | if idx and (value & idx) == idx: |
| 83 | 79 | if print_delim: | |
| 84 | if idx and (value & idx) == idx: | 80 | string += " | "; |
| 85 | if print_delim: | 81 | string += trace_flags[idx] |
| 86 | string += " | "; | 82 | print_delim = 1 |
| 87 | string += trace_flags[idx] | 83 | value &= ~idx |
| 88 | print_delim = 1 | ||
| 89 | value &= ~idx | ||
| 90 | 84 | ||
| 91 | return string | 85 | return string |
| 92 | 86 | ||
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py index 81a56cd2b3c1..21a7a1298094 100755 --- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py +++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/EventClass.py | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | # PerfEvent is the base class for all perf event sample, PebsEvent | 8 | # PerfEvent is the base class for all perf event sample, PebsEvent |
| 9 | # is a HW base Intel x86 PEBS event, and user could add more SW/HW | 9 | # is a HW base Intel x86 PEBS event, and user could add more SW/HW |
| 10 | # event classes based on requirements. | 10 | # event classes based on requirements. |
| 11 | from __future__ import print_function | ||
| 11 | 12 | ||
| 12 | import struct | 13 | import struct |
| 13 | 14 | ||
| @@ -44,7 +45,8 @@ class PerfEvent(object): | |||
| 44 | PerfEvent.event_num += 1 | 45 | PerfEvent.event_num += 1 |
| 45 | 46 | ||
| 46 | def show(self): | 47 | def show(self): |
| 47 | print "PMU event: name=%12s, symbol=%24s, comm=%8s, dso=%12s" % (self.name, self.symbol, self.comm, self.dso) | 48 | print("PMU event: name=%12s, symbol=%24s, comm=%8s, dso=%12s" % |
| 49 | (self.name, self.symbol, self.comm, self.dso)) | ||
| 48 | 50 | ||
| 49 | # | 51 | # |
| 50 | # Basic Intel PEBS (Precise Event-based Sampling) event, whose raw buffer | 52 | # Basic Intel PEBS (Precise Event-based Sampling) event, whose raw buffer |
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py index fdd92f699055..cac7b2542ee8 100644 --- a/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py +++ b/tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | try: | 11 | try: |
| 12 | import wx | 12 | import wx |
