def __repr_cpu(self): irqtop = self.tops.get('irqtop') softirq_top = self.tops.get('softirq_top') softnet_stat_top = self.tops.get('softnet_stat_top') # all these evaluations are better to put in softirqs.parse() active_cpu = softirq_top.__active_cpu_count__(softirq_top.current) softnet_stat_top_output = softnet_stat_top.repr_source() network_output = zip(irqtop.diff_total, softirq_top.repr_source()['NET_RX'][:active_cpu], softirq_top.repr_source()['NET_TX'][:active_cpu], softnet_stat_top_output) fields = [ "CPU", "Interrupts", "NET RX", "NET TX", "total", "dropped", "time_squeeze", "cpu_collision", "received_rps", ] fields = [bright(word) for word in fields] rows = self.__repr_cpu_make_rows(irqtop, network_output, softirq_top, softnet_stat_top) table = make_table(fields, ['l'] + ['r'] * (len(fields) - 1), rows) return wrap_header("Load per cpu:") + str(table)
def __repr__(self): output_lines, cpu_count = self.make_rows() align_map = self.make_align_map(cpu_count) output_lines.insert(1, [self.colorize_irq_per_cpu(irq) for irq in self.diff_total] + ['TOTAL']) output_lines.insert(2, [''] * (cpu_count + 1)) table = make_table(output_lines[0], align_map, output_lines[1:]) return self.__repr_table__(table)
def __repr_cpu(self): irqtop = self.tops.get('irqtop') softirq_top = self.tops.get('softirq_top') softnet_stat_top = self.tops.get('softnet_stat_top') # all these evaluations are better to put in softirqs.parse() active_cpu = softirq_top.__active_cpu_count__(softirq_top.current) softnet_stat_top_output = softnet_stat_top.repr_source() network_output = zip(irqtop.diff_total, softirq_top.repr_source()['NET_RX'][:active_cpu], softirq_top.repr_source()['NET_TX'][:active_cpu], softnet_stat_top_output) fields = [ 'CPU', 'Interrupts', 'NET RX', 'NET TX', 'total', 'dropped', 'time_squeeze', 'cpu_collision', 'received_rps', ] fields = [self.color.bright(word) for word in fields] rows = self.__repr_cpu_make_rows(irqtop, network_output, softirq_top, softnet_stat_top) table = make_table(fields, ['l'] + ['r'] * (len(fields) - 1), rows) return self.color.wrap_header('Load per cpu:') + str(table)
def __repr__(self): active_cpu_count = self.__active_cpu_count__(self.current) header = ["CPU", "NET_RX", "NET_TX"] net_rx = self.repr_source().get('NET_RX')[:active_cpu_count] net_tx = self.repr_source().get('NET_TX')[:active_cpu_count] rows = [[ wrap("CPU{0}".format(n), cpu_color(n, self.numa)), v[0], v[1] ] for n, v in enumerate(zip(net_rx, net_tx))] table = make_table(header, ['l', 'r', 'r'], rows) return self.__repr_table__(table)
def __repr__(self): active_cpu_count = self.__active_cpu_count__(self.current) header = ['CPU', 'NET_RX', 'NET_TX'] net_rx = self.repr_source().get('NET_RX')[:active_cpu_count] net_tx = self.repr_source().get('NET_TX')[:active_cpu_count] rows = [[ wrap('CPU{0}'.format(n), cpu_color(n, self.topology)), self.colorize_net_rx(v[0]), self.colorize_net_tx(v[1]) ] for n, v in enumerate(zip(net_rx, net_tx))] table = make_table(header, ['l', 'r', 'r'], rows) return self.__repr_table__(table)
def __repr__(self): table = make_table(self.make_header(), self.make_align_map(), self.make_rows()) return self.__repr_table__(table)
def __repr_irq(self): top = self.tops.get('irqtop') output_lines, cpu_count = top.make_rows() align_map = top.make_align_map(cpu_count) table = make_table(output_lines[0], align_map, output_lines[1:]) return wrap_header("/proc/interrupts") + str(table)
def __repr_dev(self): top = self.tops.get('link-rate') table = make_table(top.make_header(), top.align_map, top.make_rows()) return wrap_header("Network devices") + str(table)
def __repr__(self): table = make_table(self.make_header(), self.align, list(self.make_rows())) return self.__repr_table__(table)