Lines Matching +full:event +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0
3 #include "parse-events.h"
12 #include "../pmu-events/pmu-events.h"
17 #include "util/parse-events.h"
22 /* used for matching against events from generated pmu-events.c */
23 struct pmu_event event; member
25 /* used for matching against event aliases */
46 .event = {
48 .name = "bp_l1_btb_correct",
49 .event = "event=0x8a",
53 .alias_str = "event=0x8a",
58 .event = {
60 .name = "bp_l2_btb_correct",
61 .event = "event=0x8b",
65 .alias_str = "event=0x8b",
70 .event = {
72 .name = "segment_reg_loads.any",
73 .event = "event=0x6,period=200000,umask=0x80",
77 .alias_str = "event=0x6,period=0x30d40,umask=0x80",
82 .event = {
84 .name = "dispatch_blocked.any",
85 .event = "event=0x9,period=200000,umask=0x20",
86 .desc = "Memory cluster signals to block micro-op dispatch for any reason",
89 .alias_str = "event=0x9,period=0x30d40,umask=0x20",
90 .alias_long_desc = "Memory cluster signals to block micro-op dispatch for any reason",
94 .event = {
96 .name = "eist_trans",
97 .event = "event=0x3a,period=200000,umask=0x0",
101 .alias_str = "event=0x3a,period=0x30d40,umask=0",
106 .event = {
108 .name = "l3_cache_rd",
109 .event = "event=0x40",
114 .alias_str = "event=0x40",
129 .event = {
130 .name = "uncore_hisi_ddrc.flux_wcmd",
131 .event = "event=0x2",
137 .alias_str = "event=0x2",
143 .event = {
144 .name = "unc_cbo_xsnp_response.miss_eviction",
145 .event = "event=0x22,umask=0x81",
146 .desc = "A cross-core snoop resulted from L3 Eviction which misses in some processor core",
148 .long_desc = "A cross-core snoop resulted from L3 Eviction which misses in some processor core",
151 .alias_str = "event=0x22,umask=0x81",
152 ….alias_long_desc = "A cross-core snoop resulted from L3 Eviction which misses in some processor co…
157 .event = {
158 .name = "event-hyphen",
159 .event = "event=0xe0,umask=0x00",
165 .alias_str = "event=0xe0,umask=0",
171 .event = {
172 .name = "event-two-hyph",
173 .event = "event=0xc0,umask=0x00",
179 .alias_str = "event=0xc0,umask=0",
185 .event = {
186 .name = "uncore_hisi_l3c.rd_hit_cpipe",
187 .event = "event=0x7",
193 .alias_str = "event=0x7",
199 .event = {
200 .name = "uncore_imc_free_running.cache_miss",
201 .event = "event=0x12",
207 .alias_str = "event=0x12",
213 .event = {
214 .name = "uncore_imc.cache_hits",
215 .event = "event=0x34",
221 .alias_str = "event=0x34",
238 .event = {
239 .name = "sys_ddr_pmu.write_cycles",
240 .event = "event=0x2b",
241 .desc = "ddr write-cycles event",
246 .alias_str = "event=0x2b",
247 .alias_long_desc = "ddr write-cycles event",
252 .event = {
253 .name = "sys_ccn_pmu.read_cycles",
254 .event = "config=0x2c",
255 .desc = "ccn read-cycles event",
261 .alias_long_desc = "ccn read-cycles event",
287 if (!is_same(e1->name, e2->name)) { in compare_pmu_events()
288 pr_debug2("testing event e1 %s: mismatched name string, %s vs %s\n", in compare_pmu_events()
289 e1->name, e1->name, e2->name); in compare_pmu_events()
290 return -1; in compare_pmu_events()
293 if (!is_same(e1->compat, e2->compat)) { in compare_pmu_events()
294 pr_debug2("testing event e1 %s: mismatched compat string, %s vs %s\n", in compare_pmu_events()
295 e1->name, e1->compat, e2->compat); in compare_pmu_events()
296 return -1; in compare_pmu_events()
299 if (!is_same(e1->event, e2->event)) { in compare_pmu_events()
300 pr_debug2("testing event e1 %s: mismatched event, %s vs %s\n", in compare_pmu_events()
301 e1->name, e1->event, e2->event); in compare_pmu_events()
302 return -1; in compare_pmu_events()
305 if (!is_same(e1->desc, e2->desc)) { in compare_pmu_events()
306 pr_debug2("testing event e1 %s: mismatched desc, %s vs %s\n", in compare_pmu_events()
307 e1->name, e1->desc, e2->desc); in compare_pmu_events()
308 return -1; in compare_pmu_events()
311 if (!is_same(e1->topic, e2->topic)) { in compare_pmu_events()
312 pr_debug2("testing event e1 %s: mismatched topic, %s vs %s\n", in compare_pmu_events()
313 e1->name, e1->topic, e2->topic); in compare_pmu_events()
314 return -1; in compare_pmu_events()
317 if (!is_same(e1->long_desc, e2->long_desc)) { in compare_pmu_events()
318 pr_debug2("testing event e1 %s: mismatched long_desc, %s vs %s\n", in compare_pmu_events()
319 e1->name, e1->long_desc, e2->long_desc); in compare_pmu_events()
320 return -1; in compare_pmu_events()
323 if (!is_same(e1->pmu, e2->pmu)) { in compare_pmu_events()
324 pr_debug2("testing event e1 %s: mismatched pmu string, %s vs %s\n", in compare_pmu_events()
325 e1->name, e1->pmu, e2->pmu); in compare_pmu_events()
326 return -1; in compare_pmu_events()
329 if (!is_same(e1->unit, e2->unit)) { in compare_pmu_events()
330 pr_debug2("testing event e1 %s: mismatched unit, %s vs %s\n", in compare_pmu_events()
331 e1->name, e1->unit, e2->unit); in compare_pmu_events()
332 return -1; in compare_pmu_events()
335 if (e1->perpkg != e2->perpkg) { in compare_pmu_events()
336 pr_debug2("testing event e1 %s: mismatched perpkg, %d vs %d\n", in compare_pmu_events()
337 e1->name, e1->perpkg, e2->perpkg); in compare_pmu_events()
338 return -1; in compare_pmu_events()
341 if (e1->deprecated != e2->deprecated) { in compare_pmu_events()
342 pr_debug2("testing event e1 %s: mismatched deprecated, %d vs %d\n", in compare_pmu_events()
343 e1->name, e1->deprecated, e2->deprecated); in compare_pmu_events()
344 return -1; in compare_pmu_events()
354 struct pmu_event const *event = &test_event->event; in compare_alias_to_test_event() local
357 if (!is_same(alias->name, event->name)) { in compare_alias_to_test_event()
358 pr_debug("testing aliases PMU %s: mismatched name, %s vs %s\n", in compare_alias_to_test_event()
359 pmu_name, alias->name, event->name); in compare_alias_to_test_event()
360 return -1; in compare_alias_to_test_event()
363 if (!is_same(alias->desc, event->desc)) { in compare_alias_to_test_event()
365 pmu_name, alias->desc, event->desc); in compare_alias_to_test_event()
366 return -1; in compare_alias_to_test_event()
369 if (!is_same(alias->long_desc, test_event->alias_long_desc)) { in compare_alias_to_test_event()
371 pmu_name, alias->long_desc, in compare_alias_to_test_event()
372 test_event->alias_long_desc); in compare_alias_to_test_event()
373 return -1; in compare_alias_to_test_event()
376 if (!is_same(alias->topic, event->topic)) { in compare_alias_to_test_event()
378 pmu_name, alias->topic, event->topic); in compare_alias_to_test_event()
379 return -1; in compare_alias_to_test_event()
382 if (!is_same(alias->str, test_event->alias_str)) { in compare_alias_to_test_event()
384 pmu_name, alias->str, test_event->alias_str); in compare_alias_to_test_event()
385 return -1; in compare_alias_to_test_event()
388 if (!is_same(alias->long_desc, test_event->alias_long_desc)) { in compare_alias_to_test_event()
390 pmu_name, alias->str, test_event->alias_long_desc); in compare_alias_to_test_event()
391 return -1; in compare_alias_to_test_event()
394 if (!is_same(alias->pmu_name, test_event->event.pmu) && in compare_alias_to_test_event()
395 !is_same(alias->pmu_name, "default_core")) { in compare_alias_to_test_event()
397 pmu_name, alias->pmu_name, test_event->event.pmu); in compare_alias_to_test_event()
398 return -1; in compare_alias_to_test_event()
412 if (strcmp(pe->pmu, "default_core")) in test__pmu_event_table_core_callback()
419 struct pmu_event const *event = &test_event->event; in test__pmu_event_table_core_callback() local
421 if (strcmp(pe->name, event->name)) in test__pmu_event_table_core_callback()
426 if (compare_pmu_events(pe, event)) in test__pmu_event_table_core_callback()
427 return -1; in test__pmu_event_table_core_callback()
429 pr_debug("testing event table %s: pass\n", pe->name); in test__pmu_event_table_core_callback()
432 pr_err("testing event table: could not find event %s\n", pe->name); in test__pmu_event_table_core_callback()
433 return -1; in test__pmu_event_table_core_callback()
450 struct pmu_event const *event = &test_event->event; in test__pmu_event_table_sys_callback() local
452 if (strcmp(pe->name, event->name)) in test__pmu_event_table_sys_callback()
457 if (compare_pmu_events(pe, event)) in test__pmu_event_table_sys_callback()
460 pr_debug("testing sys event table %s: pass\n", pe->name); in test__pmu_event_table_sys_callback()
463 pr_debug("testing sys event table: could not find event %s\n", pe->name); in test__pmu_event_table_sys_callback()
469 /* Verify generated events from pmu-events.c are as expected */
481 ARRAY_SIZE(sys_events) - 3; in test__pmu_event_table()
484 return -1; in test__pmu_event_table()
499 pr_err("testing event table: found %d, but expected %d\n", in test__pmu_event_table()
516 if (compare_alias_to_test_event(alias, args->test_event, alias->pmu->name)) in test_core_pmu_event_aliases_cb()
517 return -1; in test_core_pmu_event_aliases_cb()
518 (*args->count)++; in test_core_pmu_event_aliases_cb()
519 pr_debug2("testing aliases core PMU %s: matched event %s\n", in test_core_pmu_event_aliases_cb()
520 alias->pmu_name, alias->name); in test_core_pmu_event_aliases_cb()
533 return -1; in __test_core_pmu_event_aliases()
539 return -1; in __test_core_pmu_event_aliases()
541 INIT_LIST_HEAD(&pmu->format); in __test_core_pmu_event_aliases()
542 INIT_LIST_HEAD(&pmu->aliases); in __test_core_pmu_event_aliases()
543 INIT_LIST_HEAD(&pmu->caps); in __test_core_pmu_event_aliases()
544 INIT_LIST_HEAD(&pmu->list); in __test_core_pmu_event_aliases()
545 pmu->name = strdup(pmu_name); in __test_core_pmu_event_aliases()
546 pmu->is_core = true; in __test_core_pmu_event_aliases()
548 pmu->events_table = table; in __test_core_pmu_event_aliases()
550 pmu->cpu_aliases_added = true; in __test_core_pmu_event_aliases()
551 pmu->sysfs_aliases_loaded = true; in __test_core_pmu_event_aliases()
555 pr_debug("Missing test event in test architecture"); in __test_core_pmu_event_aliases()
560 struct pmu_event const *event = &test_event.event; in __test_core_pmu_event_aliases() local
567 test_event.event.pmu = pmu_name; in __test_core_pmu_event_aliases()
568 err = perf_pmu__find_event(pmu, event->name, &args, in __test_core_pmu_event_aliases()
582 struct perf_pmu *pmu = &test_pmu->pmu; in __test_uncore_pmu_event_aliases()
583 const char *pmu_name = pmu->name; in __test_uncore_pmu_event_aliases()
589 return -1; in __test_uncore_pmu_event_aliases()
590 pmu->events_table = events_table; in __test_uncore_pmu_event_aliases()
592 pmu->cpu_aliases_added = true; in __test_uncore_pmu_event_aliases()
593 pmu->sysfs_aliases_loaded = true; in __test_uncore_pmu_event_aliases()
600 for (table = &test_pmu->aliases[0]; *table; table++) in __test_uncore_pmu_event_aliases()
606 return -1; in __test_uncore_pmu_event_aliases()
609 for (table = &test_pmu->aliases[0]; *table; table++) { in __test_uncore_pmu_event_aliases()
611 struct pmu_event const *event = &test_event.event; in __test_uncore_pmu_event_aliases() local
618 err = perf_pmu__find_event(pmu, event->name, &args, in __test_uncore_pmu_event_aliases()
623 pmu_name, event->name); in __test_uncore_pmu_event_aliases()
624 return -1; in __test_uncore_pmu_event_aliases()
631 res = -1; in __test_uncore_pmu_event_aliases()
639 .name = "hisi_sccl1_ddrc2",
648 .name = "uncore_cbox_0",
659 .name = "hisi_sccl3_l3c7",
668 .name = "uncore_imc_free_running_0",
677 .name = "uncore_imc_0",
686 .name = "uncore_sys_ddr_pmu0",
696 .name = "uncore_sys_ccn_pmu4",
716 if (list_empty(&pmu->format)) { in test__aliases()
717 pr_debug2("skipping testing core PMU %s\n", pmu->name); in test__aliases()
721 if (__test_core_pmu_event_aliases(pmu->name, &count)) { in test__aliases()
722 pr_debug("testing core PMU %s aliases: failed\n", pmu->name); in test__aliases()
723 return -1; in test__aliases()
728 pmu->name); in test__aliases()
729 return -1; in test__aliases()
732 pr_debug("testing core PMU %s aliases: pass\n", pmu->name); in test__aliases()
774 return -ENOMEM; in check_parse_id()
778 return -ENOMEM; in check_parse_id()
821 if (!pm->metric_expr) in test__parsing_callback()
824 pr_debug("Found metric '%s'\n", pm->metric_name); in test__parsing_callback()
833 return -ENOMEM; in test__parsing_callback()
838 return -ENOMEM; in test__parsing_callback()
841 perf_evlist__set_maps(&evlist->core, cpus, NULL); in test__parsing_callback()
843 err = metricgroup__parse_groups_test(evlist, table, pm->metric_name, &metric_events); in test__parsing_callback()
845 if (!strcmp(pm->metric_name, "M1") || !strcmp(pm->metric_name, "M2") || in test__parsing_callback()
846 !strcmp(pm->metric_name, "M3")) { in test__parsing_callback()
847 (*failures)--; in test__parsing_callback()
848 pr_debug("Expected broken metric %s skipping\n", pm->metric_name); in test__parsing_callback()
864 evsel->stats->aggr->counts.val = k; in test__parsing_callback()
875 list_for_each_entry (mexp, &me->head, nd) { in test__parsing_callback()
876 if (strcmp(mexp->metric_name, pm->metric_name)) in test__parsing_callback()
880 (*failures)--; in test__parsing_callback()
885 pr_debug("Didn't find parsed metric %s", pm->metric_name); in test__parsing_callback()
889 pr_debug("Broken metric %s\n", pm->metric_name); in test__parsing_callback()
916 { "imx8_ddr0@read\\-cycles@ * 4 * 4", },
917 { "imx8_ddr0@axid\\-read\\,axi_mask\\=0xffff\\,axi_id\\=0x0000@ * 4", },
918 { "(cstate_pkg@c2\\-residency@ / msr@tsc@) * 100", },
919 { "(imx8_ddr0@read\\-cycles@ + imx8_ddr0@write\\-cycles@)", },
927 int ret = -1; in metric_parse_fake()
938 ctx->sctx.is_test = true; in metric_parse_fake()
941 return -1; in metric_parse_fake()
950 hashmap__for_each_entry(ctx->ids, cur, bkt) in metric_parse_fake()
951 expr__add_id_val(ctx, strdup(cur->pkey), i++); in metric_parse_fake()
953 hashmap__for_each_entry(ctx->ids, cur, bkt) { in metric_parse_fake()
954 if (check_parse_fake(cur->pkey)) { in metric_parse_fake()
967 hashmap__for_each_entry(ctx->ids, cur, bkt) in metric_parse_fake()
968 expr__add_id_val(ctx, strdup(cur->pkey), i--); in metric_parse_fake()
976 ret = -1; in metric_parse_fake()
989 return metric_parse_fake(pm->metric_name, pm->metric_expr); in test__parsing_fake_callback()
1019 if (!pm->metric_threshold) in test__parsing_threshold_callback()
1021 return metric_parse_fake(pm->metric_name, pm->metric_threshold); in test__parsing_threshold_callback()
1037 TEST_CASE("PMU event table sanity", pmu_event_table),
1038 TEST_CASE("PMU event map aliases", aliases),
1039 TEST_CASE_REASON("Parsing of PMU event table metrics", parsing,
1041 TEST_CASE("Parsing of PMU event table metrics with fake PMUs", parsing_fake),
1043 { .name = NULL, }