On 1/17/22 09:53, Like Xu wrote:
+/* Mapping between CPUID 0x0A.EBX bit vector and enum perf_hw_id. */ +static inline int map_unavail_bit_to_perf_hw_id(int bit) +{ + switch (bit) { + case 0: + case 1: + return bit; + case 2: + return PERF_COUNT_HW_BUS_CYCLES; + case 3: + case 4: + case 5: + case 6: + return --bit; + } + + return PERF_COUNT_HW_MAX; +} +
Please use an array here (e.g. cpuid_event_to_perf_hw_id_map[]). Paolo