def create_graviton_counter_mapping()

in perfrunbook/utilities/measure_aggregated_pmu_stats.py [0:0]


def create_graviton_counter_mapping(cpu_type):
    """
    Depending on the PMUs available on the current node,
    return the proper PMU counter set.
    """
    have_cmn = os.path.isdir("/sys/devices/arm_cmn_0")
    have_pmu = os.path.isdir("/sys/devices/armv8_pmuv3_0")

    mesh_mapping = {
        "Graviton2": "CMN600",
        "Graviton3": "CMN650"
    }

    pmu_groups = []
    if have_pmu:
        pmu_groups.append(PlatformDetails(counter_mapping["Graviton"], 6))
        if cpu_type in counter_mapping:
            pmu_groups.append(PlatformDetails(counter_mapping[cpu_type], 6))
    if have_cmn:
        pmu_groups.append(PlatformDetails(counter_mapping["CMN"], 2))
        if cpu_type in mesh_mapping:
            pmu_groups.append(PlatformDetails(counter_mapping[mesh_mapping[cpu_type]], 2))

    return pmu_groups