~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/perf/pmu-events/README

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/perf/pmu-events/README (Version linux-6.12-rc7) and /tools/perf/pmu-events/README (Version linux-6.5.13)


  1                                                     1 
  2 The contents of this directory allow users to       2 The contents of this directory allow users to specify PMU events in their
  3 CPUs by their symbolic names rather than raw e      3 CPUs by their symbolic names rather than raw event codes (see example below).
  4                                                     4 
  5 The main program in this directory, is the 'je      5 The main program in this directory, is the 'jevents', which is built and
  6 executed _BEFORE_ the perf binary itself is bu      6 executed _BEFORE_ the perf binary itself is built.
  7                                                     7 
  8 The 'jevents' program tries to locate and proc      8 The 'jevents' program tries to locate and process JSON files in the directory
  9 tree tools/perf/pmu-events/arch/foo.                9 tree tools/perf/pmu-events/arch/foo.
 10                                                    10 
 11         - Regular files with '.json' extension     11         - Regular files with '.json' extension in the name are assumed to be
 12           JSON files, each of which describes      12           JSON files, each of which describes a set of PMU events.
 13                                                    13 
 14         - The CSV file that maps a specific CP     14         - The CSV file that maps a specific CPU to its set of PMU events is to
 15           be named 'mapfile.csv' (see below fo     15           be named 'mapfile.csv' (see below for mapfile format).
 16                                                    16 
 17         - Directories are traversed, but all o     17         - Directories are traversed, but all other files are ignored.
 18                                                    18 
 19         - To reduce JSON event duplication per     19         - To reduce JSON event duplication per architecture, platform JSONs may
 20           use "ArchStdEvent" keyword to derefe     20           use "ArchStdEvent" keyword to dereference an "Architecture standard
 21           events", defined in architecture sta     21           events", defined in architecture standard JSONs.
 22           Architecture standard JSONs must be      22           Architecture standard JSONs must be located in the architecture root
 23           folder. Matching is based on the "Ev     23           folder. Matching is based on the "EventName" field.
 24                                                    24 
 25 The PMU events supported by a CPU model are ex     25 The PMU events supported by a CPU model are expected to grouped into topics
 26 such as Pipelining, Cache, Memory, Floating-po     26 such as Pipelining, Cache, Memory, Floating-point etc. All events for a topic
 27 should be placed in a separate JSON file - whe     27 should be placed in a separate JSON file - where the file name identifies
 28 the topic. Eg: "Floating-point.json".              28 the topic. Eg: "Floating-point.json".
 29                                                    29 
 30 All the topic JSON files for a CPU model/famil     30 All the topic JSON files for a CPU model/family should be in a separate
 31 sub directory. Thus for the Silvermont X86 CPU     31 sub directory. Thus for the Silvermont X86 CPU:
 32                                                    32 
 33         $ ls tools/perf/pmu-events/arch/x86/si     33         $ ls tools/perf/pmu-events/arch/x86/silvermont
 34         cache.json     memory.json    virtual-     34         cache.json     memory.json    virtual-memory.json
 35         frontend.json  pipeline.json               35         frontend.json  pipeline.json
 36                                                    36 
 37 The JSONs folder for a CPU model/family may be     37 The JSONs folder for a CPU model/family may be placed in the root arch
 38 folder, or may be placed in a vendor sub-folde     38 folder, or may be placed in a vendor sub-folder under the arch folder
 39 for instances where the arch and vendor are no     39 for instances where the arch and vendor are not the same.
 40                                                    40 
 41 Using the JSON files and the mapfile, 'jevents     41 Using the JSON files and the mapfile, 'jevents' generates the C source file,
 42 'pmu-events.c', which encodes the two sets of      42 'pmu-events.c', which encodes the two sets of tables:
 43                                                    43 
 44         - Set of 'PMU events tables' for all k     44         - Set of 'PMU events tables' for all known CPUs in the architecture,
 45           (one table like the following, per J     45           (one table like the following, per JSON file; table name 'pme_power8'
 46           is derived from JSON file name, 'pow     46           is derived from JSON file name, 'power8.json').
 47                                                    47 
 48                 struct pmu_event pme_power8[]      48                 struct pmu_event pme_power8[] = {
 49                                                    49 
 50                         ...                        50                         ...
 51                                                    51 
 52                         {                          52                         {
 53                                 .name = "pm_1p     53                                 .name = "pm_1plus_ppc_cmpl",
 54                                 .event = "even     54                                 .event = "event=0x100f2",
 55                                 .desc = "1 or      55                                 .desc = "1 or more ppc insts finished,",
 56                         },                         56                         },
 57                                                    57 
 58                         ...                        58                         ...
 59                 }                                  59                 }
 60                                                    60 
 61         - A 'mapping table' that maps each CPU     61         - A 'mapping table' that maps each CPU of the architecture, to its
 62           'PMU events table'                       62           'PMU events table'
 63                                                    63 
 64                 struct pmu_events_map pmu_even     64                 struct pmu_events_map pmu_events_map[] = {
 65                 {                                  65                 {
 66                         .cpuid = "004b0000",       66                         .cpuid = "004b0000",
 67                         .version = "1",            67                         .version = "1",
 68                         .type = "core",            68                         .type = "core",
 69                         .table = pme_power8        69                         .table = pme_power8
 70                 },                                 70                 },
 71                         ...                        71                         ...
 72                                                    72 
 73                 };                                 73                 };
 74                                                    74 
 75 After the 'pmu-events.c' is generated, it is c     75 After the 'pmu-events.c' is generated, it is compiled and the resulting
 76 'pmu-events.o' is added to 'libperf.a' which i     76 'pmu-events.o' is added to 'libperf.a' which is then used to build perf.
 77                                                    77 
 78 NOTES:                                             78 NOTES:
 79         1. Several CPUs can support same set o     79         1. Several CPUs can support same set of events and hence use a common
 80            JSON file. Hence several entries in     80            JSON file. Hence several entries in the pmu_events_map[] could map
 81            to a single 'PMU events table'.         81            to a single 'PMU events table'.
 82                                                    82 
 83         2. The 'pmu-events.h' has an extern de     83         2. The 'pmu-events.h' has an extern declaration for the mapping table
 84            and the generated 'pmu-events.c' de     84            and the generated 'pmu-events.c' defines this table.
 85                                                    85 
 86         3. _All_ known CPU tables for architec     86         3. _All_ known CPU tables for architecture are included in the perf
 87            binary.                                 87            binary.
 88                                                    88 
 89 At run time, perf determines the actual CPU it     89 At run time, perf determines the actual CPU it is running on, finds the
 90 matching events table and builds aliases for t     90 matching events table and builds aliases for those events. This allows
 91 users to specify events by their name:             91 users to specify events by their name:
 92                                                    92 
 93         $ perf stat -e pm_1plus_ppc_cmpl sleep     93         $ perf stat -e pm_1plus_ppc_cmpl sleep 1
 94                                                    94 
 95 where 'pm_1plus_ppc_cmpl' is a Power8 PMU even     95 where 'pm_1plus_ppc_cmpl' is a Power8 PMU event.
 96                                                    96 
 97 However some errors in processing may cause th     97 However some errors in processing may cause the alias build to fail.
 98                                                    98 
 99 Mapfile format                                     99 Mapfile format
100 ===============                                   100 ===============
101                                                   101 
102 The mapfile enables multiple CPU models to sha    102 The mapfile enables multiple CPU models to share a single set of PMU events.
103 It is required even if such mapping is 1:1.       103 It is required even if such mapping is 1:1.
104                                                   104 
105 The mapfile.csv format is expected to be:         105 The mapfile.csv format is expected to be:
106                                                   106 
107         Header line                               107         Header line
108         CPUID,Version,Dir/path/name,Type          108         CPUID,Version,Dir/path/name,Type
109                                                   109 
110 where:                                            110 where:
111                                                   111 
112         Comma:                                    112         Comma:
113                 is the required field delimite    113                 is the required field delimiter (i.e other fields cannot
114                 have commas within them).         114                 have commas within them).
115                                                   115 
116         Comments:                                 116         Comments:
117                 Lines in which the first chara    117                 Lines in which the first character is either '\n' or '#'
118                 are ignored.                      118                 are ignored.
119                                                   119 
120         Header line                               120         Header line
121                 The header line is the first l    121                 The header line is the first line in the file, which is
122                 always _IGNORED_. It can be em    122                 always _IGNORED_. It can be empty.
123                                                   123 
124         CPUID:                                    124         CPUID:
125                 CPUID is an arch-specific char    125                 CPUID is an arch-specific char string, that can be used
126                 to identify CPU (and associate    126                 to identify CPU (and associate it with a set of PMU events
127                 it supports). Multiple CPUIDS     127                 it supports). Multiple CPUIDS can point to the same
128                 File/path/name.json.              128                 File/path/name.json.
129                                                   129 
130                 Example:                          130                 Example:
131                         CPUID == 'GenuineIntel    131                         CPUID == 'GenuineIntel-6-2E' (on x86).
132                         CPUID == '004b0100' (P    132                         CPUID == '004b0100' (PVR value in Powerpc)
133         Version:                                  133         Version:
134                 is the Version of the mapfile.    134                 is the Version of the mapfile.
135                                                   135 
136         Dir/path/name:                            136         Dir/path/name:
137                 is the pathname to the directo    137                 is the pathname to the directory containing the CPU's JSON
138                 files, relative to the directo    138                 files, relative to the directory containing the mapfile.csv
139                                                   139 
140         Type:                                     140         Type:
141                 indicates whether the events a    141                 indicates whether the events are "core" or "uncore" events.
142                                                   142 
143                                                   143 
144         Eg:                                       144         Eg:
145                                                   145 
146         $ grep silvermont tools/perf/pmu-event    146         $ grep silvermont tools/perf/pmu-events/arch/x86/mapfile.csv
147         GenuineIntel-6-37,v13,silvermont,core     147         GenuineIntel-6-37,v13,silvermont,core
148         GenuineIntel-6-4D,v13,silvermont,core     148         GenuineIntel-6-4D,v13,silvermont,core
149         GenuineIntel-6-4C,v13,silvermont,core     149         GenuineIntel-6-4C,v13,silvermont,core
150                                                   150 
151         i.e the three CPU models use the JSON     151         i.e the three CPU models use the JSON files (i.e PMU events) listed
152         in the directory 'tools/perf/pmu-event    152         in the directory 'tools/perf/pmu-events/arch/x86/silvermont'.
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php