aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/sched-migration.py
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-07-12 09:52:35 -0400
committerIngo Molnar <mingo@kernel.org>2018-07-12 09:52:35 -0400
commit6e1d33b24a2b4aebcb05782e937ebc9a7a4a3f50 (patch)
tree8f75c8e622d1e85a4cfb3b7695db41d7a6dca95e /tools/perf/scripts/python/sched-migration.py
parent092150a25cb7bd6a79aa00bb1ad131063f58073d (diff)
parent32aa928a7b817140c84987b726d5014911808fa4 (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>
Diffstat (limited to 'tools/perf/scripts/python/sched-migration.py')
-rw-r--r--tools/perf/scripts/python/sched-migration.py14
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 12from __future__ import print_function
13 13
14import os 14import os
15import sys 15import sys
16 16
17from collections import defaultdict 17from collections import defaultdict
18from UserList import UserList 18try:
19 from UserList import UserList
20except ImportError:
21 # Python 3: UserList moved to the collections package
22 from collections import UserList
19 23
20sys.path.append(os.environ['PERF_EXEC_PATH'] + \ 24sys.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