Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0cddf56a authored by Nikhil Rao's avatar Nikhil Rao Committed by Frederic Weisbecker
Browse files

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: default avatarNikhil 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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
parent be6d9476
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -27,6 +27,11 @@ from perf_trace_context import *
from Core import *

class RootFrame(wx.Frame):
	Y_OFFSET = 100
	CPU_HEIGHT = 100
	CPU_SPACE = 50
	EVENT_MARKING_WIDTH = 5

	def __init__(self, timeslices, parent = None, id = -1, title = "Migration"):
		wx.Frame.__init__(self, parent, id, title)

@@ -97,8 +102,8 @@ class RootFrame(wx.Frame):
		if width_px == 0:
			return

		offset_py = 100 + (cpu * 150)
		width_py = 100
		offset_py = RootFrame.Y_OFFSET + (cpu * (RootFrame.CPU_HEIGHT + RootFrame.CPU_SPACE))
		width_py = RootFrame.CPU_HEIGHT

		if cpu in slice.event_cpus:
			rgb = rq.event.color()
@@ -107,9 +112,9 @@ class RootFrame(wx.Frame):
				color = wx.Colour(r, g, b)
				brush = wx.Brush(color, wx.SOLID)
				dc.SetBrush(brush)
				dc.DrawRectangle(offset_px, offset_py, width_px, 5)
				width_py -= 5
				offset_py += 5
				dc.DrawRectangle(offset_px, offset_py, width_px, RootFrame.EVENT_MARKING_WIDTH)
				width_py -= RootFrame.EVENT_MARKING_WIDTH
				offset_py += RootFrame.EVENT_MARKING_WIDTH

		red_power = int(0xff - (0xff * load_rate))
		color = wx.Colour(0xff, red_power, red_power)
@@ -154,11 +159,11 @@ class RootFrame(wx.Frame):
		self.update_rectangles(dc, start, end)

	def cpu_from_ypixel(self, y):
		y -= 100
		cpu = y / 150
		height = y % 150
		y -= RootFrame.Y_OFFSET
		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 > 100:
		if cpu < 0 or cpu > self.max_cpu or height > RootFrame.CPU_HEIGHT:
			return -1

		return cpu