xref: /kernel/linux/linux-6.6/tools/perf/tests/attr/README (revision 62306a36)
162306a36Sopenharmony_ciThe struct perf_event_attr test (attr tests) support
262306a36Sopenharmony_ci====================================================
362306a36Sopenharmony_ciThis testing support is embedded into perf directly and is governed
462306a36Sopenharmony_ciby the PERF_TEST_ATTR environment variable and hook inside the
562306a36Sopenharmony_cisys_perf_event_open function.
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciThe general idea is to store 'struct perf_event_attr' details for
862306a36Sopenharmony_cieach event created within single perf command. Each event details
962306a36Sopenharmony_ciare stored into separate text file. Once perf command is finished
1062306a36Sopenharmony_cithese files are checked for values we expect for command.
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciThe attr tests consist of following parts:
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_citests/attr.c
1562306a36Sopenharmony_ci------------
1662306a36Sopenharmony_ciThis is the sys_perf_event_open hook implementation. The hook
1762306a36Sopenharmony_ciis triggered when the PERF_TEST_ATTR environment variable is
1862306a36Sopenharmony_cidefined. It must contain name of existing directory with access
1962306a36Sopenharmony_ciand write permissions.
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ciFor each sys_perf_event_open call event details are stored in
2262306a36Sopenharmony_ciseparate file. Besides 'struct perf_event_attr' values we also
2362306a36Sopenharmony_cistore 'fd' and 'group_fd' values to allow checking for groups.
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_citests/attr.py
2662306a36Sopenharmony_ci-------------
2762306a36Sopenharmony_ciThis is the python script that does all the hard work. It reads
2862306a36Sopenharmony_cithe test definition, executes it and checks results.
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_citests/attr/
3162306a36Sopenharmony_ci-----------
3262306a36Sopenharmony_ciDirectory containing all attr test definitions.
3362306a36Sopenharmony_ciFollowing tests are defined (with perf commands):
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci  perf record kill                              (test-record-basic)
3662306a36Sopenharmony_ci  perf record -b kill                           (test-record-branch-any)
3762306a36Sopenharmony_ci  perf record -j any kill                       (test-record-branch-filter-any)
3862306a36Sopenharmony_ci  perf record -j any_call kill                  (test-record-branch-filter-any_call)
3962306a36Sopenharmony_ci  perf record -j any_ret kill                   (test-record-branch-filter-any_ret)
4062306a36Sopenharmony_ci  perf record -j hv kill                        (test-record-branch-filter-hv)
4162306a36Sopenharmony_ci  perf record -j ind_call kill                  (test-record-branch-filter-ind_call)
4262306a36Sopenharmony_ci  perf record -j k kill                         (test-record-branch-filter-k)
4362306a36Sopenharmony_ci  perf record -j u kill                         (test-record-branch-filter-u)
4462306a36Sopenharmony_ci  perf record -c 123 kill                       (test-record-count)
4562306a36Sopenharmony_ci  perf record -d kill                           (test-record-data)
4662306a36Sopenharmony_ci  perf record -F 100 kill                       (test-record-freq)
4762306a36Sopenharmony_ci  perf record -g kill                           (test-record-graph-default)
4862306a36Sopenharmony_ci  perf record -g kill                           (test-record-graph-default-aarch64)
4962306a36Sopenharmony_ci  perf record --call-graph dwarf kill		(test-record-graph-dwarf)
5062306a36Sopenharmony_ci  perf record --call-graph fp kill              (test-record-graph-fp)
5162306a36Sopenharmony_ci  perf record --call-graph fp kill              (test-record-graph-fp-aarch64)
5262306a36Sopenharmony_ci  perf record -e '{cycles,instructions}' kill   (test-record-group1)
5362306a36Sopenharmony_ci  perf record -e '{cycles/period=1/,instructions/period=2/}:S' kill (test-record-group2)
5462306a36Sopenharmony_ci  perf record -D kill                           (test-record-no-delay)
5562306a36Sopenharmony_ci  perf record -i kill                           (test-record-no-inherit)
5662306a36Sopenharmony_ci  perf record -n kill                           (test-record-no-samples)
5762306a36Sopenharmony_ci  perf record -c 100 -P kill                    (test-record-period)
5862306a36Sopenharmony_ci  perf record -c 1 --pfm-events=cycles:period=2 (test-record-pfm-period)
5962306a36Sopenharmony_ci  perf record -R kill                           (test-record-raw)
6062306a36Sopenharmony_ci  perf record -c 2 -e arm_spe_0// -- kill       (test-record-spe-period)
6162306a36Sopenharmony_ci  perf record -e arm_spe_0/period=3/ -- kill    (test-record-spe-period-term)
6262306a36Sopenharmony_ci  perf record -e arm_spe_0/pa_enable=1/ -- kill (test-record-spe-physical-address)
6362306a36Sopenharmony_ci  perf stat -e cycles kill                      (test-stat-basic)
6462306a36Sopenharmony_ci  perf stat kill                                (test-stat-default)
6562306a36Sopenharmony_ci  perf stat -d kill                             (test-stat-detailed-1)
6662306a36Sopenharmony_ci  perf stat -dd kill                            (test-stat-detailed-2)
6762306a36Sopenharmony_ci  perf stat -ddd kill                           (test-stat-detailed-3)
6862306a36Sopenharmony_ci  perf stat -e '{cycles,instructions}' kill     (test-stat-group1)
6962306a36Sopenharmony_ci  perf stat -i -e cycles kill                   (test-stat-no-inherit)
70