def compute_metrics(dest_dir, bench, bench_type):
    if bench_type == HM.CPU:
        results = results_cpu
    elif bench_type == HM.MEMORY:
        results = results_memory
    elif bench_type == HM.NETWORK:
        results = results_network
    elif bench_type == HM.STORAGE:
        results = results_storage
    else:
        HL.fatal_error("Unknown benchmark type in compute_metrics")

    delta_start_jitter = {}
    duration = {}
    real_start = {}

    for host in results.keys():
        # Checking jitter settings
        if host not in start_jitter:
            HP.logger.error("Host %s should have a jitter value !" % host)
        else:
            if len(start_jitter[host]) < 2:
                HP.logger.error("Not enough start jitter information for host %s" % host)
            else:
                real_start[host] = start_jitter[host][1]
                delta_start_jitter[host] = (start_jitter[host][1] - start_jitter[host][0])
                duration[host] = (start_jitter[host][1] - stop_jitter[host])
                if (float(duration[host]) > float(bench['runtime'] + 1)):
                    HP.logger.error("Host %s took too much time : %.2f while expecting %d" % (host, duration[host], bench['runtime']))

        HP.logger.debug("Dumping result from host %s" % str(host))
        filename_and_macs = HL.generate_filename_and_macs(results[host])
        save_hw(results[host], filename_and_macs['sysname'], dest_dir)

    output = {}
    output['bench'] = bench
    output['hosts'] = results.keys()
    output['affinity'] = dump_affinity(bench, bench_type)
    output['start_time'] = real_start
    output['start_lag'] = delta_start_jitter
    output['duration'] = duration
    pprint.pprint(output, stream=open(dest_dir+"/metrics", 'w'))
dataset/ETHPy150Open redhat-cip/edeploy/src/health-server.py/compute_metrics/swapped operands of `-`