Ejemplo n.º 1
0
def _main(options):
    'Command line entry point.'
    hrdw = []
    detect_areca(hrdw)
    detect_hpa(hrdw)
    detect_megacli(hrdw)
    detect_disks(hrdw)
    if not detect_system(hrdw):
        sys.exit(1)
    detect_ipmi(hrdw)
    detect_infiniband(hrdw)
    detect_temperatures(hrdw)
    detect_utils.get_ddr_timing(hrdw)
    detect_utils.ipmi_sdr(hrdw)
    detect_rtc_clock(hrdw)
    _, output = cmd("dmesg")
    parse_dmesg(hrdw, output)
    bios_hp.dump_hp_bios(hrdw)

    if "benchmark_cpu" in options:
        bm_cpu.cpu_perf(hrdw)

    if "benchmark_mem" in options:
        bm_mem.mem_perf(hrdw)

    if "benchmark_disk" in options:
        bm_disk.disk_perf(hrdw,
                          destructive=options['benchmark_disk_destructive'])

    hrdw = clean_tuples(hrdw)

    if "human" in options.keys():
        pprint.pprint(hrdw)
    else:
        print(json.dumps(hrdw))
Ejemplo n.º 2
0
def _main(options):
    'Command line entry point.'
    hrdw = []
    detect_hpa(hrdw)
    detect_megacli(hrdw)
    detect_disks(hrdw)
    if not detect_system(hrdw):
        sys.exit(1)
    detect_ipmi(hrdw)
    detect_infiniband(hrdw)
    detect_temperatures(hrdw)
    detect_utils.get_ddr_timing(hrdw)
    detect_utils.ipmi_sdr(hrdw)
    _, output = cmd("dmesg")
    parse_dmesg(hrdw, output)

    if "benchmark_cpu" in options:
        bm_cpu.cpu_perf(hrdw)

    if "benchmark_mem" in options:
        bm_mem.mem_perf(hrdw)

    if "benchmark_disk" in options:
        bm_disk.disk_perf(hrdw,
                          destructive=options['benchmark_disk_destructive'])

    if "human" in options.keys():
        pprint.pprint(hrdw)
    else:
        print(json.dumps(hrdw))
Ejemplo n.º 3
0
def main():
    """Command line entry point."""

    os.environ["LANG"] = "en_US.UTF-8"
    args = parse_args(sys.argv[1:])

    hrdw = []

    hrdw.extend(areca.detect())
    hrdw.extend(hpacucli.detect())
    hrdw.extend(megacli.detect())
    hrdw.extend(diskinfo.detect())

    system_info = system.detect()
    if not system_info:
        sys.exit(1)
    hrdw.extend(system_info)

    hrdw.extend(ipmi.detect())
    hrdw.extend(ib.detect())
    hrdw.extend(sensors.detect_temperatures())

    detect_utils.get_ddr_timing(hrdw)
    detect_utils.ipmi_sdr(hrdw)
    detect_rtc_clock(hrdw)
    detect_auxv(hrdw)
    parse_dmesg(hrdw)
    bios_hp.dump_hp_bios(hrdw)

    if args.benchmark:
        if 'cpu' in args.benchmark:
            bm_cpu.cpu_perf(hrdw)
        if 'mem' in args.benchmark:
            bm_mem.mem_perf(hrdw)
        if 'disk' in args.benchmark:
            bm_disk.disk_perf(hrdw,
                              destructive=args.benchmark_disk_destructive)

    hrdw = detect_utils.clean_tuples(hrdw)

    hrdw = list(filter(None, hrdw))

    if args.human:
        pprint.pprint(hrdw)
    else:
        print(json.dumps(hrdw))
Ejemplo n.º 4
0
 def test_cpu_perf(self, mock_popen, mock_cpu_socket, mock_search_info):
     mock_cpu_socket.return_value = range(2)
     mock_search_info.side_effect = ('fake-bogomips1', 'fake-cache1',
                                     'fake-bogomips2', 'fake-cache2')
     cpu.cpu_perf(self.hw_data)
     expected = [
         ('cpu', 'logical', 'number', 2),
         ('cpu', 'physical', 'number', 2),
         ('cpu', 'logical_0', 'bogomips', 'fake-bogomips1'),
         ('cpu', 'logical_0', 'cache_size', 'fake-cache1'),
         ('cpu', 'logical_1', 'bogomips', 'fake-bogomips2'),
         ('cpu', 'logical_1', 'cache_size', 'fake-cache2')
     ]
     self.assertEqual(sorted(expected), sorted(self.hw_data))
     expected = [mock.call(0, "bogomips"),
                 mock.call(0, "cache size"),
                 mock.call(1, "bogomips"),
                 mock.call(1, "cache size")]
     mock_search_info.assert_has_calls(expected)
Ejemplo n.º 5
0
 def test_cpu_perf(self, mock_popen, mock_cpu_socket, mock_search_info):
     mock_cpu_socket.return_value = range(2)
     mock_search_info.side_effect = ('fake-bogomips1', 'fake-cache1',
                                     'fake-bogomips2', 'fake-cache2')
     cpu.cpu_perf(self.hw_data)
     expected = [('cpu', 'logical', 'number', 2),
                 ('cpu', 'physical', 'number', 2),
                 ('cpu', 'logical_0', 'bogomips', 'fake-bogomips1'),
                 ('cpu', 'logical_0', 'cache_size', 'fake-cache1'),
                 ('cpu', 'logical_1', 'bogomips', 'fake-bogomips2'),
                 ('cpu', 'logical_1', 'cache_size', 'fake-cache2')]
     self.assertEqual(sorted(expected), sorted(self.hw_data))
     expected = [
         mock.call(0, "bogomips"),
         mock.call(0, "cache size"),
         mock.call(1, "bogomips"),
         mock.call(1, "cache size")
     ]
     mock_search_info.assert_has_calls(expected)
Ejemplo n.º 6
0
def main():
    """Command line entry point."""

    os.environ["LANG"] = "en_US.UTF-8"
    args = parse_args(sys.argv[1:])

    hrdw = []
    detect_areca(hrdw)
    detect_hpa(hrdw)
    detect_megacli(hrdw)
    detect_disks(hrdw)
    if not detect_system(hrdw):
        sys.exit(1)
    detect_ipmi(hrdw)
    detect_infiniband(hrdw)
    detect_temperatures(hrdw)
    detect_utils.get_ddr_timing(hrdw)
    detect_utils.ipmi_sdr(hrdw)
    detect_rtc_clock(hrdw)
    detect_auxv(hrdw)
    parse_dmesg(hrdw)
    bios_hp.dump_hp_bios(hrdw)

    if args.benchmark:
        if 'cpu' in args.benchmark:
            bm_cpu.cpu_perf(hrdw)
        if 'mem' in args.benchmark:
            bm_mem.mem_perf(hrdw)
        if 'disk' in args.benchmark:
            bm_disk.disk_perf(hrdw,
                              destructive=args.benchmark_disk_destructive)

    hrdw = clean_tuples(hrdw)

    if args.human:
        pprint.pprint(hrdw)
    else:
        print(json.dumps(hrdw))