Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 205356
b: refs/heads/master
c: 70d815a
h: refs/heads/master
v: v3
  • Loading branch information
Frederic Weisbecker committed Aug 1, 2010
1 parent 8d41ec5 commit 7b9f2ea
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0cddf56aa841713b37c10c5ab673d6164fce9833
refs/heads/master: 70d815a3decc57c482e5384a623a859e3371e680
29 changes: 20 additions & 9 deletions trunk/tools/perf/scripts/python/sched-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,20 @@ def __init__(self, timeslices, parent = None, id = -1, title = "Migration"):
self.timeslices = timeslices
(self.ts_start, self.ts_end) = timeslices.interval()
self.update_width_virtual()
self.nr_cpus = timeslices.max_cpu() + 1
self.height_virtual = RootFrame.Y_OFFSET + (self.nr_cpus * (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE))

# whole window panel
self.panel = wx.Panel(self, size=(self.screen_width, self.screen_height))

# scrollable container
self.scroll = wx.ScrolledWindow(self.panel)
self.scroll.SetScrollbars(self.scroll_scale, self.scroll_scale, self.width_virtual / self.scroll_scale, 100 / 10)
self.scroll.SetScrollbars(self.scroll_scale, self.scroll_scale, self.width_virtual / self.scroll_scale, self.height_virtual / self.scroll_scale)
self.scroll.EnableScrolling(True, True)
self.scroll.SetFocus()

# scrollable drawing area
self.scroll_panel = wx.Panel(self.scroll, size=(self.screen_width, self.screen_height / 2))
self.scroll_panel = wx.Panel(self.scroll, size=(self.screen_width - 15, self.screen_height / 2))
self.scroll_panel.Bind(wx.EVT_PAINT, self.on_paint)
self.scroll_panel.Bind(wx.EVT_KEY_DOWN, self.on_key_press)
self.scroll_panel.Bind(wx.EVT_LEFT_DOWN, self.on_mouse_down)
Expand All @@ -65,9 +67,8 @@ def __init__(self, timeslices, parent = None, id = -1, title = "Migration"):
self.scroll.Fit()
self.Fit()

self.scroll_panel.SetDimensions(-1, -1, self.width_virtual, -1, wx.SIZE_USE_EXISTING)
self.scroll_panel.SetDimensions(-1, -1, self.width_virtual, self.height_virtual, wx.SIZE_USE_EXISTING)

self.max_cpu = -1
self.txt = None

self.Show(True)
Expand Down Expand Up @@ -143,8 +144,6 @@ def update_rectangles(self, dc, start, end):

for cpu in timeslice.rqs:
self.update_rectangle_cpu(dc, timeslice, cpu, self.timeslices[0].start)
if cpu > self.max_cpu:
self.max_cpu = cpu

def on_paint(self, event):
color = wx.Colour(0xff, 0xff, 0xff)
Expand All @@ -163,7 +162,7 @@ def cpu_from_ypixel(self, y):
cpu = y / (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE)
height = y % (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE)

if cpu < 0 or cpu > self.max_cpu or height > RootFrame.CPU_HEIGHT:
if cpu < 0 or cpu > self.nr_cpus - 1 or height > RootFrame.CPU_HEIGHT:
return -1

return cpu
Expand Down Expand Up @@ -206,7 +205,7 @@ def __zoom(self, x):
self.update_width_virtual()
(xpos, ypos) = self.scroll.GetViewStart()
xpos = self.us_to_px(x) / self.scroll_scale
self.scroll.SetScrollbars(self.scroll_scale, self.scroll_scale, self.width_virtual / self.scroll_scale, 100 / 10, xpos, ypos)
self.scroll.SetScrollbars(self.scroll_scale, self.scroll_scale, self.width_virtual / self.scroll_scale, self.height_virtual / self.scroll_scale, xpos, ypos)
self.Refresh()

def zoom_in(self):
Expand Down Expand Up @@ -234,7 +233,11 @@ def on_key_press(self, event):
if key == wx.WXK_RIGHT:
self.scroll.Scroll(x + 1, y)
elif key == wx.WXK_LEFT:
self.scroll.Scroll(x -1, y)
self.scroll.Scroll(x - 1, y)
elif key == wx.WXK_DOWN:
self.scroll.Scroll(x, y + 1)
elif key == wx.WXK_UP:
self.scroll.Scroll(x, y - 1)


threads = { 0 : "idle"}
Expand Down Expand Up @@ -504,6 +507,14 @@ def interval(self):

return (self.data[0].start, self.data[-1].end)

def max_cpu(self):
last_ts = self.data[-1]
max_cpu = 0
for cpu in last_ts.rqs:
if cpu > max_cpu:
max_cpu = cpu
return max_cpu


class SchedEventProxy:
def __init__(self):
Expand Down

0 comments on commit 7b9f2ea

Please sign in to comment.