Deleted Added
full compact
schedgraph.py (278693) schedgraph.py (278694)
1#!/usr/local/bin/python
2
3# Copyright (c) 2002-2003, 2009, Jeffrey Roberson <jeff@freebsd.org>
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 10 unchanged lines hidden (view full) ---

19# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
1#!/usr/local/bin/python
2
3# Copyright (c) 2002-2003, 2009, Jeffrey Roberson <jeff@freebsd.org>
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 10 unchanged lines hidden (view full) ---

19# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# $FreeBSD: stable/10/tools/sched/schedgraph.py 278693 2015-02-13 18:45:44Z sbruno $
27# $FreeBSD: stable/10/tools/sched/schedgraph.py 278694 2015-02-13 19:06:22Z sbruno $
28
29import sys
30import re
31import random
32from Tkinter import *
33
34# To use:
35# - Install the ports/x11-toolkits/py-tkinter package; e.g.

--- 29 unchanged lines hidden (view full) ---

65#
66# BUGS: 1) Only 8 CPUs are supported, more CPUs require more choices of
67# colours to represent them ;-)
68
69eventcolors = [
70 ("count", "red"),
71 ("running", "green"),
72 ("idle", "grey"),
28
29import sys
30import re
31import random
32from Tkinter import *
33
34# To use:
35# - Install the ports/x11-toolkits/py-tkinter package; e.g.

--- 29 unchanged lines hidden (view full) ---

65#
66# BUGS: 1) Only 8 CPUs are supported, more CPUs require more choices of
67# colours to represent them ;-)
68
69eventcolors = [
70 ("count", "red"),
71 ("running", "green"),
72 ("idle", "grey"),
73 ("spinning", "red"),
73 ("yielding", "yellow"),
74 ("swapped", "violet"),
75 ("suspended", "purple"),
76 ("iwait", "grey"),
77 ("sleep", "blue"),
78 ("blocked", "dark red"),
79 ("runq add", "yellow"),
80 ("runq rem", "yellow"),
81 ("thread exit", "grey"),
82 ("proc exit", "grey"),
74 ("yielding", "yellow"),
75 ("swapped", "violet"),
76 ("suspended", "purple"),
77 ("iwait", "grey"),
78 ("sleep", "blue"),
79 ("blocked", "dark red"),
80 ("runq add", "yellow"),
81 ("runq rem", "yellow"),
82 ("thread exit", "grey"),
83 ("proc exit", "grey"),
83 ("callwheel idle", "grey"),
84 ("callout running", "green"),
85 ("lock acquire", "blue"),
86 ("lock contest", "purple"),
87 ("failed lock try", "red"),
88 ("lock release", "grey"),
89 ("statclock", "black"),
90 ("prio", "black"),
91 ("lend prio", "black"),
92 ("wokeup", "black")

--- 190 unchanged lines hidden (view full) ---

283 self.columnconfigure(0, weight=1)
284 self.buttons.grid(row=1, column=0, sticky=E+W)
285 self.types = []
286 self.irow = 0
287 for type in table:
288 color = graph.getcolor(type[0])
289 if (color != ""):
290 self.additem(type[0], color)
84 ("lock acquire", "blue"),
85 ("lock contest", "purple"),
86 ("failed lock try", "red"),
87 ("lock release", "grey"),
88 ("statclock", "black"),
89 ("prio", "black"),
90 ("lend prio", "black"),
91 ("wokeup", "black")

--- 190 unchanged lines hidden (view full) ---

282 self.columnconfigure(0, weight=1)
283 self.buttons.grid(row=1, column=0, sticky=E+W)
284 self.types = []
285 self.irow = 0
286 for type in table:
287 color = graph.getcolor(type[0])
288 if (color != ""):
289 self.additem(type[0], color)
290 self.bind("<Control-w>", self.destroycb)
291
291
292 def destroycb(self, event):
293 self.destroy()
294
292 def additem(self, name, color):
293 item = ColorConf(self.items, name, color)
294 self.types.append(item)
295 item.grid(row=self.irow, column=0, sticky=E+W)
296 self.irow += 1
297
298 def drawbuttons(self):
299 self.apply = Button(self.buttons, text="Apply",

--- 68 unchanged lines hidden (view full) ---

368 self.columnconfigure(0, weight=1)
369 self.sconfig = []
370 self.irow = 0
371 self.icol = 0
372 for source in sources:
373 self.addsource(source)
374 self.drawbuttons()
375 self.buttons.grid(row=1, column=0, sticky=W)
295 def additem(self, name, color):
296 item = ColorConf(self.items, name, color)
297 self.types.append(item)
298 item.grid(row=self.irow, column=0, sticky=E+W)
299 self.irow += 1
300
301 def drawbuttons(self):
302 self.apply = Button(self.buttons, text="Apply",

--- 68 unchanged lines hidden (view full) ---

371 self.columnconfigure(0, weight=1)
372 self.sconfig = []
373 self.irow = 0
374 self.icol = 0
375 for source in sources:
376 self.addsource(source)
377 self.drawbuttons()
378 self.buttons.grid(row=1, column=0, sticky=W)
379 self.bind("<Control-w>", self.destroycb)
376
380
381 def destroycb(self, event):
382 self.destroy()
383
377 def addsource(self, source):
378 if (self.irow > 30):
379 self.icol += 1
380 self.irow = 0
381 c = self.icol
382 f = LabelFrame(self.iframe, bd=4, text="Sources")
383 f.grid(row=0, column=c, sticky=N+E+W)
384 self.items.append(f)

--- 97 unchanged lines hidden (view full) ---

482 if (d and c):
483 d /= c
484 else:
485 d = 0
486 Label(self.evframe, text=ticks2sec(d),
487 bd=1, relief=SUNKEN, width=10).grid(
488 row=ypos, column=3, sticky=W+E)
489 ypos += 1
384 def addsource(self, source):
385 if (self.irow > 30):
386 self.icol += 1
387 self.irow = 0
388 c = self.icol
389 f = LabelFrame(self.iframe, bd=4, text="Sources")
390 f.grid(row=0, column=c, sticky=N+E+W)
391 self.items.append(f)

--- 97 unchanged lines hidden (view full) ---

489 if (d and c):
490 d /= c
491 else:
492 d = 0
493 Label(self.evframe, text=ticks2sec(d),
494 bd=1, relief=SUNKEN, width=10).grid(
495 row=ypos, column=3, sticky=W+E)
496 ypos += 1
497 self.bind("<Control-w>", self.destroycb)
490
498
499 def destroycb(self, event):
500 self.destroy()
491
501
502
492class SourceContext(Menu):
493 def __init__(self, event, source):
494 self.source = source
495 Menu.__init__(self, tearoff=0, takefocus=0)
496 self.add_command(label="hide", command=self.hide)
497 self.add_command(label="hide group", command=self.hidegroup)
498 self.add_command(label="stats", command=self.stats)
499 self.tk_popup(event.x_root-3, event.y_root+3)

--- 24 unchanged lines hidden (view full) ---

524 self.buttons.grid(row=0, column=0, sticky=E+W)
525 self.frame = Frame(self)
526 self.frame.grid(row=1, column=0, sticky=N+S+E+W)
527 self.canvas = canvas
528 self.drawlabels()
529 self.drawbuttons()
530 event.displayref(canvas)
531 self.bind("<Destroy>", self.destroycb)
503class SourceContext(Menu):
504 def __init__(self, event, source):
505 self.source = source
506 Menu.__init__(self, tearoff=0, takefocus=0)
507 self.add_command(label="hide", command=self.hide)
508 self.add_command(label="hide group", command=self.hidegroup)
509 self.add_command(label="stats", command=self.stats)
510 self.tk_popup(event.x_root-3, event.y_root+3)

--- 24 unchanged lines hidden (view full) ---

535 self.buttons.grid(row=0, column=0, sticky=E+W)
536 self.frame = Frame(self)
537 self.frame.grid(row=1, column=0, sticky=N+S+E+W)
538 self.canvas = canvas
539 self.drawlabels()
540 self.drawbuttons()
541 event.displayref(canvas)
542 self.bind("<Destroy>", self.destroycb)
543 self.bind("<Control-w>", self.destroycb)
532
533 def destroycb(self, event):
534 self.unbind("<Destroy>")
535 if (self.event != None):
536 self.event.displayunref(self.canvas)
537 self.event = None
538 self.destroy()
539

--- 311 unchanged lines hidden (view full) ---

851 def movename(self, canvas, xpos, ypos):
852 self.y += ypos
853 canvas.move(self.item, xpos, ypos)
854
855 def ysize(self):
856 return (Y_EVENTSOURCE)
857
858 def eventat(self, i):
544
545 def destroycb(self, event):
546 self.unbind("<Destroy>")
547 if (self.event != None):
548 self.event.displayunref(self.canvas)
549 self.event = None
550 self.destroy()
551

--- 311 unchanged lines hidden (view full) ---

863 def movename(self, canvas, xpos, ypos):
864 self.y += ypos
865 canvas.move(self.item, xpos, ypos)
866
867 def ysize(self):
868 return (Y_EVENTSOURCE)
869
870 def eventat(self, i):
859 if (i >= len(self.events)):
871 if (i >= len(self.events) or i < 0):
860 return (None)
861 event = self.events[i]
862 return (event)
863
864 def findevent(self, timestamp):
865 for event in self.events:
866 if (event.timestamp >= timestamp and event.type != "pad"):
867 return (event)

--- 30 unchanged lines hidden (view full) ---

898 def yscale(self):
899 return (self.ysize() / self.ymax())
900
901class KTRFile:
902 def __init__(self, file):
903 self.timestamp_f = None
904 self.timestamp_l = None
905 self.locks = {}
872 return (None)
873 event = self.events[i]
874 return (event)
875
876 def findevent(self, timestamp):
877 for event in self.events:
878 if (event.timestamp >= timestamp and event.type != "pad"):
879 return (event)

--- 30 unchanged lines hidden (view full) ---

910 def yscale(self):
911 return (self.ysize() / self.ymax())
912
913class KTRFile:
914 def __init__(self, file):
915 self.timestamp_f = None
916 self.timestamp_l = None
917 self.locks = {}
906 self.callwheels = {}
907 self.ticks = {}
908 self.load = {}
909 self.crit = {}
910 self.stathz = 0
911 self.eventcnt = 0
912 self.taghash = {}
913
914 self.parse(file)

--- 390 unchanged lines hidden (view full) ---

1305 self.scale = None
1306 self.status = None
1307 self.bdheight = Y_BORDER
1308 self.clicksource = None
1309 self.lastsource = None
1310 self.pack(expand=1, fill="both")
1311 self.buildwidgets()
1312 self.layout()
918 self.ticks = {}
919 self.load = {}
920 self.crit = {}
921 self.stathz = 0
922 self.eventcnt = 0
923 self.taghash = {}
924
925 self.parse(file)

--- 390 unchanged lines hidden (view full) ---

1316 self.scale = None
1317 self.status = None
1318 self.bdheight = Y_BORDER
1319 self.clicksource = None
1320 self.lastsource = None
1321 self.pack(expand=1, fill="both")
1322 self.buildwidgets()
1323 self.layout()
1324 self.bind_all("<Control-q>", self.quitcb)
1313
1325
1326 def quitcb(self, event):
1327 self.quit()
1328
1314 def buildwidgets(self):
1315 global status
1316 self.menu = GraphMenu(self)
1317 self.display = SchedDisplay(self)
1318 self.names = SchedNames(self, self.display)
1319 self.scale = Scaler(self, self.display)
1320 status = self.status = Status(self)
1321 self.scrollY = Scrollbar(self, orient="vertical",

--- 304 unchanged lines hidden ---
1329 def buildwidgets(self):
1330 global status
1331 self.menu = GraphMenu(self)
1332 self.display = SchedDisplay(self)
1333 self.names = SchedNames(self, self.display)
1334 self.scale = Scaler(self, self.display)
1335 status = self.status = Status(self)
1336 self.scrollY = Scrollbar(self, orient="vertical",

--- 304 unchanged lines hidden ---