summaryrefslogtreecommitdiffstats
path: root/tools/sched
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2015-11-19 00:01:52 +0000
committerrodrigc <rodrigc@FreeBSD.org>2015-11-19 00:01:52 +0000
commitb75981aabc20f749744f5b8ca7e596ce3f276154 (patch)
treeac0a298319445487c327ba5ef036a39c5cc7318f /tools/sched
parent6ae0b4f9be2b79ffde9848f96e414b5dcff599ad (diff)
downloadFreeBSD-src-b75981aabc20f749744f5b8ca7e596ce3f276154.zip
FreeBSD-src-b75981aabc20f749744f5b8ca7e596ce3f276154.tar.gz
Use print as a function for Python 3 [PEP 3105]
Import print_function from the __future__ module to activate this for Python 2. This works as far back as Python 2.6.0a2: https://docs.python.org/2/library/__future__.html [PEP 3105] https://www.python.org/dev/peps/pep-3105/
Diffstat (limited to 'tools/sched')
-rw-r--r--tools/sched/schedgraph.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/tools/sched/schedgraph.py b/tools/sched/schedgraph.py
index 0723dc3..6d8a4b9 100644
--- a/tools/sched/schedgraph.py
+++ b/tools/sched/schedgraph.py
@@ -26,6 +26,7 @@
#
# $FreeBSD$
+from __future__ import print_function
import sys
import re
import random
@@ -142,7 +143,7 @@ class Colormap:
color = self.map[name]
except:
color = colors[random.randrange(0, len(colors))]
- print "Picking random color", color, "for", name
+ print("Picking random color", color, "for", name)
self.map[name] = color
self.table.append((name, color))
return (color)
@@ -736,9 +737,9 @@ class StateEvent(Event):
color = colormap.lookup(self.name)
if (duration < 0):
duration = 0
- print "Unsynchronized timestamp"
- print self.cpu, self.timestamp
- print next.cpu, next.timestamp
+ print("Unsynchronized timestamp")
+ print(self.cpu, self.timestamp)
+ print(next.cpu, next.timestamp)
delta = duration / canvas.ratio
l = canvas.create_rectangle(xpos, ypos,
xpos + delta, ypos - 10, fill=color, width=0,
@@ -762,9 +763,9 @@ class CountEvent(Event):
self.duration = duration = next.timestamp - self.timestamp
if (duration < 0):
duration = 0
- print "Unsynchronized timestamp"
- print self.cpu, self.timestamp
- print next.cpu, next.timestamp
+ print("Unsynchronized timestamp")
+ print(self.cpu, self.timestamp)
+ print(next.cpu, next.timestamp)
self.attrs.insert(0, ("count", self.count))
self.attrs.insert(1, ("duration", ticks2sec(duration)))
delta = duration / canvas.ratio
@@ -941,7 +942,7 @@ class KTRFile:
try:
ifp = open(file)
except:
- print "Can't open", file
+ print("Can't open", file)
sys.exit(1)
# quoteexp matches a quoted string, no escaping
@@ -989,14 +990,14 @@ class KTRFile:
status.startup("Parsing line " + str(lineno))
m = ktrre.match(line);
if (m == None):
- print "Can't parse", lineno, line,
+ print("Can't parse", lineno, line, end=' ')
continue;
(index, cpu, timestamp, group, id, type, dat, dat1, attrstring) = m.groups();
if (dat == None):
dat = dat1
if (self.checkstamp(timestamp) == 0):
- print "Bad timestamp at", lineno, ":",
- print cpu, timestamp
+ print("Bad timestamp at", lineno, ":", end=' ')
+ print(cpu, timestamp)
continue
#
# Build the table of optional attributes
@@ -1032,7 +1033,7 @@ class KTRFile:
args = (dat, cpu, timestamp, attrs)
e = self.makeevent(group, id, type, args)
if (e == None):
- print "Unknown type", type, lineno, line,
+ print("Unknown type", type, lineno, line, end=' ')
def makeevent(self, group, id, type, args):
e = None
@@ -1098,9 +1099,9 @@ class KTRFile:
if (self.stathz != 0):
return (self.timespan() / self.ticks[0]) * int(self.stathz)
# Pretend we have a 1ns clock
- print "WARNING: No clock discovered and no frequency ",
- print "specified via the command line."
- print "Using fake 1ghz clock"
+ print("WARNING: No clock discovered and no frequency ", end=' ')
+ print("specified via the command line.")
+ print("Using fake 1ghz clock")
return (oneghz);
def fixup(self):
@@ -1624,7 +1625,7 @@ class SchedGraph(Frame):
return self.display.getstate(tag)
if (len(sys.argv) != 2 and len(sys.argv) != 3):
- print "usage:", sys.argv[0], "<ktr file> [clock freq in ghz]"
+ print("usage:", sys.argv[0], "<ktr file> [clock freq in ghz]")
sys.exit(1)
if (len(sys.argv) > 2):
OpenPOWER on IntegriCloud