With scheduler traces covering more than two cpus, rectangles of the CPUs 3 and more are not visibles. This makes the vertical navigation scrollable so that all of the CPUs rectangles are available. We also want to be able to zoom vertically, so that we can fit at best the screen with CPU rectangles, but that's for later.
Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all
Unified · Split
| @@ -43,18 +43,20 @@ class RootFrame(wx.Frame): · 42 unmodified lines | ||
| 43 | 43 | self.timeslices = timeslices |
| 44 | 44 | (self.ts_start, self.ts_end) = timeslices.interval() |
| 45 | 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 | 49 | # whole window panel |
| 48 | 50 | self.panel = wx.Panel(self, size=(self.screen_width, self.screen_height)) |
| 49 | 51 | |
| 50 | 52 | # scrollable container |
| 51 | 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 | 55 | self.scroll.EnableScrolling(True, True) |
| 54 | 56 | self.scroll.SetFocus() |
| 55 | 57 | |
| 56 | 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 | 60 | self.scroll_panel.Bind(wx.EVT_PAINT, self.on_paint) |
| 59 | 61 | self.scroll_panel.Bind(wx.EVT_KEY_DOWN, self.on_key_press) |
| 60 | 62 | self.scroll_panel.Bind(wx.EVT_LEFT_DOWN, self.on_mouse_down) |
| @@ -65,9 +67,8 @@ class RootFrame(wx.Frame): · 4 unmodified lines | ||
| 65 | 67 | self.scroll.Fit() |
| 66 | 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 | 72 | self.txt = None |
| 72 | 73 | |
| 73 | 74 | self.Show(True) |
| @@ -143,8 +144,6 @@ class RootFrame(wx.Frame): · 69 unmodified lines | ||
| 143 | 144 | |
| 144 | 145 | for cpu in timeslice.rqs: |
| 145 | 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 | 148 | def on_paint(self, event): |
| 150 | 149 | color = wx.Colour(0xff, 0xff, 0xff) |
| @@ -163,7 +162,7 @@ class RootFrame(wx.Frame): · 12 unmodified lines | ||
| 163 | 162 | cpu = y / (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE) |
| 164 | 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 | 166 | return -1 |
| 168 | 167 | |
| 169 | 168 | return cpu |
| @@ -206,7 +205,7 @@ class RootFrame(wx.Frame): · 36 unmodified lines | ||
| 206 | 205 | self.update_width_virtual() |
| 207 | 206 | (xpos, ypos) = self.scroll.GetViewStart() |
| 208 | 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 | 209 | self.Refresh() |
| 211 | 210 | |
| 212 | 211 | def zoom_in(self): |
| @@ -234,7 +233,11 @@ class RootFrame(wx.Frame): · 21 unmodified lines | ||
| 234 | 233 | if key == wx.WXK_RIGHT: |
| 235 | 234 | self.scroll.Scroll(x + 1, y) |
| 236 | 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 | 243 | threads = { 0 : "idle"} |
| @@ -504,6 +507,14 @@ class TimeSliceList(UserList): · 263 unmodified lines | ||
| 504 | 507 | |
| 505 | 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 | 519 | class SchedEventProxy: |
| 509 | 520 | def __init__(self): |