diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-07-13 16:33:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-07-13 16:33:09 -0400 |
commit | aa0a3247c01535303fc39c2bf0beb4493688a314 (patch) | |
tree | 992c35dad9ed29994b67f9455f0eca605c963356 /tools/perf/scripts/python/sched-migration.py | |
parent | 75adbd1386796c1234035996c6aec3ede4060eb2 (diff) | |
parent | 6e1d33b24a2b4aebcb05782e937ebc9a7a4a3f50 (diff) |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf tool fixes from Ingo Molnar:
"Misc tooling fixes: python3 related fixes, gcc8 fix, bashism fixes and
some other smaller fixes"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf tools: Use python-config --includes rather than --cflags
perf script python: Fix dict reference counting
perf stat: Fix --interval_clear option
perf tools: Fix compilation errors on gcc8
perf test shell: Prevent temporary editor files from being considered test scripts
perf llvm-utils: Remove bashism from kernel include fetch script
perf test shell: Make perf's inet_pton test more portable
perf test shell: Replace '|&' with '2>&1 |' to work with more shells
perf scripts python: Add Python 3 support to EventClass.py
perf scripts python: Add Python 3 support to sched-migration.py
perf scripts python: Add Python 3 support to Util.py
perf scripts python: Add Python 3 support to SchedGui.py
perf scripts python: Add Python 3 support to Core.py
perf tools: Generate a Python script compatible with Python 2 and 3
Diffstat (limited to 'tools/perf/scripts/python/sched-migration.py')
-rw-r--r-- | tools/perf/scripts/python/sched-migration.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/perf/scripts/python/sched-migration.py b/tools/perf/scripts/python/sched-migration.py index de66cb3b72c9..3473e7f66081 100644 --- a/tools/perf/scripts/python/sched-migration.py +++ b/tools/perf/scripts/python/sched-migration.py | |||
@@ -9,13 +9,17 @@ | |||
9 | # This software is distributed under the terms of the GNU General | 9 | # This software is distributed under the terms of the GNU General |
10 | # Public License ("GPL") version 2 as published by the Free Software | 10 | # Public License ("GPL") version 2 as published by the Free Software |
11 | # Foundation. | 11 | # Foundation. |
12 | 12 | from __future__ import print_function | |
13 | 13 | ||
14 | import os | 14 | import os |
15 | import sys | 15 | import sys |
16 | 16 | ||
17 | from collections import defaultdict | 17 | from collections import defaultdict |
18 | from UserList import UserList | 18 | try: |
19 | from UserList import UserList | ||
20 | except ImportError: | ||
21 | # Python 3: UserList moved to the collections package | ||
22 | from collections import UserList | ||
19 | 23 | ||
20 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ | 24 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ |
21 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') | 25 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') |
@@ -300,7 +304,7 @@ class TimeSliceList(UserList): | |||
300 | if i == -1: | 304 | if i == -1: |
301 | return | 305 | return |
302 | 306 | ||
303 | for i in xrange(i, len(self.data)): | 307 | for i in range(i, len(self.data)): |
304 | timeslice = self.data[i] | 308 | timeslice = self.data[i] |
305 | if timeslice.start > end: | 309 | if timeslice.start > end: |
306 | return | 310 | return |
@@ -336,8 +340,8 @@ class SchedEventProxy: | |||
336 | on_cpu_task = self.current_tsk[headers.cpu] | 340 | on_cpu_task = self.current_tsk[headers.cpu] |
337 | 341 | ||
338 | if on_cpu_task != -1 and on_cpu_task != prev_pid: | 342 | if on_cpu_task != -1 and on_cpu_task != prev_pid: |
339 | print "Sched switch event rejected ts: %s cpu: %d prev: %s(%d) next: %s(%d)" % \ | 343 | print("Sched switch event rejected ts: %s cpu: %d prev: %s(%d) next: %s(%d)" % \ |
340 | (headers.ts_format(), headers.cpu, prev_comm, prev_pid, next_comm, next_pid) | 344 | headers.ts_format(), headers.cpu, prev_comm, prev_pid, next_comm, next_pid) |
341 | 345 | ||
342 | threads[prev_pid] = prev_comm | 346 | threads[prev_pid] = prev_comm |
343 | threads[next_pid] = next_comm | 347 | threads[next_pid] = next_comm |