aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts
diff options
context:
space:
mode:
authorNikhil Rao <ncrao@google.com>2010-07-21 22:46:27 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2010-08-01 19:31:56 -0400
commit0cddf56aa841713b37c10c5ab673d6164fce9833 (patch)
treeb3b04f0086696d563b44e31cee994976c6deed51 /tools/perf/scripts
parentbe6d947691376218e788418e2656fc9a3e43b9bc (diff)
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. Signed-off-by: Nikhil Rao <ncrao@google.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Tom Zanussi <tzanussi@gmail.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'tools/perf/scripts')
-rw-r--r--tools/perf/scripts/python/sched-migration.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/tools/perf/scripts/python/sched-migration.py b/tools/perf/scripts/python/sched-migration.py
index 8b8fb7c60991..d9026683027c 100644
--- a/tools/perf/scripts/python/sched-migration.py
+++ b/tools/perf/scripts/python/sched-migration.py
@@ -27,6 +27,11 @@ from perf_trace_context import *
27from Core import * 27from Core import *
28 28
29class RootFrame(wx.Frame): 29class RootFrame(wx.Frame):
30 Y_OFFSET = 100
31 CPU_HEIGHT = 100
32 CPU_SPACE = 50
33 EVENT_MARKING_WIDTH = 5
34
30 def __init__(self, timeslices, parent = None, id = -1, title = "Migration"): 35 def __init__(self, timeslices, parent = None, id = -1, title = "Migration"):
31 wx.Frame.__init__(self, parent, id, title) 36 wx.Frame.__init__(self, parent, id, title)
32 37
@@ -97,8 +102,8 @@ class RootFrame(wx.Frame):
97 if width_px == 0: 102 if width_px == 0:
98 return 103 return
99 104
100 offset_py = 100 + (cpu * 150) 105 offset_py = RootFrame.Y_OFFSET + (cpu * (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE))
101 width_py = 100 106 width_py = RootFrame.CPU_HEIGHT
102 107
103 if cpu in slice.event_cpus: 108 if cpu in slice.event_cpus:
104 rgb = rq.event.color() 109 rgb = rq.event.color()
@@ -107,9 +112,9 @@ class RootFrame(wx.Frame):
107 color = wx.Colour(r, g, b) 112 color = wx.Colour(r, g, b)
108 brush = wx.Brush(color, wx.SOLID) 113 brush = wx.Brush(color, wx.SOLID)
109 dc.SetBrush(brush) 114 dc.SetBrush(brush)
110 dc.DrawRectangle(offset_px, offset_py, width_px, 5) 115 dc.DrawRectangle(offset_px, offset_py, width_px, RootFrame.EVENT_MARKING_WIDTH)
111 width_py -= 5 116 width_py -= RootFrame.EVENT_MARKING_WIDTH
112 offset_py += 5 117 offset_py += RootFrame.EVENT_MARKING_WIDTH
113 118
114 red_power = int(0xff - (0xff * load_rate)) 119 red_power = int(0xff - (0xff * load_rate))
115 color = wx.Colour(0xff, red_power, red_power) 120 color = wx.Colour(0xff, red_power, red_power)
@@ -154,11 +159,11 @@ class RootFrame(wx.Frame):
154 self.update_rectangles(dc, start, end) 159 self.update_rectangles(dc, start, end)
155 160
156 def cpu_from_ypixel(self, y): 161 def cpu_from_ypixel(self, y):
157 y -= 100 162 y -= RootFrame.Y_OFFSET
158 cpu = y / 150 163 cpu = y / (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE)
159 height = y % 150 164 height = y % (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE)
160 165
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:
162 return -1 167 return -1
163 168
164 return cpu 169 return cpu