Commit 754baf4
perf pmu: Change aliases from list to hashmap
Finding an alias for things like perf_pmu__have_event() would need to
search the aliases list, whilst this happens relatively infrequently it
can be a significant overhead in testing.
Switch to using a hashmap. Move common initialization code to
perf_pmu__init(). Refactor the test 'struct perf_pmu_test_pmu' to not
have perf pmu within it to better support the perf_pmu__init() function.
Before:
```
$ time perf test "Parsing of PMU event table metrics"
10.3: Parsing of PMU event table metrics : Ok
10.4: Parsing of PMU event table metrics with fake PMUs : Ok
real 0m13.287s
user 0m13.026s
sys 0m0.532s
```
After:
```
$ time perf test "Parsing of PMU event table metrics"
10.3: Parsing of PMU event table metrics : Ok
10.4: Parsing of PMU event table metrics with fake PMUs : Ok
real 0m13.011s
user 0m12.885s
sys 0m0.485s
```
Committer testing:
root@number:~# grep -m1 'model name' /proc/cpuinfo
model name : AMD Ryzen 9 9950X3D 16-Core Processor
root@number:~#
Before:
root@number:~# time perf test "Parsing of PMU event table metrics"
10.3: Parsing of PMU event table metrics : Ok
10.4: Parsing of PMU event table metrics with fake PMUs : Ok
real 0m9.296s
user 0m9.361s
sys 0m0.063s
root@number:~#
After:
root@number:~# time perf test "Parsing of PMU event table metrics"
10.3: Parsing of PMU event table metrics : Ok
10.4: Parsing of PMU event table metrics with fake PMUs : Ok
real 0m9.286s
user 0m9.354s
sys 0m0.062s
root@number:~#
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Xu Yang <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20250512194622.33258-3-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>1 parent 375368a commit 754baf4
5 files changed
Lines changed: 199 additions & 161 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
553 | 555 | | |
554 | 556 | | |
555 | 557 | | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
561 | 562 | | |
562 | 563 | | |
563 | 564 | | |
| |||
594 | 595 | | |
595 | 596 | | |
596 | 597 | | |
597 | | - | |
598 | | - | |
| 598 | + | |
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
604 | 604 | | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
605 | 622 | | |
606 | 623 | | |
607 | 624 | | |
| |||
617 | 634 | | |
618 | 635 | | |
619 | 636 | | |
620 | | - | |
| 637 | + | |
| 638 | + | |
621 | 639 | | |
622 | 640 | | |
623 | 641 | | |
| |||
630 | 648 | | |
631 | 649 | | |
632 | 650 | | |
633 | | - | |
| 651 | + | |
634 | 652 | | |
635 | | - | |
| 653 | + | |
| 654 | + | |
636 | 655 | | |
637 | 656 | | |
638 | 657 | | |
| |||
641 | 660 | | |
642 | 661 | | |
643 | 662 | | |
644 | | - | |
| 663 | + | |
| 664 | + | |
645 | 665 | | |
646 | 666 | | |
647 | 667 | | |
648 | 668 | | |
649 | 669 | | |
650 | 670 | | |
651 | | - | |
| 671 | + | |
652 | 672 | | |
653 | 673 | | |
| 674 | + | |
654 | 675 | | |
655 | 676 | | |
656 | 677 | | |
657 | 678 | | |
658 | 679 | | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
| 680 | + | |
| 681 | + | |
663 | 682 | | |
664 | 683 | | |
665 | 684 | | |
666 | 685 | | |
667 | 686 | | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
| 687 | + | |
| 688 | + | |
672 | 689 | | |
673 | 690 | | |
674 | 691 | | |
675 | 692 | | |
676 | 693 | | |
677 | 694 | | |
678 | 695 | | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
| 696 | + | |
| 697 | + | |
683 | 698 | | |
684 | 699 | | |
685 | 700 | | |
686 | 701 | | |
687 | 702 | | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
| 703 | + | |
| 704 | + | |
692 | 705 | | |
693 | 706 | | |
694 | 707 | | |
695 | 708 | | |
696 | 709 | | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
| 710 | + | |
| 711 | + | |
701 | 712 | | |
702 | 713 | | |
703 | 714 | | |
704 | 715 | | |
705 | 716 | | |
706 | | - | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
711 | 720 | | |
712 | 721 | | |
713 | 722 | | |
714 | 723 | | |
715 | 724 | | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
721 | 728 | | |
722 | 729 | | |
723 | 730 | | |
724 | 731 | | |
725 | 732 | | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
731 | 736 | | |
732 | 737 | | |
733 | 738 | | |
734 | 739 | | |
735 | 740 | | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
741 | 744 | | |
742 | 745 | | |
743 | 746 | | |
744 | 747 | | |
745 | 748 | | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | | - | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
751 | 752 | | |
752 | 753 | | |
753 | 754 | | |
754 | 755 | | |
755 | 756 | | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
761 | 760 | | |
762 | 761 | | |
763 | 762 | | |
| |||
796 | 795 | | |
797 | 796 | | |
798 | 797 | | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | 798 | | |
804 | 799 | | |
805 | 800 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
349 | 358 | | |
350 | 359 | | |
351 | 360 | | |
352 | 361 | | |
353 | 362 | | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
359 | 366 | | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
| 367 | + | |
| 368 | + | |
365 | 369 | | |
366 | | - | |
367 | | - | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
368 | 374 | | |
369 | | - | |
370 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
371 | 379 | | |
372 | | - | |
373 | 380 | | |
374 | 381 | | |
375 | 382 | | |
376 | 383 | | |
377 | 384 | | |
378 | 385 | | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
| |||
0 commit comments