def assess_netdev(self, netdev): netdevinfo = extract(self.data, ['net', netdev]) queues = sum( len(extract(netdevinfo, ['queues', x])) for x in ('rx', 'rxtx')) buffers = netdevinfo.get('buffers') or {} return self.fold( { 'queues': Grade.int(queues, 2, 8), 'driver': { 'mlx5_core': 10, # 7500 mbit/s 'mlx4_en': 9, # 6500 mbit/s 'i40e': 8, # 6000 mbit/s 'ixgbe': 7, # 4000 mbit/s 'igb': 6, # 400 mbit/s 'bnx2x': 4, # 100 mbit/s 'e1000e': 3, # 80 mbit/s 'e1000': 3, # 50 mbit/s 'r8169': 1, 'ATL1E': 1, '8139too': 1, # real trash, you should never use it }.get(netdevinfo.get('driver').get('driver'), 2), 'buffers': self.fold( { 'cur': Grade.int(buffers.get('cur'), 256, 4096), 'max': Grade.int(buffers.get('max'), 256, 4096), }, FOLDING_DEVICE) }, FOLDING_DEVICE)
def assess_disk(self, disk): diskinfo = extract(self.data, ['disk', disk]) return { 'type': Grade.str(diskinfo.get('type'), ['SDD'], ['HDD']), # 50Gb - good, 1Tb - good enough 'size': Grade.int(diskinfo.get('size'), 50 * (1000**3), 1000**4), }
def assess_system(self): cpuinfo = extract(self.data, ['cpu', 'info']) if cpuinfo: return { 'Hypervisor vendor': Grade.fact(cpuinfo.get('Hypervisor vendor'), False), 'Virtualization type': Grade.fact(cpuinfo.get('Hypervisor vendor'), False), }
def assess_cpu(self): cpuinfo = extract(self.data, ['cpu', 'info']) if cpuinfo: return { 'CPU MHz': Grade.int(cpuinfo.get('CPU MHz'), 2000, 4000), 'BogoMIPS': Grade.int(cpuinfo.get('BogoMIPS'), 4000, 8000), 'CPU(s)': Grade.int(cpuinfo.get('CPU(s)'), 2, 32), 'Core(s) per socket': Grade.int(cpuinfo.get('Core(s) per socket'), 1, 2), 'Socket(s)': Grade.int(cpuinfo.get('Socket(s)'), 1, 2), 'Thread(s) per core': Grade.int(cpuinfo.get('Thread(s) per core'), 2, 1), 'L3 cache': Grade.int(cpuinfo.get('L3 cache'), 1000, 30000), 'Vendor ID': Grade.str(cpuinfo.get('Vendor ID'), good=['GenuineIntel']), }