summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2009-01-22 06:21:30 +0000
committerjeff <jeff@FreeBSD.org>2009-01-22 06:21:30 +0000
commita921977684453c89f9016fdcbb3b9fbd6a4a670f (patch)
treed07813431f90369f8a327a9722a14eb7b10a3490 /tools
parent20fc8afdb7df9df102fd02eabec488ac54e3c507 (diff)
downloadFreeBSD-src-a921977684453c89f9016fdcbb3b9fbd6a4a670f.zip
FreeBSD-src-a921977684453c89f9016fdcbb3b9fbd6a4a670f.tar.gz
- Update my copyright.
- Print human readable time as a float with two digits of precision. Use ns now as well since clock periods are well into the hundreds of picoseconds now. - Show the average duration in the stats frame. This is often more useful than total duration.
Diffstat (limited to 'tools')
-rw-r--r--tools/sched/schedgraph.py43
1 files changed, 27 insertions, 16 deletions
diff --git a/tools/sched/schedgraph.py b/tools/sched/schedgraph.py
index f3fd23a..4335574 100644
--- a/tools/sched/schedgraph.py
+++ b/tools/sched/schedgraph.py
@@ -1,6 +1,6 @@
#!/usr/local/bin/python
-# Copyright (c) 2002-2003, Jeffrey Roberson <jeff@freebsd.org>
+# Copyright (c) 2002-2003, 2009, Jeffrey Roberson <jeff@freebsd.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -149,15 +149,19 @@ class Colormap:
return (color)
def ticks2sec(ticks):
- us = ticksps / 1000000
- ticks /= us
+ ticks = float(ticks)
+ ns = float(ticksps) / 1000000000
+ ticks /= ns
if (ticks < 1000):
- return (str(ticks) + "us")
+ return ("%.2fns" % ticks)
ticks /= 1000
if (ticks < 1000):
- return (str(ticks) + "ms")
+ return ("%.2fus" % ticks)
ticks /= 1000
- return (str(ticks) + "s")
+ if (ticks < 1000):
+ return ("%.2fms" % ticks)
+ ticks /= 1000
+ return ("%.2fs" % ticks)
class Scaler(Frame):
def __init__(self, master, target):
@@ -443,7 +447,7 @@ class SourceStats(Toplevel):
self.resizable(0, 0)
self.title(source.name + " statistics")
self.evframe = LabelFrame(self,
- text="Event Frequency and Duration")
+ text="Event Count, Duration, Avg Duration")
self.evframe.grid(row=0, column=0, sticky=E+W)
eventtypes={}
for event in self.source.events:
@@ -466,15 +470,22 @@ class SourceStats(Toplevel):
ypos = 0
for event in events:
(name, c, d) = event
- l = Label(self.evframe, text=name, bd=1,
- relief=SUNKEN, anchor=W, width=30)
- m = Label(self.evframe, text=str(c), bd=1,
- relief=SUNKEN, anchor=W, width=10)
- r = Label(self.evframe, text=ticks2sec(d),
- bd=1, relief=SUNKEN, width=10)
- l.grid(row=ypos, column=0, sticky=E+W)
- m.grid(row=ypos, column=1, sticky=E+W)
- r.grid(row=ypos, column=2, sticky=E+W)
+ Label(self.evframe, text=name, bd=1,
+ relief=SUNKEN, anchor=W, width=30).grid(
+ row=ypos, column=0, sticky=W+E)
+ Label(self.evframe, text=str(c), bd=1,
+ relief=SUNKEN, anchor=W, width=10).grid(
+ row=ypos, column=1, sticky=W+E)
+ Label(self.evframe, text=ticks2sec(d),
+ bd=1, relief=SUNKEN, width=10).grid(
+ row=ypos, column=2, sticky=W+E)
+ if (d and c):
+ d /= c
+ else:
+ d = 0
+ Label(self.evframe, text=ticks2sec(d),
+ bd=1, relief=SUNKEN, width=10).grid(
+ row=ypos, column=3, sticky=W+E)
ypos += 1
OpenPOWER on IntegriCloud