def mem_perf(hw_lst, max_time=5): """Report the memory performance.""" all_cpu_testing_time = 5 block_size_list = ['1K', '4K', '1M', '16M', '128M', '1G', '2G'] logical = utils.get_value(hw_lst, 'cpu', 'logical', 'number') physical = utils.get_value(hw_lst, 'cpu', 'physical', 'number') if physical: eta = int(physical) * len(block_size_list) * max_time eta += 2 * (all_cpu_testing_time * len(block_size_list)) sys.stderr.write('Memory Performance: %d logical CPU' ' to test (ETA: %d seconds)\n' % (int(physical), int(eta))) for cpu_nb in utils.get_one_cpu_per_socket(hw_lst): for block_size in block_size_list: run_sysbench_memory_threaded(hw_lst, max_time, block_size, 1, cpu_nb) # There is not need to test fork vs thread # if only a single logical cpu is present if int(logical) > 1: for block_size in block_size_list: run_sysbench_memory_threaded(hw_lst, all_cpu_testing_time, block_size, int(logical)) for block_size in block_size_list: run_sysbench_memory_forked(hw_lst, all_cpu_testing_time, block_size, int(logical))
def cpu_perf(hw_lst, max_time=10, burn_test=False): """Perform CPU's performance test. :param hw_lst: The hardware inventory list. :param max_time: Limit for total execution time in seconds. Defaults to 10. :param burn_test: Boolean value. Whether to perform a burn test. Defaults to False. """ logical = utils.get_value(hw_lst, 'cpu', 'logical', 'number') physical = utils.get_value(hw_lst, 'cpu', 'physical', 'number') # Individual Test aren't useful for burn_test if burn_test is False: if physical is not None: sys.stderr.write('CPU Performance: %d logical ' 'CPU to test (ETA: %d seconds)\n' % (int(physical), (int(physical) + 1) * max_time)) for processor_num in utils.get_one_cpu_per_socket(hw_lst): get_bogomips(hw_lst, processor_num) get_cache_size(hw_lst, processor_num) run_sysbench_cpu(hw_lst, max_time, 1, processor_num) else: sys.stderr.write('CPU Burn: %d logical' ' CPU to test (ETA: %d seconds)\n' % (int(logical), max_time)) run_sysbench_cpu(hw_lst, max_time, int(logical))
def cpu_perf(hw_lst, max_time=10, burn_test=False): """Perform CPU's performance test. :param hw_lst: The hardware inventory list. :param max_time: Limit for total execution time in seconds. Defaults to 10. :param burn_test: Boolean value. Whether to perform a burn test. Defaults to False. """ logical = utils.get_value(hw_lst, 'cpu', 'logical', 'number') physical = utils.get_value(hw_lst, 'cpu', 'physical', 'number') # Individual Test aren't useful for burn_test if burn_test is False: if physical is not None: sys.stderr.write('CPU Performance: %d logical ' 'CPU to test (ETA: %d seconds)\n' % (int(physical), (int(physical) + 1) * max_time)) for processor_num in utils.get_one_cpu_per_socket(hw_lst): get_bogomips(hw_lst, processor_num) get_cache_size(hw_lst, processor_num) run_sysbench_cpu(hw_lst, max_time, 1, processor_num) else: sys.stderr.write('CPU Burn: %d logical' ' CPU to test (ETA: %d seconds)\n' % ( int(logical), max_time)) run_sysbench_cpu(hw_lst, max_time, int(logical))