|
9 | 9 | # This software is distributed under the terms of the GNU General
|
10 | 10 | # Public License ("GPL") version 2 as published by the Free Software
|
11 | 11 | # Foundation.
|
12 |
| - |
| 12 | +from __future__ import print_function |
13 | 13 |
|
14 | 14 | import os
|
15 | 15 | import sys
|
16 | 16 |
|
17 | 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 | 24 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \
|
21 | 25 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
|
@@ -300,7 +304,7 @@ def fill_zone(self, start, end):
|
300 | 304 | if i == -1:
|
301 | 305 | return
|
302 | 306 |
|
303 |
| - for i in xrange(i, len(self.data)): |
| 307 | + for i in range(i, len(self.data)): |
304 | 308 | timeslice = self.data[i]
|
305 | 309 | if timeslice.start > end:
|
306 | 310 | return
|
@@ -336,8 +340,8 @@ def sched_switch(self, headers, prev_comm, prev_pid, prev_prio, prev_state,
|
336 | 340 | on_cpu_task = self.current_tsk[headers.cpu]
|
337 | 341 |
|
338 | 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)" % \ |
340 |
| - (headers.ts_format(), headers.cpu, prev_comm, prev_pid, next_comm, next_pid) |
| 343 | + print("Sched switch event rejected ts: %s cpu: %d prev: %s(%d) next: %s(%d)" % \ |
| 344 | + headers.ts_format(), headers.cpu, prev_comm, prev_pid, next_comm, next_pid) |
341 | 345 |
|
342 | 346 | threads[prev_pid] = prev_comm
|
343 | 347 | threads[next_pid] = next_comm
|
|
0 commit comments