diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/scripts/python/sched-migration.py | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/tools/perf/scripts/python/sched-migration.py b/tools/perf/scripts/python/sched-migration.py index d9026683027c..9d46377f793b 100644 --- a/tools/perf/scripts/python/sched-migration.py +++ b/tools/perf/scripts/python/sched-migration.py | |||
@@ -43,18 +43,20 @@ class RootFrame(wx.Frame): | |||
43 | self.timeslices = timeslices | 43 | self.timeslices = timeslices |
44 | (self.ts_start, self.ts_end) = timeslices.interval() | 44 | (self.ts_start, self.ts_end) = timeslices.interval() |
45 | self.update_width_virtual() | 45 | self.update_width_virtual() |
46 | self.nr_cpus = timeslices.max_cpu() + 1 | ||
47 | self.height_virtual = RootFrame.Y_OFFSET + (self.nr_cpus * (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE)) | ||
46 | 48 | ||
47 | # whole window panel | 49 | # whole window panel |
48 | self.panel = wx.Panel(self, size=(self.screen_width, self.screen_height)) | 50 | self.panel = wx.Panel(self, size=(self.screen_width, self.screen_height)) |
49 | 51 | ||
50 | # scrollable container | 52 | # scrollable container |
51 | self.scroll = wx.ScrolledWindow(self.panel) | 53 | self.scroll = wx.ScrolledWindow(self.panel) |
52 | self.scroll.SetScrollbars(self.scroll_scale, self.scroll_scale, self.width_virtual / self.scroll_scale, 100 / 10) | 54 | self.scroll.SetScrollbars(self.scroll_scale, self.scroll_scale, self.width_virtual / self.scroll_scale, self.height_virtual / self.scroll_scale) |
53 | self.scroll.EnableScrolling(True, True) | 55 | self.scroll.EnableScrolling(True, True) |
54 | self.scroll.SetFocus() | 56 | self.scroll.SetFocus() |
55 | 57 | ||
56 | # scrollable drawing area | 58 | # scrollable drawing area |
57 | self.scroll_panel = wx.Panel(self.scroll, size=(self.screen_width, self.screen_height / 2)) | 59 | self.scroll_panel = wx.Panel(self.scroll, size=(self.screen_width - 15, self.screen_height / 2)) |
58 | self.scroll_panel.Bind(wx.EVT_PAINT, self.on_paint) | 60 | self.scroll_panel.Bind(wx.EVT_PAINT, self.on_paint) |
59 | self.scroll_panel.Bind(wx.EVT_KEY_DOWN, self.on_key_press) | 61 | self.scroll_panel.Bind(wx.EVT_KEY_DOWN, self.on_key_press) |
60 | self.scroll_panel.Bind(wx.EVT_LEFT_DOWN, self.on_mouse_down) | 62 | self.scroll_panel.Bind(wx.EVT_LEFT_DOWN, self.on_mouse_down) |
@@ -65,9 +67,8 @@ class RootFrame(wx.Frame): | |||
65 | self.scroll.Fit() | 67 | self.scroll.Fit() |
66 | self.Fit() | 68 | self.Fit() |
67 | 69 | ||
68 | self.scroll_panel.SetDimensions(-1, -1, self.width_virtual, -1, wx.SIZE_USE_EXISTING) | 70 | self.scroll_panel.SetDimensions(-1, -1, self.width_virtual, self.height_virtual, wx.SIZE_USE_EXISTING) |
69 | 71 | ||
70 | self.max_cpu = -1 | ||
71 | self.txt = None | 72 | self.txt = None |
72 | 73 | ||
73 | self.Show(True) | 74 | self.Show(True) |
@@ -143,8 +144,6 @@ class RootFrame(wx.Frame): | |||
143 | 144 | ||
144 | for cpu in timeslice.rqs: | 145 | for cpu in timeslice.rqs: |
145 | self.update_rectangle_cpu(dc, timeslice, cpu, self.timeslices[0].start) | 146 | self.update_rectangle_cpu(dc, timeslice, cpu, self.timeslices[0].start) |
146 | if cpu > self.max_cpu: | ||
147 | self.max_cpu = cpu | ||
148 | 147 | ||
149 | def on_paint(self, event): | 148 | def on_paint(self, event): |
150 | color = wx.Colour(0xff, 0xff, 0xff) | 149 | color = wx.Colour(0xff, 0xff, 0xff) |
@@ -163,7 +162,7 @@ class RootFrame(wx.Frame): | |||
163 | cpu = y / (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE) | 162 | cpu = y / (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE) |
164 | height = y % (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE) | 163 | height = y % (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE) |
165 | 164 | ||
166 | if cpu < 0 or cpu > self.max_cpu or height > RootFrame.CPU_HEIGHT: | 165 | if cpu < 0 or cpu > self.nr_cpus - 1 or height > RootFrame.CPU_HEIGHT: |
167 | return -1 | 166 | return -1 |
168 | 167 | ||
169 | return cpu | 168 | return cpu |
@@ -206,7 +205,7 @@ class RootFrame(wx.Frame): | |||
206 | self.update_width_virtual() | 205 | self.update_width_virtual() |
207 | (xpos, ypos) = self.scroll.GetViewStart() | 206 | (xpos, ypos) = self.scroll.GetViewStart() |
208 | xpos = self.us_to_px(x) / self.scroll_scale | 207 | xpos = self.us_to_px(x) / self.scroll_scale |
209 | self.scroll.SetScrollbars(self.scroll_scale, self.scroll_scale, self.width_virtual / self.scroll_scale, 100 / 10, xpos, ypos) | 208 | self.scroll.SetScrollbars(self.scroll_scale, self.scroll_scale, self.width_virtual / self.scroll_scale, self.height_virtual / self.scroll_scale, xpos, ypos) |
210 | self.Refresh() | 209 | self.Refresh() |
211 | 210 | ||
212 | def zoom_in(self): | 211 | def zoom_in(self): |
@@ -234,7 +233,11 @@ class RootFrame(wx.Frame): | |||
234 | if key == wx.WXK_RIGHT: | 233 | if key == wx.WXK_RIGHT: |
235 | self.scroll.Scroll(x + 1, y) | 234 | self.scroll.Scroll(x + 1, y) |
236 | elif key == wx.WXK_LEFT: | 235 | elif key == wx.WXK_LEFT: |
237 | self.scroll.Scroll(x -1, y) | 236 | self.scroll.Scroll(x - 1, y) |
237 | elif key == wx.WXK_DOWN: | ||
238 | self.scroll.Scroll(x, y + 1) | ||
239 | elif key == wx.WXK_UP: | ||
240 | self.scroll.Scroll(x, y - 1) | ||
238 | 241 | ||
239 | 242 | ||
240 | threads = { 0 : "idle"} | 243 | threads = { 0 : "idle"} |
@@ -504,6 +507,14 @@ class TimeSliceList(UserList): | |||
504 | 507 | ||
505 | return (self.data[0].start, self.data[-1].end) | 508 | return (self.data[0].start, self.data[-1].end) |
506 | 509 | ||
510 | def max_cpu(self): | ||
511 | last_ts = self.data[-1] | ||
512 | max_cpu = 0 | ||
513 | for cpu in last_ts.rqs: | ||
514 | if cpu > max_cpu: | ||
515 | max_cpu = cpu | ||
516 | return max_cpu | ||
517 | |||
507 | 518 | ||
508 | class SchedEventProxy: | 519 | class SchedEventProxy: |
509 | def __init__(self): | 520 | def __init__(self): |