Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108978054
D33626.id100494.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D33626.id100494.diff
View Options
Index: tools/sched/schedgraph.py
===================================================================
--- tools/sched/schedgraph.py
+++ tools/sched/schedgraph.py
@@ -30,11 +30,12 @@
import sys
import re
import random
-from Tkinter import *
+from operator import attrgetter, itemgetter
+from tkinter import *
# To use:
# - Install the ports/x11-toolkits/py-tkinter package; e.g.
-# portinstall x11-toolkits/py-tkinter package
+# pkg install x11-toolkits/py-tkinter
# - Add KTR_SCHED to KTR_COMPILE and KTR_MASK in your KERNCONF; e.g.
# options KTR
# options KTR_ENTRIES=32768
@@ -55,6 +56,8 @@
# while the workload is still running is to avoid wasting log entries on
# "idle" time at the end.
# - Dump the trace to a file: 'ktrdump -ct > ktr.out'
+# - Alternatively, use schedgraph.d script in this directory for getting
+# the trace data by means of DTrace. See the script for details.
# - Run the python script: 'python schedgraph.py ktr.out' optionally provide
# your cpu frequency in ghz: 'python schedgraph.py ktr.out 2.4'
#
@@ -444,10 +447,6 @@
for item in self.sconfig:
item.uncheck()
-# Reverse compare of second member of the tuple
-def cmp_counts(x, y):
- return y[1] - x[1]
-
class SourceStats(Toplevel):
def __init__(self, source):
self.source = source
@@ -473,7 +472,7 @@
for k, v in eventtypes.iteritems():
(c, d) = v
events.append((k, c, d))
- events.sort(cmp=cmp_counts)
+ events.sort(key=itemgetter(1), reverse=True)
ypos = 0
for event in events:
@@ -793,10 +792,6 @@
Event.draw(self, canvas, xpos, ypos, None)
return (xpos + delta)
-# Sort function for start y address
-def source_cmp_start(x, y):
- return x.y - y.y
-
class EventSource:
def __init__(self, group, id):
self.name = id
@@ -808,12 +803,16 @@
self.hidden = 0
self.tag = group + id
- def __cmp__(self, other):
- if (other == None):
- return -1
- if (self.group == other.group):
- return cmp(self.name, other.name)
- return cmp(self.group, other.group)
+ def __lt__(self, other):
+ if other is None:
+ return False
+ return (self.group < other.group or
+ self.group == other.group and self.name < other.name)
+
+ def __eq__(self, other):
+ if other is None:
+ return False
+ return self.group == other.group and self.name == other.name
# It is much faster to append items to a list then to insert them
# at the beginning. As a result, we add events in reverse order
@@ -1478,7 +1477,7 @@
# expensive due to python's canvas.move().
#
def sourceshowlist(self, srclist):
- srclist.sort(cmp=source_cmp_start)
+ srclist.sort(key=attrgetter('y'))
startsize = []
for source in srclist:
if (source.hidden == 0):
@@ -1486,7 +1485,7 @@
startsize.append((self.sourcepicky(source),
self.sourcesize(source)))
- sources.sort(cmp=source_cmp_start, reverse=True)
+ sources.sort(key=attrgetter('y'), reverse=True)
self.status.startup("Updating display...");
for source in sources:
if (source.hidden == 1):
@@ -1516,8 +1515,8 @@
# expensive due to python's canvas.move().
#
def sourcehidelist(self, srclist):
- srclist.sort(cmp=source_cmp_start)
- sources.sort(cmp=source_cmp_start)
+ srclist.sort(key=attrgetter('y'))
+ sources.sort(key=attrgetter('y'))
startsize = []
off = len(sources) * 100
self.status.startup("Updating display...");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 31, 5:25 AM (10 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16355153
Default Alt Text
D33626.id100494.diff (3 KB)
Attached To
Mode
D33626: schedgraph.py: port to Python 3
Attached
Detach File
Event Timeline
Log In to Comment