def eval(self): """ Evaluates CPU mask used as decision for the apply() """ self.topology = Topology(lscpu_output=self.lscpu()) if not any([ self.options.socket is not None, self.options.cpus, self.options.cpu_mask ]): self.socket_detect() self.mask_detect()
def parse_cpus(self, lscpu_output): """ :param lscpu_output: string, output of `lscpu -p` """ if self.options.cpus: # no need to detect topology if user gave us cpu list return self.topology = Topology(lscpu_output=lscpu_output) if not any([self.options.socket is not None, self.options.cpus]): self.socket_detect() self.pci.devices = self.pci.node_dev_dict([self.options.dev], False)
def __init__(self): BaseTop.__init__(self) self.tops = { 'irqtop': IrqTop(), 'softnet_stat_top': SoftnetStatTop(), 'softirq_top': Softirqs(), 'link-rate': LinkRateTop(), } self.parse_options() self.topology = Topology(fake=self.options.random)
def test_file2data(self): for cpu in ('dualcore', 'i7'): topology = Topology(fake=True) for i in xrange(1, 6): top = Softirqs(topology) sys.argv = ['softirqs_test', '--random'] top.options = top.make_parser().parse_args() top.options.random = True top.options.softirqs_file = 'tests/softirqs/{0}/softirqs{1}'.format( cpu, i) self.assertTrue('NET_RX' in top.parse())
def __init__(self): BaseTop.__init__(self) self.tops = { 'irqtop': IrqTop(), 'softnet_stat_top': SoftnetStatTop(), 'softirq_top': Softirqs(), 'link-rate': LinkRateTop(), } self.parse_options() self.topology = Topology(fake=self.options.random, lscpu_output=self.options.lscpu_output) for top in self.tops.values(): top.topology = self.topology
def post_optparse(self): if not self.topology: self.topology = Topology(fake=self.options.random)
def default_post_optparse(self): if not self.topology: self.topology = Topology(fake=self.options.random) self.color = Color(self.topology, self.options.color)