1 // SPDX-License-Identifier: GPL-2.0
3 #include "parse-events.h"
8 #include <linux/kernel.h>
9 #include <linux/zalloc.h>
11 #include "../pmu-events/pmu-events.h"
12 #include "util/evlist.h"
13 #include "util/expr.h"
14 #include "util/parse-events.h"
15 #include "metricgroup.h"
17 struct perf_pmu_test_event {
18 /* used for matching against events from generated pmu-events.c */
19 struct pmu_event event;
21 /* used for matching against event aliases */
22 /* extra events for aliases */
23 const char *alias_str;
26 * Note: For when PublicDescription does not exist in the JSON, we
27 * will have no long_desc in pmu_event.long_desc, but long_desc may
28 * be set in the alias.
30 const char *alias_long_desc;
32 /* PMU which we should match against */
33 const char *matching_pmu;
36 struct perf_pmu_test_pmu {
38 struct perf_pmu_test_event const *aliases[10];
41 static const struct perf_pmu_test_event bp_l1_btb_correct = {
43 .name = "bp_l1_btb_correct",
44 .event = "event=0x8a",
45 .desc = "L1 BTB Correction",
48 .alias_str = "event=0x8a",
49 .alias_long_desc = "L1 BTB Correction",
52 static const struct perf_pmu_test_event bp_l2_btb_correct = {
54 .name = "bp_l2_btb_correct",
55 .event = "event=0x8b",
56 .desc = "L2 BTB Correction",
59 .alias_str = "event=0x8b",
60 .alias_long_desc = "L2 BTB Correction",
63 static const struct perf_pmu_test_event segment_reg_loads_any = {
65 .name = "segment_reg_loads.any",
66 .event = "umask=0x80,period=200000,event=0x6",
67 .desc = "Number of segment register loads",
70 .alias_str = "umask=0x80,(null)=0x30d40,event=0x6",
71 .alias_long_desc = "Number of segment register loads",
74 static const struct perf_pmu_test_event dispatch_blocked_any = {
76 .name = "dispatch_blocked.any",
77 .event = "umask=0x20,period=200000,event=0x9",
78 .desc = "Memory cluster signals to block micro-op dispatch for any reason",
81 .alias_str = "umask=0x20,(null)=0x30d40,event=0x9",
82 .alias_long_desc = "Memory cluster signals to block micro-op dispatch for any reason",
85 static const struct perf_pmu_test_event eist_trans = {
88 .event = "umask=0x0,period=200000,event=0x3a",
89 .desc = "Number of Enhanced Intel SpeedStep(R) Technology (EIST) transitions",
92 .alias_str = "umask=0,(null)=0x30d40,event=0x3a",
93 .alias_long_desc = "Number of Enhanced Intel SpeedStep(R) Technology (EIST) transitions",
96 static const struct perf_pmu_test_event l3_cache_rd = {
98 .name = "l3_cache_rd",
99 .event = "event=0x40",
100 .desc = "L3 cache access, read",
101 .long_desc = "Attributable Level 3 cache access, read",
104 .alias_str = "event=0x40",
105 .alias_long_desc = "Attributable Level 3 cache access, read",
108 static const struct perf_pmu_test_event *core_events[] = {
111 &segment_reg_loads_any,
112 &dispatch_blocked_any,
118 static const struct perf_pmu_test_event uncore_hisi_ddrc_flux_wcmd = {
120 .name = "uncore_hisi_ddrc.flux_wcmd",
121 .event = "event=0x2",
122 .desc = "DDRC write commands. Unit: hisi_sccl,ddrc ",
124 .long_desc = "DDRC write commands",
125 .pmu = "hisi_sccl,ddrc",
127 .alias_str = "event=0x2",
128 .alias_long_desc = "DDRC write commands",
129 .matching_pmu = "hisi_sccl1_ddrc2",
132 static const struct perf_pmu_test_event unc_cbo_xsnp_response_miss_eviction = {
134 .name = "unc_cbo_xsnp_response.miss_eviction",
135 .event = "umask=0x81,event=0x22",
136 .desc = "Unit: uncore_cbox A cross-core snoop resulted from L3 Eviction which misses in some processor core",
138 .long_desc = "A cross-core snoop resulted from L3 Eviction which misses in some processor core",
139 .pmu = "uncore_cbox",
141 .alias_str = "umask=0x81,event=0x22",
142 .alias_long_desc = "A cross-core snoop resulted from L3 Eviction which misses in some processor core",
143 .matching_pmu = "uncore_cbox_0",
146 static const struct perf_pmu_test_event uncore_hisi_l3c_rd_hit_cpipe = {
148 .name = "uncore_hisi_l3c.rd_hit_cpipe",
149 .event = "event=0x2",
150 .desc = "Total read hits. Unit: hisi_sccl,l3c ",
152 .long_desc = "Total read hits",
153 .pmu = "hisi_sccl,l3c",
155 .alias_str = "event=0x7",
156 .alias_long_desc = "Total read hits",
157 .matching_pmu = "hisi_sccl3_l3c7",
160 static const struct perf_pmu_test_event uncore_imc_free_running_cache_miss = {
162 .name = "uncore_imc_free_running.cache_miss",
163 .event = "event=0x12",
164 .desc = "Total cache misses. Unit: uncore_imc_free_running ",
166 .long_desc = "Total cache misses",
167 .pmu = "uncore_imc_free_running",
169 .alias_str = "event=0x12",
170 .alias_long_desc = "Total cache misses",
171 .matching_pmu = "uncore_imc_free_running_0",
174 static const struct perf_pmu_test_event uncore_imc_cache_hits = {
176 .name = "uncore_imc.cache_hits",
177 .event = "event=0x34",
178 .desc = "Total cache hits. Unit: uncore_imc ",
180 .long_desc = "Total cache hits",
183 .alias_str = "event=0x34",
184 .alias_long_desc = "Total cache hits",
185 .matching_pmu = "uncore_imc_0",
188 static const struct perf_pmu_test_event *uncore_events[] = {
189 &uncore_hisi_ddrc_flux_wcmd,
190 &unc_cbo_xsnp_response_miss_eviction,
191 &uncore_hisi_l3c_rd_hit_cpipe,
192 &uncore_imc_free_running_cache_miss,
193 &uncore_imc_cache_hits,
197 static const struct perf_pmu_test_event sys_ddr_pmu_write_cycles = {
199 .name = "sys_ddr_pmu.write_cycles",
200 .event = "event=0x2b",
201 .desc = "ddr write-cycles event. Unit: uncore_sys_ddr_pmu ",
203 .pmu = "uncore_sys_ddr_pmu",
206 .alias_str = "event=0x2b",
207 .alias_long_desc = "ddr write-cycles event. Unit: uncore_sys_ddr_pmu ",
208 .matching_pmu = "uncore_sys_ddr_pmu",
211 static const struct perf_pmu_test_event *sys_events[] = {
212 &sys_ddr_pmu_write_cycles,
216 static bool is_same(const char *reference, const char *test)
218 if (!reference && !test)
221 if (reference && !test)
224 if (!reference && test)
227 return !strcmp(reference, test);
230 static struct pmu_events_map *__test_pmu_get_events_map(void)
232 struct pmu_events_map *map;
234 for (map = &pmu_events_map[0]; map->cpuid; map++) {
235 if (!strcmp(map->cpuid, "testcpu"))
239 pr_err("could not find test events map\n");
244 static struct pmu_event *__test_pmu_get_sys_events_table(void)
246 struct pmu_sys_events *tables = &pmu_sys_event_tables[0];
248 for ( ; tables->name; tables++) {
249 if (!strcmp("pme_test_soc_sys", tables->name))
250 return tables->table;
256 static int compare_pmu_events(struct pmu_event *e1, const struct pmu_event *e2)
258 if (!is_same(e1->desc, e2->desc)) {
259 pr_debug2("testing event e1 %s: mismatched desc, %s vs %s\n",
260 e1->name, e1->desc, e2->desc);
264 if (!is_same(e1->topic, e2->topic)) {
265 pr_debug2("testing event e1 %s: mismatched topic, %s vs %s\n",
266 e1->name, e1->topic, e2->topic);
270 if (!is_same(e1->long_desc, e2->long_desc)) {
271 pr_debug2("testing event e1 %s: mismatched long_desc, %s vs %s\n",
272 e1->name, e1->long_desc, e2->long_desc);
276 if (!is_same(e1->unit, e2->unit)) {
277 pr_debug2("testing event e1 %s: mismatched unit, %s vs %s\n",
278 e1->name, e1->unit, e2->unit);
282 if (!is_same(e1->perpkg, e2->perpkg)) {
283 pr_debug2("testing event e1 %s: mismatched perpkg, %s vs %s\n",
284 e1->name, e1->perpkg, e2->perpkg);
288 if (!is_same(e1->metric_expr, e2->metric_expr)) {
289 pr_debug2("testing event e1 %s: mismatched metric_expr, %s vs %s\n",
290 e1->name, e1->metric_expr, e2->metric_expr);
294 if (!is_same(e1->metric_name, e2->metric_name)) {
295 pr_debug2("testing event e1 %s: mismatched metric_name, %s vs %s\n",
296 e1->name, e1->metric_name, e2->metric_name);
300 if (!is_same(e1->deprecated, e2->deprecated)) {
301 pr_debug2("testing event e1 %s: mismatched deprecated, %s vs %s\n",
302 e1->name, e1->deprecated, e2->deprecated);
306 if (!is_same(e1->pmu, e2->pmu)) {
307 pr_debug2("testing event e1 %s: mismatched pmu string, %s vs %s\n",
308 e1->name, e1->pmu, e2->pmu);
312 if (!is_same(e1->compat, e2->compat)) {
313 pr_debug2("testing event e1 %s: mismatched compat string, %s vs %s\n",
314 e1->name, e1->compat, e2->compat);
321 static int compare_alias_to_test_event(struct perf_pmu_alias *alias,
322 struct perf_pmu_test_event const *test_event,
323 char const *pmu_name)
325 struct pmu_event const *event = &test_event->event;
327 /* An alias was found, ensure everything is in order */
328 if (!is_same(alias->name, event->name)) {
329 pr_debug("testing aliases PMU %s: mismatched name, %s vs %s\n",
330 pmu_name, alias->name, event->name);
334 if (!is_same(alias->desc, event->desc)) {
335 pr_debug("testing aliases PMU %s: mismatched desc, %s vs %s\n",
336 pmu_name, alias->desc, event->desc);
340 if (!is_same(alias->long_desc, test_event->alias_long_desc)) {
341 pr_debug("testing aliases PMU %s: mismatched long_desc, %s vs %s\n",
342 pmu_name, alias->long_desc,
343 test_event->alias_long_desc);
347 if (!is_same(alias->topic, event->topic)) {
348 pr_debug("testing aliases PMU %s: mismatched topic, %s vs %s\n",
349 pmu_name, alias->topic, event->topic);
353 if (!is_same(alias->str, test_event->alias_str)) {
354 pr_debug("testing aliases PMU %s: mismatched str, %s vs %s\n",
355 pmu_name, alias->str, test_event->alias_str);
359 if (!is_same(alias->long_desc, test_event->alias_long_desc)) {
360 pr_debug("testing aliases PMU %s: mismatched long desc, %s vs %s\n",
361 pmu_name, alias->str, test_event->alias_long_desc);
366 if (!is_same(alias->pmu_name, test_event->event.pmu)) {
367 pr_debug("testing aliases PMU %s: mismatched pmu_name, %s vs %s\n",
368 pmu_name, alias->pmu_name, test_event->event.pmu);
375 /* Verify generated events from pmu-events.c are as expected */
376 static int test_pmu_event_table(void)
378 struct pmu_event *sys_event_tables = __test_pmu_get_sys_events_table();
379 struct pmu_events_map *map = __test_pmu_get_events_map();
380 struct pmu_event *table;
381 int map_events = 0, expected_events;
383 /* ignore 3x sentinels */
384 expected_events = ARRAY_SIZE(core_events) +
385 ARRAY_SIZE(uncore_events) +
386 ARRAY_SIZE(sys_events) - 3;
388 if (!map || !sys_event_tables)
391 for (table = map->table; table->name; table++) {
392 struct perf_pmu_test_event const **test_event_table;
396 test_event_table = &uncore_events[0];
398 test_event_table = &core_events[0];
400 for (; *test_event_table; test_event_table++) {
401 struct perf_pmu_test_event const *test_event = *test_event_table;
402 struct pmu_event const *event = &test_event->event;
404 if (strcmp(table->name, event->name))
409 if (compare_pmu_events(table, event))
412 pr_debug("testing event table %s: pass\n", table->name);
416 pr_err("testing event table: could not find event %s\n",
422 for (table = sys_event_tables; table->name; table++) {
423 struct perf_pmu_test_event const **test_event_table;
426 test_event_table = &sys_events[0];
428 for (; *test_event_table; test_event_table++) {
429 struct perf_pmu_test_event const *test_event = *test_event_table;
430 struct pmu_event const *event = &test_event->event;
432 if (strcmp(table->name, event->name))
437 if (compare_pmu_events(table, event))
440 pr_debug("testing sys event table %s: pass\n", table->name);
443 pr_debug("testing event table: could not find event %s\n",
449 if (map_events != expected_events) {
450 pr_err("testing event table: found %d, but expected %d\n",
451 map_events, expected_events);
458 static struct perf_pmu_alias *find_alias(const char *test_event, struct list_head *aliases)
460 struct perf_pmu_alias *alias;
462 list_for_each_entry(alias, aliases, list)
463 if (!strcmp(test_event, alias->name))
469 /* Verify aliases are as expected */
470 static int __test_core_pmu_event_aliases(char *pmu_name, int *count)
472 struct perf_pmu_test_event const **test_event_table;
473 struct perf_pmu *pmu;
476 struct pmu_events_map *map = __test_pmu_get_events_map();
477 struct perf_pmu_alias *a, *tmp;
482 test_event_table = &core_events[0];
484 pmu = zalloc(sizeof(*pmu));
488 pmu->name = pmu_name;
490 pmu_add_cpu_aliases_map(&aliases, pmu, map);
492 for (; *test_event_table; test_event_table++) {
493 struct perf_pmu_test_event const *test_event = *test_event_table;
494 struct pmu_event const *event = &test_event->event;
495 struct perf_pmu_alias *alias = find_alias(event->name, &aliases);
498 pr_debug("testing aliases core PMU %s: no alias, alias_table->name=%s\n",
499 pmu_name, event->name);
504 if (compare_alias_to_test_event(alias, test_event, pmu_name)) {
510 pr_debug2("testing aliases core PMU %s: matched event %s\n",
511 pmu_name, alias->name);
514 list_for_each_entry_safe(a, tmp, &aliases, list) {
516 perf_pmu_free_alias(a);
522 static int __test_uncore_pmu_event_aliases(struct perf_pmu_test_pmu *test_pmu)
524 int alias_count = 0, to_match_count = 0, matched_count = 0;
525 struct perf_pmu_test_event const **table;
526 struct perf_pmu *pmu = &test_pmu->pmu;
527 const char *pmu_name = pmu->name;
528 struct perf_pmu_alias *a, *tmp, *alias;
529 struct pmu_events_map *map;
533 map = __test_pmu_get_events_map();
536 pmu_add_cpu_aliases_map(&aliases, pmu, map);
537 pmu_add_sys_aliases(&aliases, pmu);
539 /* Count how many aliases we generated */
540 list_for_each_entry(alias, &aliases, list)
543 /* Count how many aliases we expect from the known table */
544 for (table = &test_pmu->aliases[0]; *table; table++)
547 if (alias_count != to_match_count) {
548 pr_debug("testing aliases uncore PMU %s: mismatch expected aliases (%d) vs found (%d)\n",
549 pmu_name, to_match_count, alias_count);
554 list_for_each_entry(alias, &aliases, list) {
555 bool matched = false;
557 for (table = &test_pmu->aliases[0]; *table; table++) {
558 struct perf_pmu_test_event const *test_event = *table;
559 struct pmu_event const *event = &test_event->event;
561 if (!strcmp(event->name, alias->name)) {
562 if (compare_alias_to_test_event(alias,
572 if (matched == false) {
573 pr_debug("testing aliases uncore PMU %s: could not match alias %s\n",
574 pmu_name, alias->name);
580 if (alias_count != matched_count) {
581 pr_debug("testing aliases uncore PMU %s: mismatch found aliases (%d) vs matched (%d)\n",
582 pmu_name, matched_count, alias_count);
587 list_for_each_entry_safe(a, tmp, &aliases, list) {
589 perf_pmu_free_alias(a);
594 static struct perf_pmu_test_pmu test_pmus[] = {
597 .name = (char *)"hisi_sccl1_ddrc2",
601 &uncore_hisi_ddrc_flux_wcmd,
606 .name = (char *)"uncore_cbox_0",
610 &unc_cbo_xsnp_response_miss_eviction,
615 .name = (char *)"hisi_sccl3_l3c7",
619 &uncore_hisi_l3c_rd_hit_cpipe,
624 .name = (char *)"uncore_imc_free_running_0",
628 &uncore_imc_free_running_cache_miss,
633 .name = (char *)"uncore_imc_0",
637 &uncore_imc_cache_hits,
642 .name = (char *)"uncore_sys_ddr_pmu0",
647 &sys_ddr_pmu_write_cycles,
652 /* Test that aliases generated are as expected */
653 static int test_aliases(void)
655 struct perf_pmu *pmu = NULL;
658 while ((pmu = perf_pmu__scan(pmu)) != NULL) {
661 if (!is_pmu_core(pmu->name))
664 if (list_empty(&pmu->format)) {
665 pr_debug2("skipping testing core PMU %s\n", pmu->name);
669 if (__test_core_pmu_event_aliases(pmu->name, &count)) {
670 pr_debug("testing core PMU %s aliases: failed\n", pmu->name);
675 pr_debug("testing core PMU %s aliases: no events to match\n",
680 pr_debug("testing core PMU %s aliases: pass\n", pmu->name);
683 for (i = 0; i < ARRAY_SIZE(test_pmus); i++) {
684 int res = __test_uncore_pmu_event_aliases(&test_pmus[i]);
693 static bool is_number(const char *str)
699 v = strtod(str, &end_ptr);
700 (void)v; // We're not interested in this value, only if it is valid
701 return errno == 0 && end_ptr != str;
704 static int check_parse_id(const char *id, struct parse_events_error *error,
705 struct perf_pmu *fake_pmu)
707 struct evlist *evlist;
710 /* Numbers are always valid. */
714 evlist = evlist__new();
717 ret = __parse_events(evlist, id, error, fake_pmu);
718 evlist__delete(evlist);
722 static int check_parse_cpu(const char *id, bool same_cpu, struct pmu_event *pe)
724 struct parse_events_error error = { .idx = 0, };
726 int ret = check_parse_id(id, &error, NULL);
727 if (ret && same_cpu) {
728 pr_warning("Parse event failed metric '%s' id '%s' expr '%s'\n",
729 pe->metric_name, id, pe->metric_expr);
730 pr_warning("Error string '%s' help '%s'\n", error.str,
733 pr_debug3("Parse event failed, but for an event that may not be supported by this CPU.\nid '%s' metric '%s' expr '%s'\n",
734 id, pe->metric_name, pe->metric_expr);
739 free(error.first_str);
740 free(error.first_help);
744 static int check_parse_fake(const char *id)
746 struct parse_events_error error = { .idx = 0, };
747 int ret = check_parse_id(id, &error, &perf_pmu__fake);
751 free(error.first_str);
752 free(error.first_help);
756 static void expr_failure(const char *msg,
757 const struct pmu_events_map *map,
758 const struct pmu_event *pe)
760 pr_debug("%s for map %s %s %s\n",
761 msg, map->cpuid, map->version, map->type);
762 pr_debug("On metric %s\n", pe->metric_name);
763 pr_debug("On expression %s\n", pe->metric_expr);
767 struct list_head list;
768 struct metric_ref metric_ref;
771 static int resolve_metric_simple(struct expr_parse_ctx *pctx,
772 struct list_head *compound_list,
773 struct pmu_events_map *map,
774 const char *metric_name)
776 struct hashmap_entry *cur, *cur_tmp;
777 struct metric *metric, *tmp;
784 hashmap__for_each_entry_safe((&pctx->ids), cur, cur_tmp, bkt) {
785 struct metric_ref *ref;
786 struct pmu_event *pe;
788 pe = metricgroup__find_metric(cur->key, map);
792 if (!strcmp(metric_name, (char *)cur->key)) {
793 pr_warning("Recursion detected for metric %s\n", metric_name);
800 /* The metric key itself needs to go out.. */
801 expr__del_id(pctx, cur->key);
803 metric = malloc(sizeof(*metric));
809 ref = &metric->metric_ref;
810 ref->metric_name = pe->metric_name;
811 ref->metric_expr = pe->metric_expr;
812 list_add_tail(&metric->list, compound_list);
814 rc = expr__find_other(pe->metric_expr, NULL, pctx, 0);
817 break; /* The hashmap has been modified, so restart */
824 list_for_each_entry_safe(metric, tmp, compound_list, list)
831 static int test_parsing(void)
833 struct pmu_events_map *cpus_map = pmu_events_map__find();
834 struct pmu_events_map *map;
835 struct pmu_event *pe;
838 struct expr_parse_ctx ctx;
843 map = &pmu_events_map[i++];
848 struct metric *metric, *tmp;
849 struct hashmap_entry *cur;
850 LIST_HEAD(compound_list);
853 pe = &map->table[j++];
854 if (!pe->name && !pe->metric_group && !pe->metric_name)
856 if (!pe->metric_expr)
858 expr__ctx_init(&ctx);
859 if (expr__find_other(pe->metric_expr, NULL, &ctx, 0)
861 expr_failure("Parse other failed", map, pe);
866 if (resolve_metric_simple(&ctx, &compound_list, map,
868 expr_failure("Could not resolve metrics", map, pe);
870 goto exit; /* Don't tolerate errors due to severity */
874 * Add all ids with a made up value. The value may
875 * trigger divide by zero when subtracted and so try to
879 hashmap__for_each_entry((&ctx.ids), cur, bkt)
880 expr__add_id_val(&ctx, strdup(cur->key), k++);
882 hashmap__for_each_entry((&ctx.ids), cur, bkt) {
883 if (check_parse_cpu(cur->key, map == cpus_map,
888 list_for_each_entry_safe(metric, tmp, &compound_list, list) {
889 expr__add_ref(&ctx, &metric->metric_ref);
893 if (expr__parse(&result, &ctx, pe->metric_expr, 0)) {
894 expr_failure("Parse failed", map, pe);
897 expr__ctx_clear(&ctx);
900 /* TODO: fail when not ok */
902 return ret == 0 ? TEST_OK : TEST_SKIP;
909 static struct test_metric metrics[] = {
910 { "(unc_p_power_state_occupancy.cores_c0 / unc_p_clockticks) * 100." },
911 { "imx8_ddr0@read\\-cycles@ * 4 * 4", },
912 { "imx8_ddr0@axid\\-read\\,axi_mask\\=0xffff\\,axi_id\\=0x0000@ * 4", },
913 { "(cstate_pkg@c2\\-residency@ / msr@tsc@) * 100", },
914 { "(imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@)", },
917 static int metric_parse_fake(const char *str)
919 struct expr_parse_ctx ctx;
920 struct hashmap_entry *cur;
926 pr_debug("parsing '%s'\n", str);
928 expr__ctx_init(&ctx);
929 if (expr__find_other(str, NULL, &ctx, 0) < 0) {
930 pr_err("expr__find_other failed\n");
935 * Add all ids with a made up value. The value may
936 * trigger divide by zero when subtracted and so try to
940 hashmap__for_each_entry((&ctx.ids), cur, bkt)
941 expr__add_id_val(&ctx, strdup(cur->key), i++);
943 hashmap__for_each_entry((&ctx.ids), cur, bkt) {
944 if (check_parse_fake(cur->key)) {
945 pr_err("check_parse_fake failed\n");
950 if (expr__parse(&result, &ctx, str, 0))
951 pr_err("expr__parse failed\n");
956 expr__ctx_clear(&ctx);
961 * Parse all the metrics for current architecture,
962 * or all defined cpus via the 'fake_pmu'
965 static int test_parsing_fake(void)
967 struct pmu_events_map *map;
968 struct pmu_event *pe;
972 for (i = 0; i < ARRAY_SIZE(metrics); i++) {
973 err = metric_parse_fake(metrics[i].str);
980 map = &pmu_events_map[i++];
985 pe = &map->table[j++];
986 if (!pe->name && !pe->metric_group && !pe->metric_name)
988 if (!pe->metric_expr)
990 err = metric_parse_fake(pe->metric_expr);
999 static const struct {
1002 } pmu_events_testcase_table[] = {
1004 .func = test_pmu_event_table,
1005 .desc = "PMU event table sanity",
1008 .func = test_aliases,
1009 .desc = "PMU event map aliases",
1012 .func = test_parsing,
1013 .desc = "Parsing of PMU event table metrics",
1016 .func = test_parsing_fake,
1017 .desc = "Parsing of PMU event table metrics with fake PMUs",
1021 const char *test__pmu_events_subtest_get_desc(int subtest)
1024 subtest >= (int)ARRAY_SIZE(pmu_events_testcase_table))
1026 return pmu_events_testcase_table[subtest].desc;
1029 const char *test__pmu_events_subtest_skip_reason(int subtest)
1032 subtest >= (int)ARRAY_SIZE(pmu_events_testcase_table))
1034 if (pmu_events_testcase_table[subtest].func != test_parsing)
1036 return "some metrics failed";
1039 int test__pmu_events_subtest_get_nr(void)
1041 return (int)ARRAY_SIZE(pmu_events_testcase_table);
1044 int test__pmu_events(struct test *test __maybe_unused, int subtest)
1047 subtest >= (int)ARRAY_SIZE(pmu_events_testcase_table))
1049 return pmu_events_testcase_table[subtest].func();