aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/futex-contention.py
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-11-16 16:12:16 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-01 17:10:14 -0500
commit697566939dc60048fca6e6dd69c7e089aaeb7ff8 (patch)
treea5bc64a00120407959a7ce5c4673f0fc7c7a64e4 /tools/perf/scripts/python/futex-contention.py
parent20aa5bb9dc4b5aba1b4d0f15aa92c4e83721a343 (diff)
[media] sh_vou: convert to unlocked_ioctl
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python/futex-contention.py')
0 files changed, 0 insertions, 0 deletions
pan class="hl opt">.idx = idx self.name = name self.parent = parent self.children = [] # def __repr__(self): # return self.name + '_' + str(self.idx) def __build_level_above(self, machine, l, child_nodes): key = 'n' + l if key in machine: cluster_sz = machine[key] else: cluster_sz = 1 nchildren = len(child_nodes) nodes = [self.Node(idx, l) for idx in range(nchildren/cluster_sz)] for i in range(len(child_nodes)): child_nodes[i].parent = nodes[i/cluster_sz] nodes[i/cluster_sz].children.append(child_nodes[i]) return nodes def __find_dist(self, a, b): if a != b: # pass-through (ex. as CPU is to private L1) if len(a.parent.children) == 1: return self.__find_dist(a.parent, b.parent) else: return 1 + self.__find_dist(a.parent, b.parent) return 0 def __build_dist_matrix(self): dist_mat = np.empty([self.ncpus, self.ncpus], int) for i in range(self.ncpus): for j in range(i, self.ncpus): dist_mat[i,j] = dist_mat[j,i] = self.__find_dist(self.leaves[i], self.leaves[j]) return dist_mat def __init__(self, machine): self.ncpus = machine['sockets']*machine['cores_per_socket'] self.machine = machine # build the Topology bottom up self.leaves = [self.Node(idx, 'CPU') for idx in range(self.ncpus)] nodes = self.leaves for l in self.levels: nodes = self.__build_level_above(machine, l, nodes) self.root = nodes self.dist_mat = self.__build_dist_matrix() # def __repr_level(self, node, stem, buf): # spacing = 3 # buf += stem + node.name + '_' + str(node.idx) + '\n' # for c in node.children: # buf = self.__repr_level(c, stem + ' '*spacing, buf) # return buf # def __repr__(self): # buf = self.__repr_level(self.root[0], '', '') # return buf def max_wss(self): # returns the maximum amount of data a CPU # can store in its cache for a task on a # __single socket__ # cache levels in reverse order levels = ['L3', 'L2', 'L1'] size = 0 if self.machine['inclusive'] == 1: # return the size of the lowest-level cache for lvl in levels: if self.machine[lvl] != 0: size = self.machine[lvl] break else: # return a sum of cache sizes for lvl in levels: size += self.machine[lvl] return size def distance(self, a, b): return self.dist_mat[a,b] def schedcat_distance(self, a, b): # schedcat-proper places the mem-level at 0, L1 at 1, L2 at 2, etc. # This is pretty lame since mem-level is actually the farthest away. # Anyway, we need to convert our notion of distance to schedcat's. d = self.distance(a, b) if d <= 2: # d <= 2 for L1, L2, and L3 d += 1 else: # TODO: Seperate level for System d = 0 return d # def consume_cost(self, a, b, wss, period, overheads = None): # if overheads == None: # return 0.0 # else: # dist = self.schedcat_distance(a, b) # cost = overheads.consumer.consume_cost(dist, wss) ## print 'wss=%f dist=%d --> cost=%f' % (wss, dist, cost) # return cost