def __init__(self): BaseTop.__init__(self) self.tops = { 'irqtop': IrqTop(), 'softnet_stat_top': SoftnetStatTop(), 'softirq_top': Softirqs(), 'link-rate': LinkRateTop(), } self.parse_options() self.numa = Numa(fake=self.options.random)
def test_file2data(self): for cpu in ('dualcore', 'i7'): numa = Numa(fake=True) for i in xrange(1, 6): top = Softirqs(numa) top.parse_options() 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): interrupts_file = '/proc/interrupts' self.options = self.parse_options() lscpu_output = None if self.options.test_dir: interrupts_file = join(self.options.test_dir, "interrupts") lscpu_output_filename = join(self.options.test_dir, "lscpu_output") lscpu_output = open(lscpu_output_filename).read() # Popen.stdout in python 2.7 returns <str> # Popen.stdout in python 3.6 returns <bytes> # read() in both cases return <str> if isinstance(lscpu_output, bytes): lscpu_output = str(lscpu_output) self.interrupts = open(interrupts_file).readlines() self.numa = Numa(lscpu_output=lscpu_output) for postfix in sorted(self.queue_postfixes_detect()): self.smp_affinity_list_apply(self.smp_affinity_list_make(postfix))
def post_optparse(self): """ Asserting and applying parsing options """ self.options.devices = self.devices_list() if not self.options.devices: raise ValueError("No devices've been specified") if self.options.rx_only: self.stats = [ stat for stat in self.stats if stat.filename.startswith('rx')] if self.options.simple_mode: simple_stats = ('packets', 'bytes', 'errors') self.stats = [ stat for stat in self.stats if stat.shortname in simple_stats] self.unit_change() self.header = self.make_header() self.align_map = ['l'] + ['r'] * (len(self.header) - 1) if not self.numa: self.numa = Numa(self.options.devices, self.options.random)
def post_optparse(self): if not self.numa: self.numa = Numa(fake=self.options.random)