diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-08-09 12:12:52 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-08-09 12:12:52 +0200 |
commit | d0ed4c60abfb9a4ab6cd416d1dea9df6266f8fc7 (patch) | |
tree | 8fd3af1a9e788333e85d2a51a4fc2a9858a9a95a /tools/perf/scripts/python/sched-migration.py | |
parent | 72a361a5b91c77b33ab2533674fdcec4de3278d0 (diff) | |
parent | aba941392aeef2d1bc064a1e4b09293473ef7b9b (diff) |
Merge branch 'acpi-scan' to satisfy dependencies.
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 @@ # This software is distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundation. - +from __future__ import print_function import os import sys from collections import defaultdict -from UserList import UserList +try: + from UserList import UserList +except ImportError: + # Python 3: UserList moved to the collections package + from collections import UserList sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') @@ -300,7 +304,7 @@ class TimeSliceList(UserList): if i == -1: return - for i in xrange(i, len(self.data)): + for i in range(i, len(self.data)): timeslice = self.data[i] if timeslice.start > end: return @@ -336,8 +340,8 @@ class SchedEventProxy: on_cpu_task = self.current_tsk[headers.cpu] if on_cpu_task != -1 and on_cpu_task != prev_pid: - print "Sched switch event rejected ts: %s cpu: %d prev: %s(%d) next: %s(%d)" % \ - (headers.ts_format(), headers.cpu, prev_comm, prev_pid, next_comm, next_pid) + print("Sched switch event rejected ts: %s cpu: %d prev: %s(%d) next: %s(%d)" % \ + headers.ts_format(), headers.cpu, prev_comm, prev_pid, next_comm, next_pid) threads[prev_pid] = prev_comm threads[next_pid] = next_comm |