162306a36Sopenharmony_ciperf-list(1) 262306a36Sopenharmony_ci============ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ciNAME 562306a36Sopenharmony_ci---- 662306a36Sopenharmony_ciperf-list - List all symbolic event types 762306a36Sopenharmony_ci 862306a36Sopenharmony_ciSYNOPSIS 962306a36Sopenharmony_ci-------- 1062306a36Sopenharmony_ci[verse] 1162306a36Sopenharmony_ci'perf list' [--no-desc] [--long-desc] 1262306a36Sopenharmony_ci [hw|sw|cache|tracepoint|pmu|sdt|metric|metricgroup|event_glob] 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ciDESCRIPTION 1562306a36Sopenharmony_ci----------- 1662306a36Sopenharmony_ciThis command displays the symbolic event types which can be selected in the 1762306a36Sopenharmony_civarious perf commands with the -e option. 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciOPTIONS 2062306a36Sopenharmony_ci------- 2162306a36Sopenharmony_ci-d:: 2262306a36Sopenharmony_ci--desc:: 2362306a36Sopenharmony_ciPrint extra event descriptions. (default) 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci--no-desc:: 2662306a36Sopenharmony_ciDon't print descriptions. 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci-v:: 2962306a36Sopenharmony_ci--long-desc:: 3062306a36Sopenharmony_ciPrint longer event descriptions. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci--debug:: 3362306a36Sopenharmony_ciEnable debugging output. 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci--details:: 3662306a36Sopenharmony_ciPrint how named events are resolved internally into perf events, and also 3762306a36Sopenharmony_ciany extra expressions computed by perf stat. 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci--deprecated:: 4062306a36Sopenharmony_ciPrint deprecated events. By default the deprecated events are hidden. 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci--unit:: 4362306a36Sopenharmony_ciPrint PMU events and metrics limited to the specific PMU name. 4462306a36Sopenharmony_ci(e.g. --unit cpu, --unit msr, --unit cpu_core, --unit cpu_atom) 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci-j:: 4762306a36Sopenharmony_ci--json:: 4862306a36Sopenharmony_ciOutput in JSON format. 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci[[EVENT_MODIFIERS]] 5162306a36Sopenharmony_ciEVENT MODIFIERS 5262306a36Sopenharmony_ci--------------- 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ciEvents can optionally have a modifier by appending a colon and one or 5562306a36Sopenharmony_cimore modifiers. Modifiers allow the user to restrict the events to be 5662306a36Sopenharmony_cicounted. The following modifiers exist: 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci u - user-space counting 5962306a36Sopenharmony_ci k - kernel counting 6062306a36Sopenharmony_ci h - hypervisor counting 6162306a36Sopenharmony_ci I - non idle counting 6262306a36Sopenharmony_ci G - guest counting (in KVM guests) 6362306a36Sopenharmony_ci H - host counting (not in KVM guests) 6462306a36Sopenharmony_ci p - precise level 6562306a36Sopenharmony_ci P - use maximum detected precise level 6662306a36Sopenharmony_ci S - read sample value (PERF_SAMPLE_READ) 6762306a36Sopenharmony_ci D - pin the event to the PMU 6862306a36Sopenharmony_ci W - group is weak and will fallback to non-group if not schedulable, 6962306a36Sopenharmony_ci e - group or event are exclusive and do not share the PMU 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ciThe 'p' modifier can be used for specifying how precise the instruction 7262306a36Sopenharmony_ciaddress should be. The 'p' modifier can be specified multiple times: 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci 0 - SAMPLE_IP can have arbitrary skid 7562306a36Sopenharmony_ci 1 - SAMPLE_IP must have constant skid 7662306a36Sopenharmony_ci 2 - SAMPLE_IP requested to have 0 skid 7762306a36Sopenharmony_ci 3 - SAMPLE_IP must have 0 skid, or uses randomization to avoid 7862306a36Sopenharmony_ci sample shadowing effects. 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ciFor Intel systems precise event sampling is implemented with PEBS 8162306a36Sopenharmony_ciwhich supports up to precise-level 2, and precise level 3 for 8262306a36Sopenharmony_cisome special cases 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ciOn AMD systems it is implemented using IBS (up to precise-level 2). 8562306a36Sopenharmony_ciThe precise modifier works with event types 0x76 (cpu-cycles, CPU 8662306a36Sopenharmony_ciclocks not halted) and 0xC1 (micro-ops retired). Both events map to 8762306a36Sopenharmony_ciIBS execution sampling (IBS op) with the IBS Op Counter Control bit 8862306a36Sopenharmony_ci(IbsOpCntCtl) set respectively (see the 8962306a36Sopenharmony_ciCore Complex (CCX) -> Processor x86 Core -> Instruction Based Sampling (IBS) 9062306a36Sopenharmony_cisection of the [AMD Processor Programming Reference (PPR)] relevant to the 9162306a36Sopenharmony_cifamily, model and stepping of the processor being used). 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ciManual Volume 2: System Programming, 13.3 Instruction-Based 9462306a36Sopenharmony_ciSampling). Examples to use IBS: 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci perf record -a -e cpu-cycles:p ... # use ibs op counting cycles 9762306a36Sopenharmony_ci perf record -a -e r076:p ... # same as -e cpu-cycles:p 9862306a36Sopenharmony_ci perf record -a -e r0C1:p ... # use ibs op counting micro-ops 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ciRAW HARDWARE EVENT DESCRIPTOR 10162306a36Sopenharmony_ci----------------------------- 10262306a36Sopenharmony_ciEven when an event is not available in a symbolic form within perf right now, 10362306a36Sopenharmony_ciit can be encoded in a per processor specific way. 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ciFor instance on x86 CPUs, N is a hexadecimal value that represents the raw register encoding with the 10662306a36Sopenharmony_cilayout of IA32_PERFEVTSELx MSRs (see [Intel® 64 and IA-32 Architectures Software Developer's Manual Volume 3B: System Programming Guide] Figure 30-1 Layout 10762306a36Sopenharmony_ciof IA32_PERFEVTSELx MSRs) or AMD's PERF_CTL MSRs (see the 10862306a36Sopenharmony_ciCore Complex (CCX) -> Processor x86 Core -> MSR Registers section of the 10962306a36Sopenharmony_ci[AMD Processor Programming Reference (PPR)] relevant to the family, model 11062306a36Sopenharmony_ciand stepping of the processor being used). 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ciNote: Only the following bit fields can be set in x86 counter 11362306a36Sopenharmony_ciregisters: event, umask, edge, inv, cmask. Esp. guest/host only and 11462306a36Sopenharmony_ciOS/user mode flags must be setup using <<EVENT_MODIFIERS, EVENT 11562306a36Sopenharmony_ciMODIFIERS>>. 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ciExample: 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ciIf the Intel docs for a QM720 Core i7 describe an event as: 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci Event Umask Event Mask 12262306a36Sopenharmony_ci Num. Value Mnemonic Description Comment 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci A8H 01H LSD.UOPS Counts the number of micro-ops Use cmask=1 and 12562306a36Sopenharmony_ci delivered by loop stream detector invert to count 12662306a36Sopenharmony_ci cycles 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ciraw encoding of 0x1A8 can be used: 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci perf stat -e r1a8 -a sleep 1 13162306a36Sopenharmony_ci perf record -e r1a8 ... 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_ciIt's also possible to use pmu syntax: 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci perf record -e r1a8 -a sleep 1 13662306a36Sopenharmony_ci perf record -e cpu/r1a8/ ... 13762306a36Sopenharmony_ci perf record -e cpu/r0x1a8/ ... 13862306a36Sopenharmony_ci 13962306a36Sopenharmony_ciSome processors, like those from AMD, support event codes and unit masks 14062306a36Sopenharmony_cilarger than a byte. In such cases, the bits corresponding to the event 14162306a36Sopenharmony_ciconfiguration parameters can be seen with: 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci cat /sys/bus/event_source/devices/<pmu>/format/<config> 14462306a36Sopenharmony_ci 14562306a36Sopenharmony_ciExample: 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ciIf the AMD docs for an EPYC 7713 processor describe an event as: 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci Event Umask Event Mask 15062306a36Sopenharmony_ci Num. Value Mnemonic Description 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci 28FH 03H op_cache_hit_miss.op_cache_hit Counts Op Cache micro-tag 15362306a36Sopenharmony_ci hit events. 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ciraw encoding of 0x0328F cannot be used since the upper nibble of the 15662306a36Sopenharmony_ciEventSelect bits have to be specified via bits 32-35 as can be seen with: 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci cat /sys/bus/event_source/devices/cpu/format/event 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ciraw encoding of 0x20000038F should be used instead: 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_ci perf stat -e r20000038f -a sleep 1 16362306a36Sopenharmony_ci perf record -e r20000038f ... 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ciIt's also possible to use pmu syntax: 16662306a36Sopenharmony_ci 16762306a36Sopenharmony_ci perf record -e r20000038f -a sleep 1 16862306a36Sopenharmony_ci perf record -e cpu/r20000038f/ ... 16962306a36Sopenharmony_ci perf record -e cpu/r0x20000038f/ ... 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ciYou should refer to the processor specific documentation for getting these 17262306a36Sopenharmony_cidetails. Some of them are referenced in the SEE ALSO section below. 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ciARBITRARY PMUS 17562306a36Sopenharmony_ci-------------- 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ciperf also supports an extended syntax for specifying raw parameters 17862306a36Sopenharmony_cito PMUs. Using this typically requires looking up the specific event 17962306a36Sopenharmony_ciin the CPU vendor specific documentation. 18062306a36Sopenharmony_ci 18162306a36Sopenharmony_ciThe available PMUs and their raw parameters can be listed with 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_ci ls /sys/devices/*/format 18462306a36Sopenharmony_ci 18562306a36Sopenharmony_ciFor example the raw event "LSD.UOPS" core pmu event above could 18662306a36Sopenharmony_cibe specified as 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci perf stat -e cpu/event=0xa8,umask=0x1,name=LSD.UOPS_CYCLES,cmask=0x1/ ... 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci or using extended name syntax 19162306a36Sopenharmony_ci 19262306a36Sopenharmony_ci perf stat -e cpu/event=0xa8,umask=0x1,cmask=0x1,name=\'LSD.UOPS_CYCLES:cmask=0x1\'/ ... 19362306a36Sopenharmony_ci 19462306a36Sopenharmony_ciPER SOCKET PMUS 19562306a36Sopenharmony_ci--------------- 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_ciSome PMUs are not associated with a core, but with a whole CPU socket. 19862306a36Sopenharmony_ciEvents on these PMUs generally cannot be sampled, but only counted globally 19962306a36Sopenharmony_ciwith perf stat -a. They can be bound to one logical CPU, but will measure 20062306a36Sopenharmony_ciall the CPUs in the same socket. 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ciThis example measures memory bandwidth every second 20362306a36Sopenharmony_cion the first memory controller on socket 0 of a Intel Xeon system 20462306a36Sopenharmony_ci 20562306a36Sopenharmony_ci perf stat -C 0 -a uncore_imc_0/cas_count_read/,uncore_imc_0/cas_count_write/ -I 1000 ... 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ciEach memory controller has its own PMU. Measuring the complete system 20862306a36Sopenharmony_cibandwidth would require specifying all imc PMUs (see perf list output), 20962306a36Sopenharmony_ciand adding the values together. To simplify creation of multiple events, 21062306a36Sopenharmony_ciprefix and glob matching is supported in the PMU name, and the prefix 21162306a36Sopenharmony_ci'uncore_' is also ignored when performing the match. So the command above 21262306a36Sopenharmony_cican be expanded to all memory controllers by using the syntaxes: 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ci perf stat -C 0 -a imc/cas_count_read/,imc/cas_count_write/ -I 1000 ... 21562306a36Sopenharmony_ci perf stat -C 0 -a *imc*/cas_count_read/,*imc*/cas_count_write/ -I 1000 ... 21662306a36Sopenharmony_ci 21762306a36Sopenharmony_ciThis example measures the combined core power every second 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci perf stat -I 1000 -e power/energy-cores/ -a 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_ciACCESS RESTRICTIONS 22262306a36Sopenharmony_ci------------------- 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ciFor non root users generally only context switched PMU events are available. 22562306a36Sopenharmony_ciThis is normally only the events in the cpu PMU, the predefined events 22662306a36Sopenharmony_cilike cycles and instructions and some software events. 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ciOther PMUs and global measurements are normally root only. 22962306a36Sopenharmony_ciSome event qualifiers, such as "any", are also root only. 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ciThis can be overridden by setting the kernel.perf_event_paranoid 23262306a36Sopenharmony_cisysctl to -1, which allows non root to use these events. 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ciFor accessing trace point events perf needs to have read access to 23562306a36Sopenharmony_ci/sys/kernel/tracing, even when perf_event_paranoid is in a relaxed 23662306a36Sopenharmony_cisetting. 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ciTRACING 23962306a36Sopenharmony_ci------- 24062306a36Sopenharmony_ci 24162306a36Sopenharmony_ciSome PMUs control advanced hardware tracing capabilities, such as Intel PT, 24262306a36Sopenharmony_cithat allows low overhead execution tracing. These are described in a separate 24362306a36Sopenharmony_ciintel-pt.txt document. 24462306a36Sopenharmony_ci 24562306a36Sopenharmony_ciPARAMETERIZED EVENTS 24662306a36Sopenharmony_ci-------------------- 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_ciSome pmu events listed by 'perf-list' will be displayed with '?' in them. For 24962306a36Sopenharmony_ciexample: 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_ci hv_gpci/dtbp_ptitc,phys_processor_idx=?/ 25262306a36Sopenharmony_ci 25362306a36Sopenharmony_ciThis means that when provided as an event, a value for '?' must 25462306a36Sopenharmony_cialso be supplied. For example: 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ci perf stat -C 0 -e 'hv_gpci/dtbp_ptitc,phys_processor_idx=0x2/' ... 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_ciEVENT QUALIFIERS: 25962306a36Sopenharmony_ci 26062306a36Sopenharmony_ciIt is also possible to add extra qualifiers to an event: 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_cipercore: 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_ciSums up the event counts for all hardware threads in a core, e.g.: 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_ci 26762306a36Sopenharmony_ci perf stat -e cpu/event=0,umask=0x3,percore=1/ 26862306a36Sopenharmony_ci 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ciEVENT GROUPS 27162306a36Sopenharmony_ci------------ 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_ciPerf supports time based multiplexing of events, when the number of events 27462306a36Sopenharmony_ciactive exceeds the number of hardware performance counters. Multiplexing 27562306a36Sopenharmony_cican cause measurement errors when the workload changes its execution 27662306a36Sopenharmony_ciprofile. 27762306a36Sopenharmony_ci 27862306a36Sopenharmony_ciWhen metrics are computed using formulas from event counts, it is useful to 27962306a36Sopenharmony_ciensure some events are always measured together as a group to minimize multiplexing 28062306a36Sopenharmony_cierrors. Event groups can be specified using { }. 28162306a36Sopenharmony_ci 28262306a36Sopenharmony_ci perf stat -e '{instructions,cycles}' ... 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ciThe number of available performance counters depend on the CPU. A group 28562306a36Sopenharmony_cicannot contain more events than available counters. 28662306a36Sopenharmony_ciFor example Intel Core CPUs typically have four generic performance counters 28762306a36Sopenharmony_cifor the core, plus three fixed counters for instructions, cycles and 28862306a36Sopenharmony_ciref-cycles. Some special events have restrictions on which counter they 28962306a36Sopenharmony_cican schedule, and may not support multiple instances in a single group. 29062306a36Sopenharmony_ciWhen too many events are specified in the group some of them will not 29162306a36Sopenharmony_cibe measured. 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_ciGlobally pinned events can limit the number of counters available for 29462306a36Sopenharmony_ciother groups. On x86 systems, the NMI watchdog pins a counter by default. 29562306a36Sopenharmony_ciThe nmi watchdog can be disabled as root with 29662306a36Sopenharmony_ci 29762306a36Sopenharmony_ci echo 0 > /proc/sys/kernel/nmi_watchdog 29862306a36Sopenharmony_ci 29962306a36Sopenharmony_ciEvents from multiple different PMUs cannot be mixed in a group, with 30062306a36Sopenharmony_cisome exceptions for software events. 30162306a36Sopenharmony_ci 30262306a36Sopenharmony_ciLEADER SAMPLING 30362306a36Sopenharmony_ci--------------- 30462306a36Sopenharmony_ci 30562306a36Sopenharmony_ciperf also supports group leader sampling using the :S specifier. 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_ci perf record -e '{cycles,instructions}:S' ... 30862306a36Sopenharmony_ci perf report --group 30962306a36Sopenharmony_ci 31062306a36Sopenharmony_ciNormally all events in an event group sample, but with :S only 31162306a36Sopenharmony_cithe first event (the leader) samples, and it only reads the values of the 31262306a36Sopenharmony_ciother events in the group. 31362306a36Sopenharmony_ci 31462306a36Sopenharmony_ciHowever, in the case AUX area events (e.g. Intel PT or CoreSight), the AUX 31562306a36Sopenharmony_ciarea event must be the leader, so then the second event samples, not the first. 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_ciOPTIONS 31862306a36Sopenharmony_ci------- 31962306a36Sopenharmony_ci 32062306a36Sopenharmony_ciWithout options all known events will be listed. 32162306a36Sopenharmony_ci 32262306a36Sopenharmony_ciTo limit the list use: 32362306a36Sopenharmony_ci 32462306a36Sopenharmony_ci. 'hw' or 'hardware' to list hardware events such as cache-misses, etc. 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci. 'sw' or 'software' to list software events such as context switches, etc. 32762306a36Sopenharmony_ci 32862306a36Sopenharmony_ci. 'cache' or 'hwcache' to list hardware cache events such as L1-dcache-loads, etc. 32962306a36Sopenharmony_ci 33062306a36Sopenharmony_ci. 'tracepoint' to list all tracepoint events, alternatively use 33162306a36Sopenharmony_ci 'subsys_glob:event_glob' to filter by tracepoint subsystems such as sched, 33262306a36Sopenharmony_ci block, etc. 33362306a36Sopenharmony_ci 33462306a36Sopenharmony_ci. 'pmu' to print the kernel supplied PMU events. 33562306a36Sopenharmony_ci 33662306a36Sopenharmony_ci. 'sdt' to list all Statically Defined Tracepoint events. 33762306a36Sopenharmony_ci 33862306a36Sopenharmony_ci. 'metric' to list metrics 33962306a36Sopenharmony_ci 34062306a36Sopenharmony_ci. 'metricgroup' to list metricgroups with metrics. 34162306a36Sopenharmony_ci 34262306a36Sopenharmony_ci. If none of the above is matched, it will apply the supplied glob to all 34362306a36Sopenharmony_ci events, printing the ones that match. 34462306a36Sopenharmony_ci 34562306a36Sopenharmony_ci. As a last resort, it will do a substring search in all event names. 34662306a36Sopenharmony_ci 34762306a36Sopenharmony_ciOne or more types can be used at the same time, listing the events for the 34862306a36Sopenharmony_citypes specified. 34962306a36Sopenharmony_ci 35062306a36Sopenharmony_ciSupport raw format: 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_ci. '--raw-dump', shows the raw-dump of all the events. 35362306a36Sopenharmony_ci. '--raw-dump [hw|sw|cache|tracepoint|pmu|event_glob]', shows the raw-dump of 35462306a36Sopenharmony_ci a certain kind of events. 35562306a36Sopenharmony_ci 35662306a36Sopenharmony_ciSEE ALSO 35762306a36Sopenharmony_ci-------- 35862306a36Sopenharmony_cilinkperf:perf-stat[1], linkperf:perf-top[1], 35962306a36Sopenharmony_cilinkperf:perf-record[1], 36062306a36Sopenharmony_cihttp://www.intel.com/sdm/[Intel® 64 and IA-32 Architectures Software Developer's Manual Volume 3B: System Programming Guide], 36162306a36Sopenharmony_cihttps://bugzilla.kernel.org/show_bug.cgi?id=206537[AMD Processor Programming Reference (PPR)] 362