Exemple #1
0
def mem_perf(hw_, testing_time=5):
    'Report the memory performance'
    all_cpu_testing_time = 5
    block_size_list = ['1K', '4K', '1M', '16M', '128M', '1G', '2G']
    result = HL.get_value(hw_, 'cpu', 'logical', 'number')
    physical = HL.get_value(hw_, 'cpu', 'physical', 'number')
    if physical is not None:
        eta = int(physical) * len(block_size_list) * testing_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 get_one_cpu_per_socket(hw_):
            for block_size in block_size_list:
                run_memtest(hw_, testing_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(result) > 1):
            for block_size in block_size_list:
                run_memtest(hw_, all_cpu_testing_time, block_size, int(result))

            for block_size in block_size_list:
                run_forked_memtest(hw_, all_cpu_testing_time,
                                   block_size, int(result))

    get_ddr_timing(hw_)
Exemple #2
0
def compute_affinity(bench=[]):
    affinity = {}
    global hosts

    def acceptable_host(host_list, host):
        if (len(host_list) == 0):
            return True
        if host in host_list:
            return True
        return False

    for host in hosts.keys():
        hw = hosts[host].hw
        system_id = HL.get_value(hw, "system", "product", "serial")

        if len(bench) > 0:
            if acceptable_host(bench['affinity-hosts'], system_id) is False:
                continue

        if system_id not in affinity.keys():
            affinity[system_id] = [host]
        else:
            # If the system is already known, it means that several
            # virtual machines are sharing the same Hypervisor
            affinity[system_id].append(host)

    return affinity
Exemple #3
0
def dump_hosts(log_dir):
    unique_hosts_list = []
    for host in hosts.keys():
        uuid = HL.get_value(hosts[host].hw, "system", "product", "serial")
        if uuid not in unique_hosts_list:
            unique_hosts_list.append(uuid)
    pprint.pprint(unique_hosts_list, stream=open(log_dir+"/hosts", 'w'))
Exemple #4
0
def compute_affinity(bench):
    affinity = {}

    def acceptable_host(host_list, host):
        if (len(host_list) == 0):
            return True
        if host in host_list:
            return True
        return False

    for host in hosts.keys():
        hw = hosts[host].hw
        system_id = HL.get_value(hw, "system", "product", "serial")

        if acceptable_host(bench['affinity-hosts'], system_id) is False:
            continue

        if system_id not in affinity.keys():
            affinity[system_id] = [host]
        else:
            # If the system is already known, it means that several
            # virtual machines are sharing the same Hypervisor
            affinity[system_id].append(host)

    return affinity
Exemple #5
0
def mem_perf_burn(hw_, testing_time=10):
    'Report the memory performance'
    result = HL.get_value(hw_, 'cpu', 'logical', 'number')
    if result is not None:
        sys.stderr.write('Memory Burn: %d logical CPU'
                         ' to test (ETA: %d seconds)\n' % (
                             int(result), testing_time))
        run_memtest(hw_, testing_time, '128M', int(result))
Exemple #6
0
def dump_hosts(log_dir):
    global hosts
    unique_hosts_list = []
    for host in hosts.keys():
        uuid = HL.get_value(hosts[host].hw, "system", "product", "serial")
        if uuid not in unique_hosts_list:
            unique_hosts_list.append(uuid)
    pprint.pprint(unique_hosts_list, stream=open(log_dir + "/hosts", 'w'))
    pprint.pprint(compute_affinity(), stream=open(log_dir + "/affinity", 'w'))
Exemple #7
0
def get_output_filename(hw_):
    sysname = ''

    sysprodname = HL.get_value(hw_, 'system', 'product', 'name')
    if sysprodname:
        sysname = re.sub(r'\W+', '', sysprodname) + '-'

    sysprodvendor = HL.get_value(hw_, 'system', 'product', 'vendor')
    if sysprodvendor:
        sysname += re.sub(r'\W+', '', sysprodvendor) + '-'

    sysprodserial = HL.get_value(hw_, 'system', 'product', 'serial')
    if sysprodserial:
        sysname += re.sub(r'\W+', '', sysprodserial)

    mac = get_mac(hw_, 'network', 'serial')
    if mac:
        sysname += mac.replace(':', '-')

    return sysname + ".hw_"
Exemple #8
0
def cpu_perf(hw_, testing_time=10, burn_test=False):
    ' Detect the cpu speed'
    result = HL.get_value(hw_, 'cpu', 'logical', 'number')
    physical = HL.get_value(hw_, '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) * testing_time))
            for cpu_nb in get_one_cpu_per_socket(hw_):
                get_bogomips(hw_, cpu_nb)
                get_cache_size(hw_, cpu_nb)
                HL.run_sysbench(hw_, testing_time, 1, cpu_nb)
    else:
        sys.stderr.write('CPU Burn: %d logical'
                         ' CPU to test (ETA: %d seconds)\n' % (
                             int(result), testing_time))

    HL.run_sysbench(hw_, testing_time, int(result))
Exemple #9
0
def get_one_cpu_per_socket(hw):
    logical = HL.get_value(hw, 'cpu', 'logical', 'number')
    current_phys_package_id = -1
    cpu_list = []
    for cpu_nb in range(int(logical)):
        cmdline = "cat /sys/devices/system/cpu/cpu%d/topology" + \
                  "/physical_package_id" % int(cpu_nb)
        phys_cmd = subprocess.Popen(cmdline,
                                    shell=True, stdout=subprocess.PIPE)
        for phys_str in phys_cmd.stdout:
            phys_id = int(phys_str.strip())
            if phys_id > current_phys_package_id:
                current_phys_package_id = phys_id
                cpu_list.append(current_phys_package_id)

    return cpu_list