def stats_tcp(host_cpu_model: str, iperf3_id: str, env_id: str):
    """Define statistics for TCP measurements."""
    cpus = CONFIG["hosts"]["instances"]["m5d.metal"]["cpus"]
    for cpu in cpus:
        if cpu["model"] == host_cpu_model:
            baseline_bw = cpu["baseline_bw"][env_id][iperf3_id]
            delta_throughput =\
                baseline_bw[DELTA_PERCENTAGE_TAG] * \
                baseline_bw[TARGET_TAG] / 100
            baseline_cpu_util = cpu["baseline_cpu_utilization"][env_id]
            baseline_cpu_host = baseline_cpu_util[CPU_UTILIZATION_VMM_TAG][
                iperf3_id]
            baseline_host_target = baseline_cpu_host[TARGET_TAG]
            baseline_host_delta = \
                baseline_cpu_host[DELTA_PERCENTAGE_TAG] * \
                baseline_host_target / 100
            baseline_cpu_guest = \
                baseline_cpu_util[CPU_UTILIZATION_VCPUS_TOTAL_TAG][iperf3_id]
            baseline_guest_target = baseline_cpu_guest[TARGET_TAG]
            baseline_guest_delta = \
                baseline_cpu_guest[DELTA_PERCENTAGE_TAG] * \
                baseline_guest_target / 100

            return [
                types.StatisticDef(THROUGHPUT_TOTAL, THROUGHPUT, function.Sum,
                                   criteria.EqualWith(baseline_bw[TARGET_TAG],
                                                      delta_throughput)),
                types.StatisticDef(RETRANSMITS_TOTAL, RETRANSMITS,
                                   function.Sum),
                types.StatisticDef(DURATION_TOTAL, DURATION, function.Avg),
                types.StatisticDef(CPU_UTILIZATION_VMM_TAG,
                                   CPU_UTILIZATION_HOST,
                                   function.Identity,
                                   criteria.EqualWith(baseline_host_target,
                                                      baseline_host_delta)),
                types.StatisticDef(CPU_UTILIZATION_VCPUS_TOTAL_TAG,
                                   CPU_UTILIZATION_GUEST,
                                   function.Identity,
                                   criteria.EqualWith(baseline_guest_target,
                                                      baseline_guest_delta))
            ]
    return [
        types.StatisticDef(THROUGHPUT_TOTAL, THROUGHPUT, function.Sum),
        types.StatisticDef(RETRANSMITS_TOTAL, RETRANSMITS, function.Sum),
        types.StatisticDef(DURATION_TOTAL, DURATION, function.Avg),
        types.StatisticDef(CPU_UTILIZATION_VMM_TAG, CPU_UTILIZATION_HOST,
                           function.Identity),
        types.StatisticDef(CPU_UTILIZATION_VCPUS_TOTAL_TAG,
                           CPU_UTILIZATION_GUEST,
                           function.Identity)
    ]
示例#2
0
def stats_vsock(host_cpu_model: str, iperf3_id: str, env_id: str):
    """Define statistics and pass criteria for VSOCK measurements."""
    cpus = CONFIG["hosts"]["instances"]["m5d.metal"]["cpus"]
    for cpu in cpus:
        if cpu["model"] == host_cpu_model:
            baseline_bw = cpu["baseline_bw"][env_id][iperf3_id]
            delta_throughput = baseline_bw[DELTA_PERCENTAGE_TAG] * \
                baseline_bw[TARGET_TAG] / 100
            baseline_cpu_util = cpu["baseline_cpu_utilization"][env_id]
            baseline_cpu_host = \
                baseline_cpu_util[CPU_UTILIZATION_VMM_TAG][iperf3_id]
            baseline_host_target = baseline_cpu_host[TARGET_TAG]
            baseline_host_delta = \
                baseline_cpu_host[DELTA_PERCENTAGE_TAG] * \
                baseline_host_target / 100
            baseline_cpu_guest = \
                baseline_cpu_util[CPU_UTILIZATION_VCPUS_TOTAL_TAG][iperf3_id]
            baseline_guest_target = baseline_cpu_guest[TARGET_TAG]
            baseline_guest_delta = \
                baseline_guest_target * baseline_guest_target / 100

            return \
                [types.StatisticDef(THROUGHPUT_TOTAL, THROUGHPUT, function.Sum,
                                    criteria.EqualWith(baseline_bw[TARGET_TAG],
                                                       delta_throughput)),
                 types.StatisticDef(DURATION_TOTAL, DURATION, function.Avg),
                 types.StatisticDef(CPU_UTILIZATION_VMM_TAG,
                                    CPU_UTILIZATION_HOST,
                                    function.Identity,
                                    criteria.EqualWith(baseline_host_target,
                                                       baseline_host_delta)),
                 types.StatisticDef(CPU_UTILIZATION_VCPUS_TOTAL_TAG,
                                    CPU_UTILIZATION_GUEST,
                                    function.Identity,
                                    criteria.EqualWith(baseline_guest_target,
                                                       baseline_guest_delta))
                 ]

    # If there are no baselines for the host CPU model, do not define any
    # criteria. Useful for gathering baselines on new CPUs.
    return [types.StatisticDef(THROUGHPUT_TOTAL, THROUGHPUT, function.Sum),
            types.StatisticDef(DURATION_TOTAL, DURATION, function.Avg),
            types.StatisticDef(CPU_UTILIZATION_VMM_TAG,
                               CPU_UTILIZATION_HOST,
                               function.Identity),
            types.StatisticDef(CPU_UTILIZATION_VCPUS_TOTAL_TAG,
                               CPU_UTILIZATION_GUEST,
                               function.Identity)
            ]
示例#3
0
def pass_criteria():
    """Define pass criteria for the statistics."""
    delta = BASELINES[platform.machine()]["delta"]
    target = BASELINES[platform.machine()]["target"]

    return {
        types.DefaultStat.AVG.name: criteria.EqualWith(target, delta)
    }
def criteria_ops_stats(env_id: str, fio_id: str, operation: str):
    """Return statistics with pass criteria given by the baselines."""
    bw_key = f"baseline_{BW.format(operation)}/{env_id}/{fio_id}"
    iops_key = f"baseline_{IOPS.format(operation)}/{env_id}/{fio_id}"
    blk_baseline_provider = BlockBaselineProvider(get_cpu_model_name())
    return [
        st.consumer.StatisticDef.avg(
            IOPS.format(operation),
            criteria=criteria.EqualWith(
                blk_baseline_provider.target(iops_key),
                blk_baseline_provider.delta(iops_key))),
        st.consumer.StatisticDef.stddev(IOPS.format(operation)),
        st.consumer.StatisticDef.avg(
            BW.format(operation),
            criteria=criteria.EqualWith(
                blk_baseline_provider.target(bw_key),
                blk_baseline_provider.delta(bw_key))),
        st.consumer.StatisticDef.stddev(BW.format(operation))]
def criteria_stats(cpu_baseline: dict, iperf3_id: str, env_id: str):
    """Return statistics definitions based with pass criteria."""
    [kernel, rootfs] = env_id.split("/")

    baseline_bw = cpu_baseline["throughput"][kernel][rootfs][iperf3_id]
    delta_throughput = \
        baseline_bw[test_cfg.DELTA_PERCENTAGE_TAG] * \
        baseline_bw[test_cfg.TARGET_TAG] / 100
    baseline_cpu_host = cpu_baseline["cpu_utilization_vmm"][kernel][rootfs][
        iperf3_id]
    baseline_vmm_target = baseline_cpu_host[test_cfg.TARGET_TAG]
    baseline_vmm_delta = \
        baseline_cpu_host[test_cfg.DELTA_PERCENTAGE_TAG] * \
        baseline_vmm_target / 100
    baseline_cpu_vcpus_total = \
        cpu_baseline["cpu_utilization_vcpus_total"][kernel][rootfs][iperf3_id]
    baseline_vcpus_total_target = baseline_cpu_vcpus_total[test_cfg.TARGET_TAG]
    baseline_vcpus_total_delta = \
        baseline_cpu_vcpus_total[test_cfg.DELTA_PERCENTAGE_TAG] * \
        baseline_vcpus_total_target / 100

    return [
        types.StatisticDef.sum(
            st_name=test_cfg.THROUGHPUT_TOTAL,
            ms_name=test_cfg.THROUGHPUT,
            criteria=criteria.EqualWith(baseline_bw[test_cfg.TARGET_TAG],
                                        delta_throughput)),
        types.StatisticDef.sum(ms_name=test_cfg.RETRANSMITS,
                               st_name=test_cfg.RETRANSMITS_TOTAL),
        types.StatisticDef.avg(test_cfg.DURATION),
        types.StatisticDef.get_first_observation(
            ms_name=test_cfg.CPU_UTILIZATION_VMM,
            st_name="value",
            criteria=criteria.EqualWith(baseline_vmm_target,
                                        baseline_vmm_delta)),
        types.StatisticDef.get_first_observation(
            ms_name=test_cfg.CPU_UTILIZATION_VCPUS_TOTAL,
            st_name="value",
            criteria=criteria.EqualWith(baseline_vcpus_total_target,
                                        baseline_vcpus_total_delta))]
def criteria_cpu_utilization_stats(env_id, fio_id):
    """Return the set of CPU utilization statistics with criteria."""
    cpu_util_vmm_key = f"baseline_cpu_utilization_vmm/{env_id}/{fio_id}"
    cpu_util_vcpus_total_key = "baseline_cpu_utilization_vcpus_total/" \
                               f"{env_id}/{fio_id}"
    blk_baseline_provider = BlockBaselineProvider(get_cpu_model_name())
    return [
        st.consumer.StatisticDef.get_first_observation(
            st_name="value",
            ms_name=CPU_UTILIZATION_VMM,
            criteria=criteria.EqualWith(
                blk_baseline_provider.target(cpu_util_vmm_key),
                blk_baseline_provider.delta(cpu_util_vmm_key))
        ),
        st.consumer.StatisticDef.get_first_observation(
            st_name="value",
            ms_name=CPU_UTILIZATION_VCPUS_TOTAL,
            criteria=criteria.EqualWith(
                blk_baseline_provider.target(cpu_util_vcpus_total_key),
                blk_baseline_provider.delta(cpu_util_vcpus_total_key))
        )
    ]
def criteria_stats(cpu_baselines: str, iperf3_id: str, env_id: str):
    """Return statistics tailored to the platform cpu model."""
    [kernel, rootfs] = env_id.split("/")

    baseline_bw = cpu_baselines["throughput"][kernel][rootfs][iperf3_id]
    delta_throughput = \
        baseline_bw[test_cfg.DELTA_PERCENTAGE_TAG] * baseline_bw[
            test_cfg.TARGET_TAG] / 100
    baseline_cpu_host = \
        cpu_baselines["cpu_utilization_vmm"][kernel][rootfs][iperf3_id]
    baseline_host_target = baseline_cpu_host[test_cfg.TARGET_TAG]
    baseline_host_delta = \
        baseline_cpu_host[test_cfg.DELTA_PERCENTAGE_TAG] * \
        baseline_host_target / 100
    baseline_cpu_guest = \
        cpu_baselines["cpu_utilization_vcpus_total"][kernel][rootfs][iperf3_id]
    baseline_guest_target = baseline_cpu_guest[test_cfg.TARGET_TAG]
    baseline_guest_delta = \
        baseline_guest_target * baseline_guest_target / 100

    return [
        types.StatisticDef.sum(
            st_name=test_cfg.THROUGHPUT_TOTAL,
            ms_name=test_cfg.THROUGHPUT,
            criteria=criteria.EqualWith(baseline_bw[test_cfg.TARGET_TAG],
                                        delta_throughput)),
        types.StatisticDef.avg(test_cfg.DURATION),
        types.StatisticDef.get_first_observation(
            st_name="value",
            ms_name=test_cfg.CPU_UTILIZATION_VMM,
            criteria=criteria.EqualWith(baseline_host_target,
                                        baseline_host_delta)),
        types.StatisticDef.get_first_observation(
            st_name="value",
            ms_name=test_cfg.CPU_UTILIZATION_VCPUS_TOTAL,
            criteria=criteria.EqualWith(baseline_guest_target,
                                        baseline_guest_delta)
        )
    ]
示例#8
0
def pass_criteria():
    """Define pass criteria for the statistics."""
    return {
        "Avg": criteria.EqualWith(LATENCY_AVG_BASELINES[platform.machine()])
    }
示例#9
0
def pass_criteria():
    """Define pass criteria for the statistics."""
    delta = BASELINES[platform.machine()]["delta"]
    target = BASELINES[platform.machine()]["target"]

    return {function.Avg.name(): criteria.EqualWith(target, delta)}