History

perf, sched migration: Parameterize cpu height and spacing

Without vertical zoom, it is not possible to see all CPUs in a trace taken on a larger machine. This patch parameterizes the height and spacing of CPUs so that you can fit more cpus into the screen. Ideally we should dynamically size/space the CPU rectangles with some minimum threshold. Until then, this patch is a stop-gap.

Nikhil Rao committed 16 years ago

Commit 0cddf561 parent be6d9471 file · +14 −9Browse files

Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all

Unified · Split

tools/perf/scripts/python/sched-migration.py+14−9
@@ -27,6 +27,11 @@ from perf_trace_context import * · 26 unmodified lines
2727 from Core import *
2828
2929 class RootFrame(wx.Frame):
30+ Y_OFFSET = 100
31+ CPU_HEIGHT = 100
32+ CPU_SPACE = 50
33+ EVENT_MARKING_WIDTH = 5
34+
3035 def __init__(self, timeslices, parent = None, id = -1, title = "Migration"):
3136 wx.Frame.__init__(self, parent, id, title)
3237
@@ -97,8 +102,8 @@ class RootFrame(wx.Frame): · 64 unmodified lines
97102 if width_px == 0:
98103 return
99104
100− offset_py = 100 + (cpu * 150)
101− width_py = 100
105+ offset_py = RootFrame.Y_OFFSET + (cpu * (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE))
106+ width_py = RootFrame.CPU_HEIGHT
102107
103108 if cpu in slice.event_cpus:
104109 rgb = rq.event.color()
@@ -107,9 +112,9 @@ class RootFrame(wx.Frame): · 2 unmodified lines
107112 color = wx.Colour(r, g, b)
108113 brush = wx.Brush(color, wx.SOLID)
109114 dc.SetBrush(brush)
110− dc.DrawRectangle(offset_px, offset_py, width_px, 5)
111− width_py -= 5
112− offset_py += 5
115+ dc.DrawRectangle(offset_px, offset_py, width_px, RootFrame.EVENT_MARKING_WIDTH)
116+ width_py -= RootFrame.EVENT_MARKING_WIDTH
117+ offset_py += RootFrame.EVENT_MARKING_WIDTH
113118
114119 red_power = int(0xff - (0xff * load_rate))
115120 color = wx.Colour(0xff, red_power, red_power)
@@ -154,11 +159,11 @@ class RootFrame(wx.Frame): · 38 unmodified lines
154159 self.update_rectangles(dc, start, end)
155160
156161 def cpu_from_ypixel(self, y):
157− y -= 100
158− cpu = y / 150
159− height = y % 150
162+ y -= RootFrame.Y_OFFSET
163+ cpu = y / (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE)
164+ height = y % (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE)
160165
161− if cpu < 0 or cpu > self.max_cpu or height > 100:
166+ if cpu < 0 or cpu > self.max_cpu or height > RootFrame.CPU_HEIGHT:
162167 return -1
163168
164169 return cpu