perf/core improvements and fixes
Arnaldo Carvalho de Melo
maintainerHi Ingo,
Please consider pulling,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit 267dd0a07eefbb37264fcfad984fffc8856898ad:
Merge tag 'perf-core-for-mingo-4.12-20170320' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-03-21 07:41:29 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.12-20170324
for you to fetch changes up to bf874fcf9f2fed58510dc83abcee388cee2b427e:
perf list: Move extra details printing to new option (2017-03-23 11:42:31 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
User visible:
- Allow suppressing 'uncore_' when specifying PMU events (Andi Kleen)
- Collapse identically named PMU events in 'perf stat', allow not merging it via --no-merge (Andi Kleen)
Fixes:
- Use more precise 'grep -v' to suppress unwanted 'objdump -dS' disassembly output to not ditch line:number lines needed by 'perf annotate --print-lines' logic (Taeung Song)
Infrastructure:
- SDT (Statically Defined Tracing)/uprobes_events arguments improvements (Alexis Berlemont, Ravi Bangoria)
- Improvements for the handling of JSON described vendor events, including having an expression parser to calculate metrics from multiple vendor events (Andi Kleen)
- Update Intel JSON vendor event files (Andi Kleen)
- Restore error reporting in 'perf probe -d' when none of the events requested to be deleted exist. (Kefeng Wang)
- Bump MAX_CMDLEN in 'perf probe' to match what the kernel accepts (Ravi Bangoria)
----------------------------------------------------------------
Alexis Berlemont (2):
perf sdt: Add scanning of sdt probes arguments
perf probe: Add sdt probes arguments into the uprobe cmd string
Andi Kleen (13):
perf stat: Factor out callback for collecting event values perf stat: Collapse identically named events
perf stat: Handle partially bad results with merging perf tools: Factor out PMU matching in parser
perf pmu: Expand PMU events by prefix match
perf pmu: Special case uncore_ prefix
perf tools: Add a simple expression parser for JSON perf vendor events intel: Update Intel uncore JSON event files perf pmu: Support MetricExpr header in JSON event list perf stat: Output JSON MetricExpr metric
perf list: Support printing MetricExpr with --debug perf pmu: Add support for MetricName JSON attribute perf list: Move extra details printing to new option
Arnaldo Carvalho de Melo (1):
perf annotate: Add comment clarifying how the source code line is parsed
Kefeng Wang (1):
perf probe: Return errno when not hitting any event
Ravi Bangoria (2):
perf probe: Change MAX_CMDLEN
perf sdt x86: Add renaming logic for rNN and other registers
Taeung Song (1):
perf annotate: More exactly grep -v of the objdump command
tools/perf/Documentation/perf-list.txt | 4 + tools/perf/Documentation/perf-stat.txt | 3 + tools/perf/arch/x86/util/perf_regs.c | 103 +++++++++++ tools/perf/builtin-list.c | 14 +- tools/perf/builtin-probe.c | 6 +- tools/perf/builtin-stat.c | 146 ++++++++++++--- .../arch/x86/broadwellde/uncore-cache.json | 28 +-- .../arch/x86/broadwellde/uncore-memory.json | 26 ++- .../arch/x86/broadwellde/uncore-power.json | 26 ++- .../arch/x86/broadwellx/uncore-cache.json | 28 +-- .../arch/x86/broadwellx/uncore-interconnect.json | 6 +- .../arch/x86/broadwellx/uncore-memory.json | 21 ++- .../arch/x86/broadwellx/uncore-power.json | 26 ++- .../pmu-events/arch/x86/haswellx/uncore-cache.json | 28 +-- .../arch/x86/haswellx/uncore-interconnect.json | 6 +- .../arch/x86/haswellx/uncore-memory.json | 21 ++- .../pmu-events/arch/x86/haswellx/uncore-power.json | 26 ++- .../pmu-events/arch/x86/ivytown/uncore-cache.json | 22 +-- .../arch/x86/ivytown/uncore-interconnect.json | 12 +- .../pmu-events/arch/x86/ivytown/uncore-memory.json | 19 +- .../pmu-events/arch/x86/ivytown/uncore-power.json | 53 ++++-- .../pmu-events/arch/x86/jaketown/uncore-cache.json | 13 +- .../arch/x86/jaketown/uncore-interconnect.json | 12 +- .../arch/x86/jaketown/uncore-memory.json | 21 ++- .../pmu-events/arch/x86/jaketown/uncore-power.json | 53 ++++-- tools/perf/pmu-events/jevents.c | 26 ++- tools/perf/pmu-events/jevents.h | 3 +- tools/perf/pmu-events/pmu-events.h | 2 + tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c | 4 + tools/perf/tests/expr.c | 56 ++++++ tools/perf/tests/tests.h | 1 + tools/perf/util/Build | 6 + tools/perf/util/annotate.c | 8 +- tools/perf/util/evsel.c | 4 + tools/perf/util/evsel.h | 5 + tools/perf/util/expr.h | 25 +++ tools/perf/util/expr.y | 173 ++++++++++++++++++ tools/perf/util/parse-events.c | 78 +++++++- tools/perf/util/parse-events.h | 10 +- tools/perf/util/parse-events.y | 73 ++++---- tools/perf/util/perf_regs.c | 6 + tools/perf/util/perf_regs.h | 6 + tools/perf/util/pmu.c | 32 +++- tools/perf/util/pmu.h | 6 +- tools/perf/util/probe-event.c | 1 - tools/perf/util/probe-file.c | 173 +++++++++++++++++- tools/perf/util/stat-shadow.c | 197 +++++++++++++++++++++ tools/perf/util/stat.h | 2 + tools/perf/util/symbol-elf.c | 25 ++- tools/perf/util/symbol.h | 1 + 51 files changed, 1370 insertions(+), 277 deletions(-) create mode 100644 tools/perf/tests/expr.c create mode 100644 tools/perf/util/expr.h create mode 100644 tools/perf/util/expr.y
Test results:
The first ones are container (docker) based builds of tools/perf with and without libelf support, objtool where it is supported and samples/bpf/, ditto. Where clang is available, it is also used to build perf with/without libelf.
Several are cross builds, the ones with -x-ARCH, and the android one, and those may not have all the features built, due to lack of multi-arch devel packages, available and being used so far on just a few, like debian:experimental-x-{arm64,mipsel}.
The 'perf test' one will perform a variety of tests exercising tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands with a variety of command line event specifications to then intercept the sys_perf_event syscall to check that the perf_event_attr fields are set up as expected, among a variety of other unit tests.
Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/ with a variety of feature sets, exercising the build with an incomplete set of features as well as with a complete one. It is planned to have it run on each of the containers mentioned above, using some container orchestration infrastructure. Get in contact if interested in helping having this in place.
# dm 1 alpine:3.4: Ok 2 alpine:3.5: Ok 3 alpine:edge: Ok 4 android-ndk:r12b-arm: Ok 5 archlinux:latest: Ok 6 centos:5: Ok 7 centos:6: Ok 8 centos:7: Ok 9 debian:7: Ok 10 debian:8: Ok 11 debian:experimental: Ok 12 debian:experimental-x-arm64: Ok 13 debian:experimental-x-mips: Ok 14 debian:experimental-x-mips64: Ok 15 debian:experimental-x-mipsel: Ok 16 fedora:20: Ok 17 fedora:21: Ok 18 fedora:22: Ok 19 fedora:23: Ok 20 fedora:24: Ok 21 fedora:24-x-ARC-uClibc: Ok 22 fedora:25: Ok 23 fedora:rawhide: Ok 24 mageia:5: Ok 25 opensuse:13.2: Ok 26 opensuse:42.1: Ok 27 opensuse:tumbleweed: Ok 28 ubuntu:12.04.5: Ok 29 ubuntu:14.04.4: Ok 30 ubuntu:14.04.4-x-linaro-arm64: Ok 31 ubuntu:15.10: Ok 32 ubuntu:16.04: Ok 33 ubuntu:16.04-x-arm: Ok 34 ubuntu:16.04-x-arm64: Ok 35 ubuntu:16.04-x-powerpc: Ok 36 ubuntu:16.04-x-powerpc64: Ok 37 ubuntu:16.04-x-s390: Ok 38 ubuntu:16.10: Ok 39 ubuntu:17.04: Ok #
# uname -a Linux felicio.ghostprotocols.net 4.11.0-rc3+ #1 SMP Thu Mar 23 14:32:00 BRT 2017 x86_64 x86_64 x86_64 GNU/Linux # Has peterz's fix for 'perf test tsc' # perf test 1: vmlinux symtab matches kallsyms : Ok 2: Detect openat syscall event : Ok 3: Detect openat syscall event on all cpus : Ok 4: Read samples using the mmap interface : Ok 5: Parse event definition strings : Ok 6: Simple expression parser : Ok 7: PERF_RECORD_* events & perf_sample fields : Ok 8: Parse perf pmu format : Ok 9: DSO data read : Ok 10: DSO data cache : Ok 11: DSO data reopen : Ok 12: Roundtrip evsel->name : Ok 13: Parse sched tracepoints fields : Ok 14: syscalls:sys_enter_openat event fields : Ok 15: Setup struct perf_event_attr : Ok 16: Match and link multiple hists : Ok 17: 'import perf' in python : Ok 18: Breakpoint overflow signal handler : Ok 19: Breakpoint overflow sampling : Ok 20: Number of exit events of a simple workload : Ok 21: Software clock events period values : Ok 22: Object code reading : Ok 23: Sample parsing : Ok 24: Use a dummy software event to keep tracking: Ok 25: Parse with no sample_id_all bit set : Ok 26: Filter hist entries : Ok 27: Lookup mmap thread : Ok 28: Share thread mg : Ok 29: Sort output of hist entries : Ok 30: Cumulate child hist entries : Ok 31: Track with sched_switch : Ok 32: Filter fds with revents mask in a fdarray : Ok 33: Add fd to a fdarray, making it autogrow : Ok 34: kmod_path__parse : Ok 35: Thread map : Ok 36: LLVM search and compile : 36.1: Basic BPF llvm compile : Ok 36.2: kbuild searching : Ok 36.3: Compile source for BPF prologue generation: Ok 36.4: Compile source for BPF relocation : Ok 37: Session topology : Ok 38: BPF filter : 38.1: Basic BPF filtering : Ok 38.2: BPF pinning : Ok 38.3: BPF prologue generation : Ok 38.4: BPF relocation checker : Ok 39: Synthesize thread map : Ok 40: Remove thread map : Ok 41: Synthesize cpu map : Ok 42: Synthesize stat config : Ok 43: Synthesize stat : Ok 44: Synthesize stat round : Ok 45: Synthesize attr update : Ok 46: Event times : Ok 47: Read backward ring buffer : Ok 48: Print cpu map : Ok 49: Probe SDT events : Ok 50: is_printable_array : Ok 51: Print bitmap : Ok 52: perf hooks : Ok 53: builtin clang support : Skip (not compiled in) 54: unit_number__scnprintf : Ok 55: x86 rdpmc : Ok 56: Convert perf time to TSC : Ok 57: DWARF unwind : Ok 58: x86 instruction decoder - new instructions : Ok 59: Intel cqm nmi context read : Skip #
$ make -C tools/perf build-test
make: Entering directory '/home/acme/git/linux/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make_install_O: make install
make_install_bin_O: make install-bin
make_with_clangllvm_O: make LIBCLANGLLVM=1
make_pure_O: make
make_no_libbionic_O: make NO_LIBBIONIC=1
make_no_backtrace_O: make NO_BACKTRACE=1
make_no_newt_O: make NO_NEWT=1
make_debug_O: make DEBUG=1
make_doc_O: make doc
make_no_slang_O: make NO_SLANG=1
make_static_O: make LDFLAGS=-static
make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
make_no_libbpf_O: make NO_LIBBPF=1
make_util_pmu_bison_o_O: make util/pmu-bison.o
make_perf_o_O: make perf.o
make_no_libnuma_O: make NO_LIBNUMA=1
make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
make_no_demangle_O: make NO_DEMANGLE=1
make_no_auxtrace_O: make NO_AUXTRACE=1
make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
make_help_O: make help
make_util_map_o_O: make util/map.o
make_no_libperl_O: make NO_LIBPERL=1
make_no_gtk2_O: make NO_GTK2=1
make_install_prefix_O: make install prefix=/tmp/krava
make_clean_all_O: make clean all
make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
make_no_libunwind_O: make NO_LIBUNWIND=1
make_no_libpython_O: make NO_LIBPYTHON=1
make_no_libaudit_O: make NO_LIBAUDIT=1
make_tags_O: make tags
make_with_babeltrace_O: make LIBBABELTRACE=1
make_no_libelf_O: make NO_LIBELF=1
make_install_prefix_slash_O: make install prefix=/tmp/krava/
OK
make: Leaving directory '/home/acme/git/linux/tools/perf'
$Arnaldo Carvalho de Melo
maintainerPATCH 1/20 perf probe: Change MAX_CMDLEN
From: Ravi Bangoria <[email protected]>
There are many SDT markers in powerpc whose uprobe definition goes beyond current MAX_CMDLEN, especially when target filename is long and sdt marker has long list of arguments. For example, definition of sdt marker
method__compile__end: 8@17 8@9 8@10 -4@8 8@7 -4@6 8@5 -4@4 1@37(28)
from file
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-2.b14.fc22.ppc64/jre/lib/ppc64/server/libjvm.so
is
p:sdt_hotspot/method__compile__end /usr/lib/jvm/java-1.8.0-openjdk-\
1.8.0.91-2.b14.fc22.ppc64/jre/lib/ppc64/server/libjvm.so:0x4c4e00\
arg1=%gpr17:u64 arg2=%gpr9:u64 arg3=%gpr10:u64 arg4=%gpr8:s32\
arg5=%gpr7:u64 arg6=%gpr6:s32 arg7=%gpr5:u64 arg8=%gpr4:s32\
arg9=+37(%gpr28):u8'perf probe' fails with segfault for such markers. As the uprobe_events file accepts definitions up to 4094 characters(4096 - 2 (\n\0)), increase value of MAX_CMDLEN match that.
--- tools/perf/util/probe-event.c | 1 - tools/perf/util/probe-file.c | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/probe-event.c +0 -1
@@ -47,7 +47,6 @@#include "probe-file.h" #include "session.h" -#define MAX_CMDLEN 256#define PERFPROBE_GROUP "probe"bool probe_event_dry_run;/* Dry run flag */
tools/perf/util/probe-file.c +2 -1
@@ -28,7 +28,8 @@#include "probe-file.h" #include "session.h" -#define MAX_CMDLEN 256 +/* 4096 - 2 ('\n' + '\0') */ +#define MAX_CMDLEN 4094static void print_open_warning (int err,bool uprobe) {
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 2/20 perf probe: Return errno when not hitting any event
In reply to Arnaldo Carvalho de MeloFrom: Kefeng Wang <[email protected]>
On old perf, when using 'perf probe -d' to delete an inexistent event, it returns errno, eg,
-bash-4.3# perf probe -d xxx || echo $?
Info: Event "*:xxx" does not exist.
Error: Failed to delete events.
255
But now perf_del_probe_events() will always set ret = 0, different from previous del_perf_probe_events(). After this, it returns errno again, eg,
-bash-4.3# ./perf probe -d xxx || echo $?
"xxx" does not hit any event.
Error: Failed to delete events.
254
And it is more appropriate to return -ENOENT instead of -EPERM.
--- tools/perf/builtin-probe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/builtin-probe.c +3 -3
@@ -442,9 +442,9 @@ static int perf_del_probe_events(struct strfilter *filter) }if (ret == -ENOENT && ret2 == -ENOENT ) -pr_debug ("\"%s\" does not hit any event.\n" , str); -/* Note that this is silently ignored */ - ret =0 ; +pr_warning ("\"%s\" does not hit any event.\n" , str); +else + ret =0 ; error:if (kfd >=0 )
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 3/20 perf sdt: Add scanning of sdt probes arguments
In reply to Arnaldo Carvalho de MeloFrom: Alexis Berlemont <[email protected]>
During a "perf buildid-cache --add" command, the section ".note.stapsdt" of the "added" binary is scanned in order to list the available SDT markers available in a binary. The parts containing the probes arguments were left unscanned.
The whole section is now parsed; the probe arguments are extracted for later use.
--- tools/perf/util/symbol-elf.c | 25 +++++++++++++++++++++++-- tools/perf/util/symbol.h | 1 + 2 files changed, 24 insertions(+), 2 deletions(-)
tools/perf/util/symbol-elf.c +23 -2
@@ -1828,7 +1828,7 @@ void kcore_extract__delete(struct kcore_extract *kce)static int populate_sdt_note (Elf **elf,const char *data,size_t len,struct list_head *sdt_notes) { -const char *provider, *name; +const char *provider, *name, *args;struct sdt_note *tmp =NULL ;GElf_Ehdr ehdr;GElf_Addr base_off =0 ;
@@ -1887,6 +1887,25 @@ static int populate_sdt_note(Elf **elf, const char *data, size_t len, goto out_free_prov; } + args =memchr (name,'\0' , data + len - name); + +/* +* There is no argument if: +* - We reached the end of the note; +* - There is not enough room to hold a potential string; +* - The argument string is empty or just contains ':'. +*/ +if (args ==NULL || data + len - args <2 || + args[1 ] ==':' || args[1 ] =='\0' ) + tmp->args =NULL ; +else { + tmp->args =strdup (++args); +if (!tmp->args) { + ret = -ENOMEM ; + goto out_free_name; + } + } +if (gelf_getclass (*elf) ==ELFCLASS32 ) {memcpy (&tmp->addr, &buf,3 *sizeof (Elf32_Addr)); tmp->bit32 = true;
@@ -1898,7 +1917,7 @@ static int populate_sdt_note(Elf **elf, const char *data, size_t len,if (!gelf_getehdr (*elf, &ehdr)) {pr_debug ("%s : cannot get elf header.\n" , __func__); ret = -EBADF ; - goto out_free_name; + goto out_free_args; }/* Adjust the prelink effect :
@@ -1923,6 +1942,8 @@ static int populate_sdt_note(Elf **elf, const char *data, size_t len,list_add_tail (&tmp->note_list, sdt_notes);return 0 ; +out_free_args: +free (tmp->args); out_free_name:free (tmp->name); out_free_prov:
tools/perf/util/symbol.h +1 -0
@@ -351,6 +351,7 @@ int arch__choose_best_symbol(struct symbol *syma, struct symbol *symb);struct sdt_note {char *name;/* name of the note*/ char *provider;/* provider name */ +char *args;bool bit32;/* whether the location is 32 bits? */ union {/* location, base and semaphore addrs */ Elf64_Addr a64[3 ];
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 4/20 perf probe: Add sdt probes arguments into the uprobe cmd string
In reply to Arnaldo Carvalho de MeloFrom: Alexis Berlemont <[email protected]>
An sdt probe can be associated with arguments but they were not passed to the user probe tracing interface (uprobe_events); this patch adapts the sdt argument descriptors according to the uprobe input format.
As the uprobe parser does not support scaled address mode, perf will skip arguments which cannot be adapted to the uprobe format.
Here are the results:
$ perf buildid-cache -v --add test_sdt $ perf probe -x test_sdt sdt_libfoo:table_frob $ perf probe -x test_sdt sdt_libfoo:table_diddle $ perf record -e sdt_libfoo:table_frob -e sdt_libfoo:table_diddle test_sdt $ perf script test_sdt ... 666.255678: sdt_libfoo:table_frob: (4004d7) arg0=0 arg1=0 test_sdt ... 666.255683: sdt_libfoo:table_diddle: (40051a) arg0=0 arg1=0 test_sdt ... 666.255686: sdt_libfoo:table_frob: (4004d7) arg0=1 arg1=2 test_sdt ... 666.255689: sdt_libfoo:table_diddle: (40051a) arg0=3 arg1=4 test_sdt ... 666.255692: sdt_libfoo:table_frob: (4004d7) arg0=2 arg1=4 test_sdt ... 666.255694: sdt_libfoo:table_diddle: (40051a) arg0=6 arg1=8
--- tools/perf/arch/x86/util/perf_regs.c | 83 +++++++++++++++++ tools/perf/util/perf_regs.c | 6 ++ tools/perf/util/perf_regs.h | 6 ++ tools/perf/util/probe-file.c | 170 ++++++++++++++++++++++++++++++++++- 4 files changed, 261 insertions(+), 4 deletions(-)
tools/perf/arch/x86/util/perf_regs.c +83 -0
@@ -1,4 +1,7 @@ +#include <string.h> +#include "../../perf.h" +#include "../../util/util.h" #include "../../util/perf_regs.h" const struct sample_reg sample_reg_masks[] = {
@@ -26,3 +29,83 @@ const struct sample_reg sample_reg_masks[] = {#endif SMPL_REG_END }; + +struct sdt_name_reg { +const char *sdt_name; +const char *uprobe_name; +}; +#define SDT_NAME_REG (n, m) {.sdt_name = "%" #n, .uprobe_name = "%" #m} +#define SDT_NAME_REG_END {.sdt_name = NULL, .uprobe_name = NULL} + +static const struct sdt_name_reg sdt_reg_renamings[] = { +SDT_NAME_REG (eax, ax), +SDT_NAME_REG (rax, ax), +SDT_NAME_REG (ebx, bx), +SDT_NAME_REG (rbx, bx), +SDT_NAME_REG (ecx, cx), +SDT_NAME_REG (rcx, cx), +SDT_NAME_REG (edx, dx), +SDT_NAME_REG (rdx, dx), +SDT_NAME_REG (esi, si), +SDT_NAME_REG (rsi, si), +SDT_NAME_REG (edi, di), +SDT_NAME_REG (rdi, di), +SDT_NAME_REG (ebp, bp), +SDT_NAME_REG (rbp, bp), +SDT_NAME_REG_END , +}; + +int sdt_rename_register (char **pdesc,char *old_name) +{ +const struct sdt_name_reg *rnames = sdt_reg_renamings; +char *new_desc, *old_desc = *pdesc; +size_t prefix_len, sdt_len, uprobe_len, old_desc_len, offset; +int ret =-1 ; + +while (ret !=0 && rnames->sdt_name !=NULL ) { + sdt_len =strlen (rnames->sdt_name); + ret =strncmp (old_name, rnames->sdt_name, sdt_len); + rnames += !!ret; + } + +if (rnames->sdt_name ==NULL ) +return 0 ; + + sdt_len =strlen (rnames->sdt_name); + uprobe_len =strlen (rnames->uprobe_name); + old_desc_len =strlen (old_desc) +1 ; + + new_desc =zalloc (old_desc_len + uprobe_len - sdt_len); +if (new_desc ==NULL ) +return -1 ; + +/* Copy the chars before the register name (at least '%') */ + prefix_len = old_name - old_desc; +memcpy (new_desc, old_desc, prefix_len); + +/* Copy the new register name */ +memcpy (new_desc + prefix_len, rnames->uprobe_name, uprobe_len); + +/* Copy the chars after the register name (if need be) */ + offset = prefix_len + sdt_len; +if (offset < old_desc_len) { +/* +* The orginal register name can be suffixed by 'b', +* 'w' or 'd' to indicate its size; so, we need to +* skip this char if we met one. +*/ +char sfx = old_desc[offset]; + +if (sfx =='b' || sfx =='w' || sfx =='d' ) + offset++; + } + +if (offset < old_desc_len) +memcpy (new_desc + prefix_len + uprobe_len, + old_desc + offset, old_desc_len - offset); + +free (old_desc); + *pdesc = new_desc; + +return 0 ; +}
tools/perf/util/perf_regs.c +6 -0
@@ -6,6 +6,12 @@ const struct sample_reg __weak sample_reg_masks[] = {SMPL_REG_END }; +int __weak sdt_rename_register (char **pdesc__maybe_unused , +char *old_name__maybe_unused ) +{ +return 0 ; +} +#ifdef HAVE_PERF_REGS_SUPPORT int perf_reg_value (u64 *valp,struct regs_dump *regs,int id) {
tools/perf/util/perf_regs.h +6 -0
@@ -15,6 +15,12 @@ struct sample_reg {extern const struct sample_reg sample_reg_masks[]; +/* +* The table sdt_reg_renamings is used for adjusting gcc/gas-generated +* registers before filling the uprobe tracer interface. +*/ +int sdt_rename_register (char **pdesc,char *old_name); +#ifdef HAVE_PERF_REGS_SUPPORT #include <perf_regs.h>
tools/perf/util/probe-file.c +166 -4
189 lines not on this page · raw message
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 5/20 perf sdt x86: Add renaming logic for rNN and other registers
In reply to Arnaldo Carvalho de MeloFrom: Ravi Bangoria <[email protected]>
'perf probe' is failing for sdt markers whose arguments has rNN (with postfix b/w/d), %rsp, %esp, %sil etc. registers. Add renaming logic for these registers.
--- tools/perf/arch/x86/util/perf_regs.c | 44 ++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 12 deletions(-)
tools/perf/arch/x86/util/perf_regs.c +32 -12
@@ -48,10 +48,42 @@ static const struct sdt_name_reg sdt_reg_renamings[] = {SDT_NAME_REG (rdx, dx),SDT_NAME_REG (esi, si),SDT_NAME_REG (rsi, si), +SDT_NAME_REG (sil, si),SDT_NAME_REG (edi, di),SDT_NAME_REG (rdi, di), +SDT_NAME_REG (dil, di),SDT_NAME_REG (ebp, bp),SDT_NAME_REG (rbp, bp), +SDT_NAME_REG (bpl, bp), +SDT_NAME_REG (rsp, sp), +SDT_NAME_REG (esp, sp), +SDT_NAME_REG (spl, sp), + +/* rNN registers */ +SDT_NAME_REG (r8b, r8), +SDT_NAME_REG (r8w, r8), +SDT_NAME_REG (r8d, r8), +SDT_NAME_REG (r9b, r9), +SDT_NAME_REG (r9w, r9), +SDT_NAME_REG (r9d, r9), +SDT_NAME_REG (r10b, r10), +SDT_NAME_REG (r10w, r10), +SDT_NAME_REG (r10d, r10), +SDT_NAME_REG (r11b, r11), +SDT_NAME_REG (r11w, r11), +SDT_NAME_REG (r11d, r11), +SDT_NAME_REG (r12b, r12), +SDT_NAME_REG (r12w, r12), +SDT_NAME_REG (r12d, r12), +SDT_NAME_REG (r13b, r13), +SDT_NAME_REG (r13w, r13), +SDT_NAME_REG (r13d, r13), +SDT_NAME_REG (r14b, r14), +SDT_NAME_REG (r14w, r14), +SDT_NAME_REG (r14d, r14), +SDT_NAME_REG (r15b, r15), +SDT_NAME_REG (r15w, r15), +SDT_NAME_REG (r15d, r15), SDT_NAME_REG_END, };
@@ -88,18 +120,6 @@ int sdt_rename_register(char **pdesc, char *old_name)/* Copy the chars after the register name (if need be) */ offset = prefix_len + sdt_len; -if (offset < old_desc_len) { -/* -* The orginal register name can be suffixed by 'b', -* 'w' or 'd' to indicate its size; so, we need to -* skip this char if we met one. -*/ -char sfx = old_desc[offset]; - -if (sfx =='b' || sfx =='w' || sfx =='d' ) - offset++; - } -if (offset < old_desc_len)memcpy (new_desc + prefix_len + uprobe_len, old_desc + offset, old_desc_len - offset);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 6/20 perf annotate: More exactly grep -v of the objdump command
In reply to Arnaldo Carvalho de MeloFrom: Taeung Song <[email protected]>
The 'grep -v "filename"' applied to the objdump command output cause a side effect eliminating filename:linenr of output of 'objdump -l' if the object file name and source file name are the same, fix it.
E.g. the output of the following objdump command in symbol__disassemble():
$ objdump -l -d -S -C /home/taeung/hello --start-address=...
/home/taeung/hello: file format elf64-x86-64
Disassembly of section .text:
0000000000400526 <main>:
main():
/home/taeung/hello.c:4
void main()
{
400526: 55 push %rbp
400527: 48 89 e5 mov %rsp,%rbp
/home/taeung/hello.c:5
...But it uses grep -v "filename" e.g. "/home/taeung/hello" in the objdump command to remove the first line containing file name and file format
("/home/taeung/hello: file format elf64-x86-64"):
Before:
$ objdump -l -d -S -C /home/taeung/hello | grep /home/taeung/hello
But this causes a side effect, removing filename:linenr too, because the object file and source file have the same name e.g. "/home/taueng/hello", "/home/taeung/hello.c"
So more do a better match by using grep -v as below to correctly remove that first line:
"/home/taeung/hello: file format elf64-x86-64"
After:
$ objdump -l -d -S -C /home/taeung/hello | grep /home/taeung/hello:
--- tools/perf/util/annotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -1
@@ -1435,7 +1435,7 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na snprintf(command, sizeof(command), "%s %s%s --start-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64 - " -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand", + " -l -d %s %s -C %s 2>/dev/null|grep -v %s:|expand", objdump_path ? objdump_path : "objdump", disassembler_style ? "-M " : "", disassembler_style ? disassembler_style : "",
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 7/20 perf annotate: Add comment clarifying how the source code line is parsed
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
The source code line number (lineno) needs to be kept in accross calls to symbol__parse_objdump_line() when parsing the output of 'objdump -l -dS', so that it can associate it with the instructions till the next line.
See disasm_line__new() and struct disasm_line::line_nr.
--- tools/perf/util/annotate.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/perf/util/annotate.c +6 -0
@@ -1482,6 +1482,12 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na nline =0 ;while (!feof (file)) { +/* +* The source code line number (lineno) needs to be kept in +* accross calls to symbol__parse_objdump_line(), so that it +* can associate it with the instructions till the next one. +* See disasm_line__new() and struct disasm_line::line_nr. +*/ if (symbol__parse_objdump_line (sym, map, arch, file, privsize, &lineno) <0 )break ;
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 8/20 perf stat: Factor out callback for collecting event values
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
To be used in next patch to support automatic summing of alias events.
v2: Move check for bad results to next patch
v3: Remove trivial addition.
v4: Use perf_evsel__cpus instead of evsel->cpus
--- tools/perf/builtin-stat.c | 103 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 80 insertions(+), 23 deletions(-)
tools/perf/builtin-stat.c +80 -23
@@ -1182,11 +1182,46 @@ static void aggr_update_shadow(void) } } +static void collect_data (struct perf_evsel *counter, +void (*cb)(struct perf_evsel *counter,void *data, +bool first), +void *data) +{ +cb (counter, data, true); +} + +struct aggr_data { +u64 ena, run, val; +int id; +int nr; +int cpu; +}; + +static void aggr_cb (struct perf_evsel *counter,void *data,bool first) +{ +struct aggr_data *ad = data; +int cpu, s2; + +for (cpu =0 ; cpu <perf_evsel__nr_cpus (counter); cpu++) { +struct perf_counts_values *counts; + + s2 =aggr_get_id (perf_evsel__cpus (counter), cpu); +if (s2 != ad->id) +continue ; +if (first) + ad->nr++; + counts =perf_counts (counter->counts, cpu,0 ); + ad->val += counts->val; + ad->ena += counts->ena; + ad->run += counts->run; + } +} +static void print_aggr (char *prefix) {FILE *output = stat_config.output;struct perf_evsel *counter; -int cpu, s, s2, id, nr; +int s, id, nr;double uval;u64 ena, run, val;bool first;
@@ -1201,23 +1236,20 @@ static void print_aggr(char *prefix)* Without each counter has its own line. */ for (s =0 ; s < aggr_map->nr; s++) { +struct aggr_data ad;if (prefix && metric_only)fprintf (output,"%s" , prefix); - id = aggr_map->map[s]; + ad.id = id = aggr_map->map[s]; first = true;evlist__for_each_entry (evsel_list, counter) { - val = ena = run =0 ; - nr =0 ; -for (cpu =0 ; cpu <perf_evsel__nr_cpus (counter); cpu++) { - s2 =aggr_get_id (perf_evsel__cpus (counter), cpu); -if (s2 != id) -continue ; - val +=perf_counts (counter->counts, cpu,0 )->val; - ena +=perf_counts (counter->counts, cpu,0 )->ena; - run +=perf_counts (counter->counts, cpu,0 )->run; - nr++; - } + ad.val = ad.ena = ad.run =0 ; + ad.nr =0 ; +collect_data (counter, aggr_cb, &ad); + nr = ad.nr; + ena = ad.ena; + run = ad.run; + val = ad.val;if (first && metric_only) { first = false;aggr_printout (counter, id, nr);
@@ -1261,6 +1293,21 @@ static void print_aggr_thread(struct perf_evsel *counter, char *prefix) } } +struct caggr_data { +double avg, avg_enabled, avg_running; +}; + +static void counter_aggr_cb (struct perf_evsel *counter,void *data, +bool first__maybe_unused ) +{ +struct caggr_data *cd = data; +struct perf_stat_evsel *ps = counter->priv; + + cd->avg +=avg_stats (&ps->res_stats[0 ]); + cd->avg_enabled +=avg_stats (&ps->res_stats[1 ]); + cd->avg_running +=avg_stats (&ps->res_stats[2 ]); +} +/* * Print out the results of a single counter: * aggregated counts in system-wide mode
@@ -1268,23 +1315,30 @@ static void print_aggr_thread(struct perf_evsel *counter, char *prefix)static void print_counter_aggr (struct perf_evsel *counter,char *prefix) {FILE *output = stat_config.output; -struct perf_stat_evsel *ps = counter->priv; -double avg =avg_stats (&ps->res_stats[0 ]);double uval; -double avg_enabled, avg_running; +struct caggr_data cd = { .avg =0.0 }; - avg_enabled =avg_stats (&ps->res_stats[1 ]); - avg_running =avg_stats (&ps->res_stats[2 ]); +collect_data (counter, counter_aggr_cb, &cd);if (prefix && !metric_only)fprintf (output,"%s" , prefix); - uval = avg * counter->scale; -printout (-1 ,0 , counter, uval, prefix, avg_running, avg_enabled, avg); + uval = cd.avg * counter->scale; +printout (-1 ,0 , counter, uval, prefix, cd.avg_running, cd.avg_enabled, cd.avg);if (!metric_only)fprintf (output,"\n" ); } +static void counter_cb (struct perf_evsel *counter,void *data, +bool first__maybe_unused ) +{ +struct aggr_data *ad = data; + + ad->val +=perf_counts (counter->counts, ad->cpu,0 )->val; + ad->ena +=perf_counts (counter->counts, ad->cpu,0 )->ena; + ad->run +=perf_counts (counter->counts, ad->cpu,0 )->run; +} +/* * Print out the results of a single counter: * does not use aggregated count in system-wide
@@ -1297,9 +1351,12 @@ static void print_counter(struct perf_evsel *counter, char *prefix)int cpu;for (cpu =0 ; cpu <perf_evsel__nr_cpus (counter); cpu++) { - val =perf_counts (counter->counts, cpu,0 )->val; - ena =perf_counts (counter->counts, cpu,0 )->ena; - run =perf_counts (counter->counts, cpu,0 )->run; +struct aggr_data ad = { .cpu = cpu }; + +collect_data (counter, counter_cb, &ad); + val = ad.val; + ena = ad.ena; + run = ad.run;if (prefix)fprintf (output,"%s" , prefix);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 9/20 perf stat: Collapse identically named events
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
The uncore PMU has a lot of duplicated PMUs for different subsystems. When expanding an uncore alias we usually end up with a large number of identically named aliases, which makes perf stat output difficult to read.
Automatically sum them up in perf stat, unless --no-merge is specified.
This can be default because only the uncores generally have duplicated aliases. Other PMUs have unique names.
Before:
% perf stat --no-merge -a -e unc_c_llc_lookup.any sleep 1
Performance counter stats for 'system wide':
694,976 Bytes unc_c_llc_lookup.any
706,304 Bytes unc_c_llc_lookup.any
956,608 Bytes unc_c_llc_lookup.any
782,720 Bytes unc_c_llc_lookup.any
605,696 Bytes unc_c_llc_lookup.any
442,816 Bytes unc_c_llc_lookup.any
659,328 Bytes unc_c_llc_lookup.any
509,312 Bytes unc_c_llc_lookup.any
263,936 Bytes unc_c_llc_lookup.any
592,448 Bytes unc_c_llc_lookup.any
672,448 Bytes unc_c_llc_lookup.any
608,640 Bytes unc_c_llc_lookup.any
641,024 Bytes unc_c_llc_lookup.any
856,896 Bytes unc_c_llc_lookup.any
808,832 Bytes unc_c_llc_lookup.any
684,864 Bytes unc_c_llc_lookup.any
710,464 Bytes unc_c_llc_lookup.any
538,304 Bytes unc_c_llc_lookup.any
1.002577660 seconds time elapsedAfter:
% perf stat -a -e unc_c_llc_lookup.any sleep 1
Performance counter stats for 'system wide':
2,685,120 Bytes unc_c_llc_lookup.any
1.002648032 seconds time elapsedv2: Split collect_aliases. Rename alias flag.
v3: Make sure unsupported/not counted is always printed.
v4: Factor out callback change into separate patch.
v5: Move check for bad results here
Move merged check into collect_data
--- tools/perf/Documentation/perf-stat.txt | 3 +++ tools/perf/builtin-stat.c | 38 ++++++++++++++++++++++++++++++---- tools/perf/util/evsel.h | 1 + 3 files changed, 38 insertions(+), 4 deletions(-)
tools/perf/Documentation/perf-stat.txt +3 -0
@@ -236,6 +236,9 @@ To interpret the results it is usually needed to know on which CPUs the workload runs on. If needed the CPUs can be forced using taskset. +--no-merge:: +Do not merge results from same PMUs. + EXAMPLES --------
tools/perf/builtin-stat.c +34 -4
@@ -140,6 +140,7 @@ static unsigned int unit_width = 4; /* strlen("unit") */static bool forever = false;static bool metric_only = false;static bool force_metric_only = false; +static bool no_merge = false;static struct timespec ref_time;static struct cpu_map *aggr_map;static aggr_get_id_t aggr_get_id;
@@ -1182,12 +1183,37 @@ static void aggr_update_shadow(void) } } -static void collect_data (struct perf_evsel *counter, +static void collect_all_aliases (struct perf_evsel *counter,void (*cb)(struct perf_evsel *counter,void *data,bool first),void *data) { +struct perf_evsel *alias; + + alias =list_prepare_entry (counter, &(evsel_list->entries), node); + list_for_each_entry_continue (alias, &evsel_list->entries, node) { +if (strcmp (perf_evsel__name (alias),perf_evsel__name (counter)) || + alias->scale != counter->scale || + alias->cgrp != counter->cgrp || +strcmp (alias->unit, counter->unit) || +nsec_counter (alias) !=nsec_counter (counter)) +break ; + alias->merged_stat = true; +cb (alias, data, false); + } +} + +static bool collect_data (struct perf_evsel *counter, +void (*cb)(struct perf_evsel *counter,void *data, +bool first), +void *data) +{ +if (counter->merged_stat) +return false;cb (counter, data, true); +if (!no_merge) +collect_all_aliases (counter, cb, data); +return true; }struct aggr_data {
@@ -1245,7 +1271,8 @@ static void print_aggr(char *prefix)evlist__for_each_entry (evsel_list, counter) { ad.val = ad.ena = ad.run =0 ; ad.nr =0 ; -collect_data (counter, aggr_cb, &ad); +if (!collect_data (counter, aggr_cb, &ad)) +continue ; nr = ad.nr; ena = ad.ena; run = ad.run;
@@ -1318,7 +1345,8 @@ static void print_counter_aggr(struct perf_evsel *counter, char *prefix)double uval;struct caggr_data cd = { .avg =0.0 }; -collect_data (counter, counter_aggr_cb, &cd); +if (!collect_data (counter, counter_aggr_cb, &cd)) +return ;if (prefix && !metric_only)fprintf (output,"%s" , prefix);
@@ -1353,7 +1381,8 @@ static void print_counter(struct perf_evsel *counter, char *prefix)for (cpu =0 ; cpu <perf_evsel__nr_cpus (counter); cpu++) {struct aggr_data ad = { .cpu = cpu }; -collect_data (counter, counter_cb, &ad); +if (!collect_data (counter, counter_cb, &ad)) +return ; val = ad.val; ena = ad.ena; run = ad.run;
@@ -1701,6 +1730,7 @@ static const struct option stat_options[] = { "list of cpus to monitor in system-wide"),OPT_SET_UINT ('A' ,"no-aggr" , &stat_config.aggr_mode,"disable CPU count aggregation" ,AGGR_NONE ), +OPT_BOOLEAN (0 ,"no-merge" , &no_merge,"Do not merge identical named events" ),OPT_STRING ('x' ,"field-separator" , &csv_sep,"separator" ,"print counts with custom separator" ), OPT_CALLBACK('G', "cgroup", &evsel_list, "name",
tools/perf/util/evsel.h +1 -0
@@ -131,6 +131,7 @@ struct perf_evsel {bool cmdline_group_boundary;struct list_head config_terms;int bpf_fd; +bool merged_stat; };union u64_swap {
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 10/20 perf stat: Handle partially bad results with merging
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
When any result that is being merged is bad, mark them all bad to give consistent output in interval mode.
No before/after, because the issue was only found in theoretical review and it is hard to reproduce
--- tools/perf/builtin-stat.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
tools/perf/builtin-stat.c +10 -0
@@ -1237,6 +1237,16 @@ static void aggr_cb(struct perf_evsel *counter, void *data, bool first)if (first) ad->nr++; counts =perf_counts (counter->counts, cpu,0 ); +/* +* When any result is bad, make them all to give +* consistent output in interval mode. +*/ +if (counts->ena ==0 || counts->run ==0 || + counter->counts->scaled ==-1 ) { + ad->ena =0 ; + ad->run =0 ; +break ; + } ad->val += counts->val; ad->ena += counts->ena; ad->run += counts->run;
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 11/20 perf tools: Factor out PMU matching in parser
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Factor out the PMU name matching in the event parser into a separate function, to use the same code for other grammar rules later.
--- tools/perf/util/parse-events.c | 46 ++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/parse-events.h | 5 +++++ tools/perf/util/parse-events.y | 30 +-------------------------- 3 files changed, 52 insertions(+), 29 deletions(-)
tools/perf/util/parse-events.c +46 -0
@@ -1260,6 +1260,52 @@ int parse_events_add_pmu(struct parse_events_evlist *data,return evsel ?0 : -ENOMEM ; } +int parse_events_multi_pmu_add (struct parse_events_evlist *data, +char *str,struct list_head **listp) +{ +struct list_head *head; +struct parse_events_term *term; +struct list_head *list; +struct perf_pmu *pmu =NULL ; +int ok =0 ; + + *listp =NULL ; +/* Add it for all PMUs that support the alias */ + list =malloc (sizeof (struct list_head )); +if (!list) +return -1 ; +INIT_LIST_HEAD (list); +while ((pmu =perf_pmu__scan (pmu)) !=NULL ) { +struct perf_pmu_alias *alias; + +list_for_each_entry (alias, &pmu->aliases, list) { +if (!strcasecmp (alias->name, str)) { + head =malloc (sizeof (struct list_head )); +if (!head) +return -1 ; +INIT_LIST_HEAD (head); +if (parse_events_term__num (&term,PARSE_EVENTS__TERM_TYPE_USER , + str,1 , false, &str,NULL ) <0 ) +return -1 ; +list_add_tail (&term->list, head); + +if (!parse_events_add_pmu (data, list, + pmu->name, head)) { +pr_debug ("%s -> %s/%s/\n" , str, + pmu->name, alias->str); + ok++; + } + +parse_events_terms__delete (head); + } + } + } +if (!ok) +return -1 ; + *listp = list; +return 0 ; +} +int parse_events__modifier_group (struct list_head *list,char *event_mod) {
tools/perf/util/parse-events.h +5 -0
@@ -167,6 +167,11 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx,int parse_events_add_pmu (struct parse_events_evlist *data,struct list_head *list,char *name,struct list_head *head_config); + +int parse_events_multi_pmu_add (struct parse_events_evlist *data, +char *str, +struct list_head **listp); +enum perf_pmu_event_symbol_type perf_pmu__parse_check (const char *name);void parse_events__set_leader (char *name,struct list_head *list);
tools/perf/util/parse-events.y +1 -29
@@ -236,37 +236,9 @@ PE_NAME opt_event_config | PE_KERNEL_PMU_EVENT sep_dc { - struct parse_events_evlist *data = _data; - struct list_head *head; - struct parse_events_term *term; struct list_head *list; - struct perf_pmu *pmu = NULL; - int ok = 0; - /* Add it for all PMUs that support the alias */ - ALLOC_LIST(list); - while ((pmu = perf_pmu__scan(pmu)) != NULL) { - struct perf_pmu_alias *alias; - - list_for_each_entry(alias, &pmu->aliases, list) { - if (!strcasecmp(alias->name, $1)) { - ALLOC_LIST(head); - ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, - $1, 1, false, &@1, NULL)); - list_add_tail(&term->list, head); - - if (!parse_events_add_pmu(data, list, - pmu->name, head)) { - pr_debug("%s -> %s/%s/\n", $1, - pmu->name, alias->str); - ok++; - } - - parse_events_terms__delete(head); - } - } - } - if (!ok) + if (parse_events_multi_pmu_add(_data, $1, &list) < 0) YYABORT; $$ = list; }
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 12/20 perf pmu: Expand PMU events by prefix match
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
When the user specifies a pmu directly, expand it automatically with a prefix match for all available PMUs, similar as we do for the normal aliases now.
This allows to specify attributes for duplicated boxes quickly. For example uncore_cbox_{0,6}/.../ can be now specified as uncore_cbox/.../ and it gets automatically expanded for all boxes.
This generally makes it more concise to write uncore specifications, and also avoids the need to know the exact topology of the system.
Before:
% perf stat -a -e uncore_cbox_0/event=0x35,umask=0x1,filter_opc=0x19C/,\ uncore_cbox_1/event=0x35,umask=0x1,filter_opc=0x19C/,\ uncore_cbox_2/event=0x35,umask=0x1,filter_opc=0x19C/,\ uncore_cbox_3/event=0x35,umask=0x1,filter_opc=0x19C/,\ uncore_cbox_4/event=0x35,umask=0x1,filter_opc=0x19C/,\ uncore_cbox_5/event=0x35,umask=0x1,filter_opc=0x19C/ sleep 1
After:
% perf stat -a -e uncore_cbox/event=0x35,umask=0x1,filter_opc=0x19C/ sleep 1
v2: Handle all bison rules. Move multi add code to separate function.
Handle uncore_ prefix correctly.
v3: Move parse_events_multi_pmu_add to separate patch. Move uncore
prefix check to separate patch.
--- tools/perf/util/parse-events.c | 25 +++++++++++++++++++++++++ tools/perf/util/parse-events.h | 3 +++ tools/perf/util/parse-events.y | 40 ++++++++++++++++++++++++++-------------- 3 files changed, 54 insertions(+), 14 deletions(-)
tools/perf/util/parse-events.c +25 -0
@@ -2462,6 +2462,31 @@ int parse_events_term__clone(struct parse_events_term **new,return new_term (new, &temp, term->val.str, term->val.num); } +int parse_events_copy_term_list (struct list_head *old, +struct list_head **new) +{ +struct parse_events_term *term, *n; +int ret; + +if (!old) { + *new =NULL ; +return 0 ; + } + + *new =malloc (sizeof (struct list_head )); +if (!*new) +return -ENOMEM ; +INIT_LIST_HEAD (*new); + + list_for_each_entry (term, old, list) { + ret =parse_events_term__clone (&n, term); +if (ret) +return ret; +list_add_tail (&n->list, *new); + } +return 0 ; +} +void parse_events_terms__purge (struct list_head *terms) {struct parse_events_term *term, *h;
tools/perf/util/parse-events.h +3 -0
@@ -172,6 +172,9 @@ int parse_events_multi_pmu_add(struct parse_events_evlist *data,char *str, struct list_head **listp); +int parse_events_copy_term_list (struct list_head *old, +struct list_head **new); +enum perf_pmu_event_symbol_type perf_pmu__parse_check (const char *name);void parse_events__set_leader (char *name,struct list_head *list);
tools/perf/util/parse-events.y +26 -14
@@ -226,11 +226,32 @@ event_pmu: PE_NAME opt_event_config { struct parse_events_evlist *data = _data; - struct list_head *list; + struct list_head *list, *orig_terms, *terms; + + if (parse_events_copy_term_list($2, &orig_terms)) + YYABORT; ALLOC_LIST(list); - ABORT_ON(parse_events_add_pmu(data, list, $1, $2)); + if (parse_events_add_pmu(data, list, $1, $2)) { + struct perf_pmu *pmu = NULL; + int ok = 0; + + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + char *name = pmu->name; + + if (!strncmp($1, name, strlen($1))) { + if (parse_events_copy_term_list(orig_terms, &terms)) + YYABORT; + if (!parse_events_add_pmu(data, list, pmu->name, terms)) + ok++; + parse_events_terms__delete(terms); + } + } + if (!ok) + YYABORT; + } parse_events_terms__delete($2); + parse_events_terms__delete(orig_terms); $$ = list; } |
@@ -245,21 +266,12 @@ PE_KERNEL_PMU_EVENT sep_dc | PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc { - struct parse_events_evlist *data = _data; - struct list_head *head; - struct parse_events_term *term; struct list_head *list; char pmu_name[128]; - snprintf(&pmu_name, 128, "%s-%s", $1, $3); - ALLOC_LIST(head); - ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, - &pmu_name, 1, false, &@1, NULL)); - list_add_tail(&term->list, head); - - ALLOC_LIST(list); - ABORT_ON(parse_events_add_pmu(data, list, "cpu", head)); - parse_events_terms__delete(head); + snprintf(&pmu_name, 128, "%s-%s", $1, $3); + if (parse_events_multi_pmu_add(_data, pmu_name, &list) < 0) + YYABORT; $$ = list; }
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 13/20 perf pmu: Special case uncore_ prefix
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Special case uncore_ prefix in PMU match, to allow for shorter event uncore specifications.
Before:
perf stat -a -e uncore_cbox/event=0x35,umask=0x1,filter_opc=0x19C/ sleep 1
After
perf stat -a -e cbox/event=0x35,umask=0x1,filter_opc=0x19C/ sleep 1
Committer tests:
# perf list uncore
List of pre-defined events (to be used in -e):
uncore_cbox_0/clockticks/ [Kernel PMU event]
uncore_cbox_1/clockticks/ [Kernel PMU event]
uncore_imc/data_reads/ [Kernel PMU event]
uncore_imc/data_writes/ [Kernel PMU event]# perf stat -a -e cbox_0/clockticks/ sleep 1
Performance counter stats for 'system wide':
281,474,976,653,084 cbox_0/clockticks/
1.000870129 seconds time elapsed
#
--- tools/perf/util/parse-events.y | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/parse-events.y +3 -0
@@ -239,6 +239,9 @@ PE_NAME opt_event_config while ((pmu = perf_pmu__scan(pmu)) != NULL) { char *name = pmu->name; + if (!strncmp(name, "uncore_", 7) && + strncmp($1, "uncore_", 7)) + name += 7; if (!strncmp($1, name, strlen($1))) { if (parse_events_copy_term_list(orig_terms, &terms)) YYABORT;
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 14/20 perf tools: Add a simple expression parser for JSON
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Add a simple expression parser good enough to parse JSON relation expressions. The parser is implemented using bison.
This is just intended as an simple parser for internal usage in the event lists, not the beginning of a "perf scripting language"
v2: Use expr__ prefix instead of expr_
Support multiple free variables for parser
Committer note:
The v2 patch had:
%define api.pure full
In expr.y, that is a feature introduced in bison 2.7, to have reentrant parsers, not using global variables, which would make tools/perf stop building with the bison version shipped in older distros, so Andi realised that the other parsers (e.g. parse-events.y) were using:
%pure-parser
Which is present in older versions of bison and fits the bill.
I added:
CFLAGS_expr-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
To finally make it build, copying what was there for pmu-bison.o, another parser.
--- tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c | 4 + tools/perf/tests/expr.c | 56 +++++++++++++ tools/perf/tests/tests.h | 1 + tools/perf/util/Build | 6 ++ tools/perf/util/expr.h | 25 ++++++ tools/perf/util/expr.y | 173 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 266 insertions(+) create mode 100644 tools/perf/tests/expr.c create mode 100644 tools/perf/util/expr.h create mode 100644 tools/perf/util/expr.y
tools/perf/tests/Build +1 -0
@@ -38,6 +38,7 @@ perf-y += cpumap.o perf-y += stat.o perf-y += event_update.o perf-y += event-times.o +perf-y += expr.o perf-y += backward-ring-buffer.o perf-y += sdt.o perf-y += is_printable_array.o
tools/perf/tests/builtin-test.c +4 -0
@@ -44,6 +44,10 @@ static struct test generic_tests[] = { .func = test__parse_events, }, { + .desc = "Simple expression parser", + .func = test__expr, + }, + { .desc = "PERF_RECORD_* events & perf_sample fields", .func = test__PERF_RECORD, },
tools/perf/tests/expr.c new file +56 -0
56 lines not on this page · raw message
tools/perf/tests/tests.h +1 -0
@@ -62,6 +62,7 @@ int test__sample_parsing(int subtest);int test__keep_tracking (int subtest);int test__parse_no_sample_id_all (int subtest);int test__dwarf_unwind (int subtest); +int test__expr (int subtest);int test__hists_filter (int subtest);int test__mmap_thread_lookup (int subtest);int test__thread_mg_share (int subtest);
tools/perf/util/Build +6 -0
@@ -90,6 +90,7 @@ libperf-y += mem-events.o libperf-y += vsprintf.o libperf-y += drv_configs.o libperf-y += time-utils.o +libperf-y += expr-bison.o libperf-$(CONFIG_LIBBPF) += bpf-loader.o libperf-$(CONFIG_BPF_PROLOGUE) += bpf-prologue.o
@@ -142,6 +143,10 @@ $(OUTPUT)util/parse-events-bison.c: util/parse-events.y $(call rule_mkdir) $(Q)$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_ +$(OUTPUT)util/expr-bison.c: util/expr.y + $(call rule_mkdir) + $(Q)$(call echo-cmd,bison)$(BISON) -v util/expr.y -d $(PARSER_DEBUG_BISON) -o $@ -p expr__ + $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c $(call rule_mkdir) $(Q)$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
@@ -154,6 +159,7 @@ CFLAGS_parse-events-flex.o += -w CFLAGS_pmu-flex.o += -w CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 -w CFLAGS_pmu-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w +CFLAGS_expr-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
tools/perf/util/expr.h new file +25 -0
@@ -0,0 +1,25 @@ +#ifndef PARSE_CTX_H +#define PARSE_CTX_H 1 + +#define EXPR_MAX_OTHER 8 +#define MAX_PARSE_ID EXPR_MAX_OTHER + +struct parse_id { +const char *name; +double val; +}; + +struct parse_ctx { +int num_ids; +struct parse_id ids[MAX_PARSE_ID ]; +}; + +void expr__ctx_init (struct parse_ctx *ctx); +void expr__add_id (struct parse_ctx *ctx,const char *id,double val); +#ifndef IN_EXPR_Y +int expr__parse (double *final_val,struct parse_ctx *ctx,const char **pp); +#endif +int expr__find_other (const char *p,const char *one,const char ***other, +int *num_other); + +#endif
tools/perf/util/expr.y new file +173 -0
173 lines not on this page · raw message
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 15/20 perf vendor events intel: Update Intel uncore JSON event files
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
- Add MetricName to describe Metric
- Remove redundant "derived from" in descriptions
- Rename UNC_M_CAS_COUNT to LLC_MISSES.READ
--- .../arch/x86/broadwellde/uncore-cache.json | 28 ++++++------ .../arch/x86/broadwellde/uncore-memory.json | 26 +++++------ .../arch/x86/broadwellde/uncore-power.json | 26 +++++++---- .../arch/x86/broadwellx/uncore-cache.json | 28 ++++++------ .../arch/x86/broadwellx/uncore-interconnect.json | 6 +-- .../arch/x86/broadwellx/uncore-memory.json | 21 +++++---- .../arch/x86/broadwellx/uncore-power.json | 26 +++++++---- .../pmu-events/arch/x86/haswellx/uncore-cache.json | 28 ++++++------ .../arch/x86/haswellx/uncore-interconnect.json | 6 +-- .../arch/x86/haswellx/uncore-memory.json | 21 +++++---- .../pmu-events/arch/x86/haswellx/uncore-power.json | 26 +++++++---- .../pmu-events/arch/x86/ivytown/uncore-cache.json | 22 ++++----- .../arch/x86/ivytown/uncore-interconnect.json | 12 +++-- .../pmu-events/arch/x86/ivytown/uncore-memory.json | 19 ++++---- .../pmu-events/arch/x86/ivytown/uncore-power.json | 53 ++++++++++++++++------ .../pmu-events/arch/x86/jaketown/uncore-cache.json | 13 +++--- .../arch/x86/jaketown/uncore-interconnect.json | 12 +++-- .../arch/x86/jaketown/uncore-memory.json | 21 +++++---- .../pmu-events/arch/x86/jaketown/uncore-power.json | 53 ++++++++++++++++------ 19 files changed, 267 insertions(+), 180 deletions(-)
tools/perf/pmu-events/arch/x86/broadwellde/uncore-cache.json +14 -14
@@ -1,13 +1,13 @@ [ { - "BriefDescription": "Uncore cache clock ticks. Derived from unc_c_clockticks", + "BriefDescription": "Uncore cache clock ticks", "Counter": "0,1,2,3", "EventName": "UNC_C_CLOCKTICKS", "PerPkg": "1", "Unit": "CBO" }, { - "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch). Derived from unc_c_llc_lookup.any", + "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch)", "Counter": "0,1,2,3", "EventCode": "0x34", "EventName": "UNC_C_LLC_LOOKUP.ANY",
@@ -18,7 +18,7 @@ "Unit": "CBO" }, { - "BriefDescription": "M line evictions from LLC (writebacks to memory). Derived from unc_c_llc_victims.m_state", + "BriefDescription": "M line evictions from LLC (writebacks to memory)", "Counter": "0,1,2,3", "EventCode": "0x37", "EventName": "UNC_C_LLC_VICTIMS.M_STATE",
@@ -212,7 +212,7 @@ "Unit": "CBO" }, { - "BriefDescription": "read requests to home agent. Derived from unc_h_requests.reads", + "BriefDescription": "read requests to home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.READS",
@@ -221,7 +221,7 @@ "Unit": "HA" }, { - "BriefDescription": "read requests to local home agent. Derived from unc_h_requests.reads_local", + "BriefDescription": "read requests to local home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.READS_LOCAL",
@@ -230,7 +230,7 @@ "Unit": "HA" }, { - "BriefDescription": "read requests to remote home agent. Derived from unc_h_requests.reads_remote", + "BriefDescription": "read requests to remote home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.READS_REMOTE",
@@ -239,7 +239,7 @@ "Unit": "HA" }, { - "BriefDescription": "write requests to home agent. Derived from unc_h_requests.writes", + "BriefDescription": "write requests to home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.WRITES",
@@ -248,7 +248,7 @@ "Unit": "HA" }, { - "BriefDescription": "write requests to local home agent. Derived from unc_h_requests.writes_local", + "BriefDescription": "write requests to local home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.WRITES_LOCAL",
@@ -257,7 +257,7 @@ "Unit": "HA" }, { - "BriefDescription": "write requests to remote home agent. Derived from unc_h_requests.writes_remote", + "BriefDescription": "write requests to remote home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.WRITES_REMOTE",
@@ -266,7 +266,7 @@ "Unit": "HA" }, { - "BriefDescription": "Conflict requests (requests for same address from multiple agents simultaneously). Derived from unc_h_snoop_resp.rspcnflct", + "BriefDescription": "Conflict requests (requests for same address from multiple agents simultaneously)", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPCNFLCT",
@@ -275,7 +275,7 @@ "Unit": "HA" }, { - "BriefDescription": "M line forwarded from remote cache along with writeback to memory. Derived from unc_h_snoop_resp.rsp_fwd_wb", + "BriefDescription": "M line forwarded from remote cache along with writeback to memory", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSP_FWD_WB",
@@ -285,7 +285,7 @@ "Unit": "HA" }, { - "BriefDescription": "M line forwarded from remote cache with no writeback to memory. Derived from unc_h_snoop_resp.rspifwd", + "BriefDescription": "M line forwarded from remote cache with no writeback to memory", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPIFWD",
@@ -295,7 +295,7 @@ "Unit": "HA" }, { - "BriefDescription": "Shared line response from remote cache. Derived from unc_h_snoop_resp.rsps", + "BriefDescription": "Shared line response from remote cache", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPS",
@@ -305,7 +305,7 @@ "Unit": "HA" }, { - "BriefDescription": "Shared line forwarded from remote cache. Derived from unc_h_snoop_resp.rspsfwd", + "BriefDescription": "Shared line forwarded from remote cache", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPSFWD",
tools/perf/pmu-events/arch/x86/broadwellde/uncore-memory.json +11 -15
@@ -3,7 +3,7 @@ "BriefDescription": "read requests to memory controller. Derived from unc_m_cas_count.rd", "Counter": "0,1,2,3", "EventCode": "0x4", - "EventName": "UNC_M_CAS_COUNT.RD", + "EventName": "LLC_MISSES.MEM_READ", "PerPkg": "1", "ScaleUnit": "64Bytes", "UMask": "0x3",
@@ -13,48 +13,44 @@ "BriefDescription": "write requests to memory controller. Derived from unc_m_cas_count.wr", "Counter": "0,1,2,3", "EventCode": "0x4", - "EventName": "UNC_M_CAS_COUNT.WR", + "EventName": "LLC_MISSES.MEM_WRITE", "PerPkg": "1", "ScaleUnit": "64Bytes", "UMask": "0xC", "Unit": "iMC" }, { - "BriefDescription": "Memory controller clock ticks. Derived from unc_m_clockticks", - "Counter": "0,1,2,3", - "EventName": "UNC_M_CLOCKTICKS", - "PerPkg": "1", - "Unit": "iMC" - }, - { - "BriefDescription": "Cycles where DRAM ranks are in power down (CKE) mode. Derived from unc_m_power_channel_ppd", + "BriefDescription": "Cycles where DRAM ranks are in power down (CKE) mode", "Counter": "0,1,2,3", "EventCode": "0x85", "EventName": "UNC_M_POWER_CHANNEL_PPD", "MetricExpr": "(UNC_M_POWER_CHANNEL_PPD / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_channel_ppd %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles all ranks are in critical thermal throttle. Derived from unc_m_power_critical_throttle_cycles", + "BriefDescription": "Cycles all ranks are in critical thermal throttle", "Counter": "0,1,2,3", "EventCode": "0x86", "EventName": "UNC_M_POWER_CRITICAL_THROTTLE_CYCLES", "MetricExpr": "(UNC_M_POWER_CRITICAL_THROTTLE_CYCLES / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_critical_throttle_cycles %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles Memory is in self refresh power mode. Derived from unc_m_power_self_refresh", + "BriefDescription": "Cycles Memory is in self refresh power mode", "Counter": "0,1,2,3", "EventCode": "0x43", "EventName": "UNC_M_POWER_SELF_REFRESH", "MetricExpr": "(UNC_M_POWER_SELF_REFRESH / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_self_refresh %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Pre-charges due to page misses. Derived from unc_m_pre_count.page_miss", + "BriefDescription": "Pre-charges due to page misses", "Counter": "0,1,2,3", "EventCode": "0x2", "EventName": "UNC_M_PRE_COUNT.PAGE_MISS",
@@ -63,7 +59,7 @@ "Unit": "iMC" }, { - "BriefDescription": "Pre-charge for reads. Derived from unc_m_pre_count.rd", + "BriefDescription": "Pre-charge for reads", "Counter": "0,1,2,3", "EventCode": "0x2", "EventName": "UNC_M_PRE_COUNT.RD",
@@ -72,7 +68,7 @@ "Unit": "iMC" }, { - "BriefDescription": "Pre-charge for writes. Derived from unc_m_pre_count.wr", + "BriefDescription": "Pre-charge for writes", "Counter": "0,1,2,3", "EventCode": "0x2", "EventName": "UNC_M_PRE_COUNT.WR",
tools/perf/pmu-events/arch/x86/broadwellde/uncore-power.json +17 -9
@@ -1,83 +1,91 @@ [ { - "BriefDescription": "PCU clock ticks. Use to get percentages of PCU cycles events. Derived from unc_p_clockticks", + "BriefDescription": "PCU clock ticks. Use to get percentages of PCU cycles events", "Counter": "0,1,2,3", "EventName": "UNC_P_CLOCKTICKS", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "C0 and C1. Derived from unc_p_power_state_occupancy.cores_c0", + "BriefDescription": "This is an occupancy event that tracks the number of cores that are in C0. It can be used by itself to get the average number of cores in C0, with threshholding to generate histograms, or with other PCU events and occupancy triggering to capture other details", "Counter": "0,1,2,3", "EventCode": "0x80", "EventName": "UNC_P_POWER_STATE_OCCUPANCY.CORES_C0", "Filter": "occ_sel=1", "MetricExpr": "(UNC_P_POWER_STATE_OCCUPANCY.CORES_C0 / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "power_state_occupancy.cores_c0 %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "C3. Derived from unc_p_power_state_occupancy.cores_c3", + "BriefDescription": "This is an occupancy event that tracks the number of cores that are in C3. It can be used by itself to get the average number of cores in C0, with threshholding to generate histograms, or with other PCU events and occupancy triggering to capture other details", "Counter": "0,1,2,3", "EventCode": "0x80", "EventName": "UNC_P_POWER_STATE_OCCUPANCY.CORES_C3", "Filter": "occ_sel=2", "MetricExpr": "(UNC_P_POWER_STATE_OCCUPANCY.CORES_C3 / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "power_state_occupancy.cores_c3 %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "C6 and C7. Derived from unc_p_power_state_occupancy.cores_c6", + "BriefDescription": "This is an occupancy event that tracks the number of cores that are in C6. It can be used by itself to get the average number of cores in C0, with threshholding to generate histograms, or with other PCU events ", "Counter": "0,1,2,3", "EventCode": "0x80", "EventName": "UNC_P_POWER_STATE_OCCUPANCY.CORES_C6", "Filter": "occ_sel=3", "MetricExpr": "(UNC_P_POWER_STATE_OCCUPANCY.CORES_C6 / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "power_state_occupancy.cores_c6 %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "External Prochot. Derived from unc_p_prochot_external_cycles", + "BriefDescription": "Counts the number of cycles that we are in external PROCHOT mode. This mode is triggered when a sensor off the die determines that something off-die (like DRAM) is too hot and must throttle to avoid damaging the chip", "Counter": "0,1,2,3", "EventCode": "0xA", "EventName": "UNC_P_PROCHOT_EXTERNAL_CYCLES", "MetricExpr": "(UNC_P_PROCHOT_EXTERNAL_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "prochot_external_cycles %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "Thermal Strongest Upper Limit Cycles. Derived from unc_p_freq_max_limit_thermal_cycles", + "BriefDescription": "Counts the number of cycles when temperature is the upper limit on frequency", "Counter": "0,1,2,3", "EventCode": "0x4", "EventName": "UNC_P_FREQ_MAX_LIMIT_THERMAL_CYCLES", "MetricExpr": "(UNC_P_FREQ_MAX_LIMIT_THERMAL_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "freq_max_limit_thermal_cycles %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "OS Strongest Upper Limit Cycles. Derived from unc_p_freq_max_os_cycles", + "BriefDescription": "Counts the number of cycles when the OS is the upper limit on frequency", "Counter": "0,1,2,3", "EventCode": "0x6", "EventName": "UNC_P_FREQ_MAX_OS_CYCLES", "MetricExpr": "(UNC_P_FREQ_MAX_OS_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "freq_max_os_cycles %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "Power Strongest Upper Limit Cycles. Derived from unc_p_freq_max_power_cycles", + "BriefDescription": "Counts the number of cycles when power is the upper limit on frequency", "Counter": "0,1,2,3", "EventCode": "0x5", "EventName": "UNC_P_FREQ_MAX_POWER_CYCLES", "MetricExpr": "(UNC_P_FREQ_MAX_POWER_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "freq_max_power_cycles %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "Cycles spent changing Frequency. Derived from unc_p_freq_trans_cycles", + "BriefDescription": "Counts the number of cycles when current is the upper limit on frequency", "Counter": "0,1,2,3", "EventCode": "0x74", "EventName": "UNC_P_FREQ_TRANS_CYCLES", "MetricExpr": "(UNC_P_FREQ_TRANS_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "freq_trans_cycles %", "PerPkg": "1", "Unit": "PCU" }
tools/perf/pmu-events/arch/x86/broadwellx/uncore-cache.json +14 -14
@@ -1,13 +1,13 @@ [ { - "BriefDescription": "Uncore cache clock ticks. Derived from unc_c_clockticks", + "BriefDescription": "Uncore cache clock ticks", "Counter": "0,1,2,3", "EventName": "UNC_C_CLOCKTICKS", "PerPkg": "1", "Unit": "CBO" }, { - "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch). Derived from unc_c_llc_lookup.any", + "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch)", "Counter": "0,1,2,3", "EventCode": "0x34", "EventName": "UNC_C_LLC_LOOKUP.ANY",
@@ -18,7 +18,7 @@ "Unit": "CBO" }, { - "BriefDescription": "M line evictions from LLC (writebacks to memory). Derived from unc_c_llc_victims.m_state", + "BriefDescription": "M line evictions from LLC (writebacks to memory)", "Counter": "0,1,2,3", "EventCode": "0x37", "EventName": "UNC_C_LLC_VICTIMS.M_STATE",
@@ -212,7 +212,7 @@ "Unit": "CBO" }, { - "BriefDescription": "read requests to home agent. Derived from unc_h_requests.reads", + "BriefDescription": "read requests to home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.READS",
@@ -221,7 +221,7 @@ "Unit": "HA" }, { - "BriefDescription": "read requests to local home agent. Derived from unc_h_requests.reads_local", + "BriefDescription": "read requests to local home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.READS_LOCAL",
@@ -230,7 +230,7 @@ "Unit": "HA" }, { - "BriefDescription": "read requests to remote home agent. Derived from unc_h_requests.reads_remote", + "BriefDescription": "read requests to remote home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.READS_REMOTE",
@@ -239,7 +239,7 @@ "Unit": "HA" }, { - "BriefDescription": "write requests to home agent. Derived from unc_h_requests.writes", + "BriefDescription": "write requests to home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.WRITES",
@@ -248,7 +248,7 @@ "Unit": "HA" }, { - "BriefDescription": "write requests to local home agent. Derived from unc_h_requests.writes_local", + "BriefDescription": "write requests to local home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.WRITES_LOCAL",
@@ -257,7 +257,7 @@ "Unit": "HA" }, { - "BriefDescription": "write requests to remote home agent. Derived from unc_h_requests.writes_remote", + "BriefDescription": "write requests to remote home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.WRITES_REMOTE",
@@ -266,7 +266,7 @@ "Unit": "HA" }, { - "BriefDescription": "Conflict requests (requests for same address from multiple agents simultaneously). Derived from unc_h_snoop_resp.rspcnflct", + "BriefDescription": "Conflict requests (requests for same address from multiple agents simultaneously)", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPCNFLCT",
@@ -275,7 +275,7 @@ "Unit": "HA" }, { - "BriefDescription": "M line forwarded from remote cache along with writeback to memory. Derived from unc_h_snoop_resp.rsp_fwd_wb", + "BriefDescription": "M line forwarded from remote cache along with writeback to memory", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSP_FWD_WB",
@@ -285,7 +285,7 @@ "Unit": "HA" }, { - "BriefDescription": "M line forwarded from remote cache with no writeback to memory. Derived from unc_h_snoop_resp.rspifwd", + "BriefDescription": "M line forwarded from remote cache with no writeback to memory", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPIFWD",
@@ -295,7 +295,7 @@ "Unit": "HA" }, { - "BriefDescription": "Shared line response from remote cache. Derived from unc_h_snoop_resp.rsps", + "BriefDescription": "Shared line response from remote cache", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPS",
@@ -305,7 +305,7 @@ "Unit": "HA" }, { - "BriefDescription": "Shared line forwarded from remote cache. Derived from unc_h_snoop_resp.rspsfwd", + "BriefDescription": "Shared line forwarded from remote cache", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPSFWD",
tools/perf/pmu-events/arch/x86/broadwellx/uncore-interconnect.json +3 -3
@@ -1,6 +1,6 @@ [ { - "BriefDescription": "QPI clock ticks. Derived from unc_q_clockticks", + "BriefDescription": "QPI clock ticks", "Counter": "0,1,2,3", "EventCode": "0x14", "EventName": "UNC_Q_CLOCKTICKS",
@@ -10,7 +10,7 @@ { "BriefDescription": "Number of data flits transmitted . Derived from unc_q_txl_flits_g0.data", "Counter": "0,1,2,3", - "EventName": "UNC_Q_TxL_FLITS_G0.DATA", + "EventName": "QPI_DATA_BANDWIDTH_TX", "PerPkg": "1", "ScaleUnit": "8Bytes", "UMask": "0x2",
@@ -19,7 +19,7 @@ { "BriefDescription": "Number of non data (control) flits transmitted . Derived from unc_q_txl_flits_g0.non_data", "Counter": "0,1,2,3", - "EventName": "UNC_Q_TxL_FLITS_G0.NON_DATA", + "EventName": "QPI_CTL_BANDWIDTH_TX", "PerPkg": "1", "ScaleUnit": "8Bytes", "UMask": "0x4",
tools/perf/pmu-events/arch/x86/broadwellx/uncore-memory.json +12 -9
@@ -3,7 +3,7 @@ "BriefDescription": "read requests to memory controller. Derived from unc_m_cas_count.rd", "Counter": "0,1,2,3", "EventCode": "0x4", - "EventName": "UNC_M_CAS_COUNT.RD", + "EventName": "LLC_MISSES.MEM_READ", "PerPkg": "1", "ScaleUnit": "64Bytes", "UMask": "0x3",
@@ -13,48 +13,51 @@ "BriefDescription": "write requests to memory controller. Derived from unc_m_cas_count.wr", "Counter": "0,1,2,3", "EventCode": "0x4", - "EventName": "UNC_M_CAS_COUNT.WR", + "EventName": "LLC_MISSES.MEM_WRITE", "PerPkg": "1", "ScaleUnit": "64Bytes", "UMask": "0xC", "Unit": "iMC" }, { - "BriefDescription": "Memory controller clock ticks. Derived from unc_m_clockticks", + "BriefDescription": "Memory controller clock ticks", "Counter": "0,1,2,3", "EventName": "UNC_M_CLOCKTICKS", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles where DRAM ranks are in power down (CKE) mode. Derived from unc_m_power_channel_ppd", + "BriefDescription": "Cycles where DRAM ranks are in power down (CKE) mode", "Counter": "0,1,2,3", "EventCode": "0x85", "EventName": "UNC_M_POWER_CHANNEL_PPD", "MetricExpr": "(UNC_M_POWER_CHANNEL_PPD / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_channel_ppd %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles all ranks are in critical thermal throttle. Derived from unc_m_power_critical_throttle_cycles", + "BriefDescription": "Cycles all ranks are in critical thermal throttle", "Counter": "0,1,2,3", "EventCode": "0x86", "EventName": "UNC_M_POWER_CRITICAL_THROTTLE_CYCLES", "MetricExpr": "(UNC_M_POWER_CRITICAL_THROTTLE_CYCLES / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_critical_throttle_cycles %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles Memory is in self refresh power mode. Derived from unc_m_power_self_refresh", + "BriefDescription": "Cycles Memory is in self refresh power mode", "Counter": "0,1,2,3", "EventCode": "0x43", "EventName": "UNC_M_POWER_SELF_REFRESH", "MetricExpr": "(UNC_M_POWER_SELF_REFRESH / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_self_refresh %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Pre-charges due to page misses. Derived from unc_m_pre_count.page_miss", + "BriefDescription": "Pre-charges due to page misses", "Counter": "0,1,2,3", "EventCode": "0x2", "EventName": "UNC_M_PRE_COUNT.PAGE_MISS",
@@ -63,7 +66,7 @@ "Unit": "iMC" }, { - "BriefDescription": "Pre-charge for reads. Derived from unc_m_pre_count.rd", + "BriefDescription": "Pre-charge for reads", "Counter": "0,1,2,3", "EventCode": "0x2", "EventName": "UNC_M_PRE_COUNT.RD",
@@ -72,7 +75,7 @@ "Unit": "iMC" }, { - "BriefDescription": "Pre-charge for writes. Derived from unc_m_pre_count.wr", + "BriefDescription": "Pre-charge for writes", "Counter": "0,1,2,3", "EventCode": "0x2", "EventName": "UNC_M_PRE_COUNT.WR",
tools/perf/pmu-events/arch/x86/broadwellx/uncore-power.json +17 -9
@@ -1,83 +1,91 @@ [ { - "BriefDescription": "PCU clock ticks. Use to get percentages of PCU cycles events. Derived from unc_p_clockticks", + "BriefDescription": "PCU clock ticks. Use to get percentages of PCU cycles events", "Counter": "0,1,2,3", "EventName": "UNC_P_CLOCKTICKS", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "C0 and C1. Derived from unc_p_power_state_occupancy.cores_c0", + "BriefDescription": "This is an occupancy event that tracks the number of cores that are in C0. It can be used by itself to get the average number of cores in C0, with threshholding to generate histograms, or with other PCU events and occupancy triggering to capture other details", "Counter": "0,1,2,3", "EventCode": "0x80", "EventName": "UNC_P_POWER_STATE_OCCUPANCY.CORES_C0", "Filter": "occ_sel=1", "MetricExpr": "(UNC_P_POWER_STATE_OCCUPANCY.CORES_C0 / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "power_state_occupancy.cores_c0 %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "C3. Derived from unc_p_power_state_occupancy.cores_c3", + "BriefDescription": "This is an occupancy event that tracks the number of cores that are in C3. It can be used by itself to get the average number of cores in C0, with threshholding to generate histograms, or with other PCU events and occupancy triggering to capture other details", "Counter": "0,1,2,3", "EventCode": "0x80", "EventName": "UNC_P_POWER_STATE_OCCUPANCY.CORES_C3", "Filter": "occ_sel=2", "MetricExpr": "(UNC_P_POWER_STATE_OCCUPANCY.CORES_C3 / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "power_state_occupancy.cores_c3 %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "C6 and C7. Derived from unc_p_power_state_occupancy.cores_c6", + "BriefDescription": "This is an occupancy event that tracks the number of cores that are in C6. It can be used by itself to get the average number of cores in C0, with threshholding to generate histograms, or with other PCU events ", "Counter": "0,1,2,3", "EventCode": "0x80", "EventName": "UNC_P_POWER_STATE_OCCUPANCY.CORES_C6", "Filter": "occ_sel=3", "MetricExpr": "(UNC_P_POWER_STATE_OCCUPANCY.CORES_C6 / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "power_state_occupancy.cores_c6 %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "External Prochot. Derived from unc_p_prochot_external_cycles", + "BriefDescription": "Counts the number of cycles that we are in external PROCHOT mode. This mode is triggered when a sensor off the die determines that something off-die (like DRAM) is too hot and must throttle to avoid damaging the chip", "Counter": "0,1,2,3", "EventCode": "0xA", "EventName": "UNC_P_PROCHOT_EXTERNAL_CYCLES", "MetricExpr": "(UNC_P_PROCHOT_EXTERNAL_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "prochot_external_cycles %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "Thermal Strongest Upper Limit Cycles. Derived from unc_p_freq_max_limit_thermal_cycles", + "BriefDescription": "Counts the number of cycles when temperature is the upper limit on frequency", "Counter": "0,1,2,3", "EventCode": "0x4", "EventName": "UNC_P_FREQ_MAX_LIMIT_THERMAL_CYCLES", "MetricExpr": "(UNC_P_FREQ_MAX_LIMIT_THERMAL_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "freq_max_limit_thermal_cycles %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "OS Strongest Upper Limit Cycles. Derived from unc_p_freq_max_os_cycles", + "BriefDescription": "Counts the number of cycles when the OS is the upper limit on frequency", "Counter": "0,1,2,3", "EventCode": "0x6", "EventName": "UNC_P_FREQ_MAX_OS_CYCLES", "MetricExpr": "(UNC_P_FREQ_MAX_OS_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "freq_max_os_cycles %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "Power Strongest Upper Limit Cycles. Derived from unc_p_freq_max_power_cycles", + "BriefDescription": "Counts the number of cycles when power is the upper limit on frequency", "Counter": "0,1,2,3", "EventCode": "0x5", "EventName": "UNC_P_FREQ_MAX_POWER_CYCLES", "MetricExpr": "(UNC_P_FREQ_MAX_POWER_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "freq_max_power_cycles %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "Cycles spent changing Frequency. Derived from unc_p_freq_trans_cycles", + "BriefDescription": "Counts the number of cycles when current is the upper limit on frequency", "Counter": "0,1,2,3", "EventCode": "0x74", "EventName": "UNC_P_FREQ_TRANS_CYCLES", "MetricExpr": "(UNC_P_FREQ_TRANS_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "freq_trans_cycles %", "PerPkg": "1", "Unit": "PCU" }
tools/perf/pmu-events/arch/x86/haswellx/uncore-cache.json +14 -14
@@ -1,13 +1,13 @@ [ { - "BriefDescription": "Uncore cache clock ticks. Derived from unc_c_clockticks", + "BriefDescription": "Uncore cache clock ticks", "Counter": "0,1,2,3", "EventName": "UNC_C_CLOCKTICKS", "PerPkg": "1", "Unit": "CBO" }, { - "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch). Derived from unc_c_llc_lookup.any", + "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch)", "Counter": "0,1,2,3", "EventCode": "0x34", "EventName": "UNC_C_LLC_LOOKUP.ANY",
@@ -18,7 +18,7 @@ "Unit": "CBO" }, { - "BriefDescription": "M line evictions from LLC (writebacks to memory). Derived from unc_c_llc_victims.m_state", + "BriefDescription": "M line evictions from LLC (writebacks to memory)", "Counter": "0,1,2,3", "EventCode": "0x37", "EventName": "UNC_C_LLC_VICTIMS.M_STATE",
@@ -212,7 +212,7 @@ "Unit": "CBO" }, { - "BriefDescription": "read requests to home agent. Derived from unc_h_requests.reads", + "BriefDescription": "read requests to home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.READS",
@@ -221,7 +221,7 @@ "Unit": "HA" }, { - "BriefDescription": "read requests to local home agent. Derived from unc_h_requests.reads_local", + "BriefDescription": "read requests to local home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.READS_LOCAL",
@@ -230,7 +230,7 @@ "Unit": "HA" }, { - "BriefDescription": "read requests to remote home agent. Derived from unc_h_requests.reads_remote", + "BriefDescription": "read requests to remote home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.READS_REMOTE",
@@ -239,7 +239,7 @@ "Unit": "HA" }, { - "BriefDescription": "write requests to home agent. Derived from unc_h_requests.writes", + "BriefDescription": "write requests to home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.WRITES",
@@ -248,7 +248,7 @@ "Unit": "HA" }, { - "BriefDescription": "write requests to local home agent. Derived from unc_h_requests.writes_local", + "BriefDescription": "write requests to local home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.WRITES_LOCAL",
@@ -257,7 +257,7 @@ "Unit": "HA" }, { - "BriefDescription": "write requests to remote home agent. Derived from unc_h_requests.writes_remote", + "BriefDescription": "write requests to remote home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.WRITES_REMOTE",
@@ -266,7 +266,7 @@ "Unit": "HA" }, { - "BriefDescription": "Conflict requests (requests for same address from multiple agents simultaneously). Derived from unc_h_snoop_resp.rspcnflct", + "BriefDescription": "Conflict requests (requests for same address from multiple agents simultaneously)", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPCNFLCT",
@@ -275,7 +275,7 @@ "Unit": "HA" }, { - "BriefDescription": "M line forwarded from remote cache along with writeback to memory. Derived from unc_h_snoop_resp.rsp_fwd_wb", + "BriefDescription": "M line forwarded from remote cache along with writeback to memory", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSP_FWD_WB",
@@ -285,7 +285,7 @@ "Unit": "HA" }, { - "BriefDescription": "M line forwarded from remote cache with no writeback to memory. Derived from unc_h_snoop_resp.rspifwd", + "BriefDescription": "M line forwarded from remote cache with no writeback to memory", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPIFWD",
@@ -295,7 +295,7 @@ "Unit": "HA" }, { - "BriefDescription": "Shared line response from remote cache. Derived from unc_h_snoop_resp.rsps", + "BriefDescription": "Shared line response from remote cache", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPS",
@@ -305,7 +305,7 @@ "Unit": "HA" }, { - "BriefDescription": "Shared line forwarded from remote cache. Derived from unc_h_snoop_resp.rspsfwd", + "BriefDescription": "Shared line forwarded from remote cache", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPSFWD",
tools/perf/pmu-events/arch/x86/haswellx/uncore-interconnect.json +3 -3
@@ -1,6 +1,6 @@ [ { - "BriefDescription": "QPI clock ticks. Derived from unc_q_clockticks", + "BriefDescription": "QPI clock ticks", "Counter": "0,1,2,3", "EventCode": "0x14", "EventName": "UNC_Q_CLOCKTICKS",
@@ -10,7 +10,7 @@ { "BriefDescription": "Number of data flits transmitted . Derived from unc_q_txl_flits_g0.data", "Counter": "0,1,2,3", - "EventName": "UNC_Q_TxL_FLITS_G0.DATA", + "EventName": "QPI_DATA_BANDWIDTH_TX", "PerPkg": "1", "ScaleUnit": "8Bytes", "UMask": "0x2",
@@ -19,7 +19,7 @@ { "BriefDescription": "Number of non data (control) flits transmitted . Derived from unc_q_txl_flits_g0.non_data", "Counter": "0,1,2,3", - "EventName": "UNC_Q_TxL_FLITS_G0.NON_DATA", + "EventName": "QPI_CTL_BANDWIDTH_TX", "PerPkg": "1", "ScaleUnit": "8Bytes", "UMask": "0x4",
tools/perf/pmu-events/arch/x86/haswellx/uncore-memory.json +12 -9
@@ -3,7 +3,7 @@ "BriefDescription": "read requests to memory controller. Derived from unc_m_cas_count.rd", "Counter": "0,1,2,3", "EventCode": "0x4", - "EventName": "UNC_M_CAS_COUNT.RD", + "EventName": "LLC_MISSES.MEM_READ", "PerPkg": "1", "ScaleUnit": "64Bytes", "UMask": "0x3",
@@ -13,48 +13,51 @@ "BriefDescription": "write requests to memory controller. Derived from unc_m_cas_count.wr", "Counter": "0,1,2,3", "EventCode": "0x4", - "EventName": "UNC_M_CAS_COUNT.WR", + "EventName": "LLC_MISSES.MEM_WRITE", "PerPkg": "1", "ScaleUnit": "64Bytes", "UMask": "0xC", "Unit": "iMC" }, { - "BriefDescription": "Memory controller clock ticks. Derived from unc_m_clockticks", + "BriefDescription": "Memory controller clock ticks", "Counter": "0,1,2,3", "EventName": "UNC_M_CLOCKTICKS", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles where DRAM ranks are in power down (CKE) mode. Derived from unc_m_power_channel_ppd", + "BriefDescription": "Cycles where DRAM ranks are in power down (CKE) mode", "Counter": "0,1,2,3", "EventCode": "0x85", "EventName": "UNC_M_POWER_CHANNEL_PPD", "MetricExpr": "(UNC_M_POWER_CHANNEL_PPD / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_channel_ppd %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles all ranks are in critical thermal throttle. Derived from unc_m_power_critical_throttle_cycles", + "BriefDescription": "Cycles all ranks are in critical thermal throttle", "Counter": "0,1,2,3", "EventCode": "0x86", "EventName": "UNC_M_POWER_CRITICAL_THROTTLE_CYCLES", "MetricExpr": "(UNC_M_POWER_CRITICAL_THROTTLE_CYCLES / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_critical_throttle_cycles %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles Memory is in self refresh power mode. Derived from unc_m_power_self_refresh", + "BriefDescription": "Cycles Memory is in self refresh power mode", "Counter": "0,1,2,3", "EventCode": "0x43", "EventName": "UNC_M_POWER_SELF_REFRESH", "MetricExpr": "(UNC_M_POWER_SELF_REFRESH / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_self_refresh %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Pre-charges due to page misses. Derived from unc_m_pre_count.page_miss", + "BriefDescription": "Pre-charges due to page misses", "Counter": "0,1,2,3", "EventCode": "0x2", "EventName": "UNC_M_PRE_COUNT.PAGE_MISS",
@@ -63,7 +66,7 @@ "Unit": "iMC" }, { - "BriefDescription": "Pre-charge for reads. Derived from unc_m_pre_count.rd", + "BriefDescription": "Pre-charge for reads", "Counter": "0,1,2,3", "EventCode": "0x2", "EventName": "UNC_M_PRE_COUNT.RD",
@@ -72,7 +75,7 @@ "Unit": "iMC" }, { - "BriefDescription": "Pre-charge for writes. Derived from unc_m_pre_count.wr", + "BriefDescription": "Pre-charge for writes", "Counter": "0,1,2,3", "EventCode": "0x2", "EventName": "UNC_M_PRE_COUNT.WR",
tools/perf/pmu-events/arch/x86/haswellx/uncore-power.json +17 -9
@@ -1,83 +1,91 @@ [ { - "BriefDescription": "PCU clock ticks. Use to get percentages of PCU cycles events. Derived from unc_p_clockticks", + "BriefDescription": "PCU clock ticks. Use to get percentages of PCU cycles events", "Counter": "0,1,2,3", "EventName": "UNC_P_CLOCKTICKS", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "C0 and C1. Derived from unc_p_power_state_occupancy.cores_c0", + "BriefDescription": "This is an occupancy event that tracks the number of cores that are in C0. It can be used by itself to get the average number of cores in C0, with threshholding to generate histograms, or with other PCU events and occupancy triggering to capture other details", "Counter": "0,1,2,3", "EventCode": "0x80", "EventName": "UNC_P_POWER_STATE_OCCUPANCY.CORES_C0", "Filter": "occ_sel=1", "MetricExpr": "(UNC_P_POWER_STATE_OCCUPANCY.CORES_C0 / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "power_state_occupancy.cores_c0 %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "C3. Derived from unc_p_power_state_occupancy.cores_c3", + "BriefDescription": "This is an occupancy event that tracks the number of cores that are in C3. It can be used by itself to get the average number of cores in C0, with threshholding to generate histograms, or with other PCU events and occupancy triggering to capture other details", "Counter": "0,1,2,3", "EventCode": "0x80", "EventName": "UNC_P_POWER_STATE_OCCUPANCY.CORES_C3", "Filter": "occ_sel=2", "MetricExpr": "(UNC_P_POWER_STATE_OCCUPANCY.CORES_C3 / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "power_state_occupancy.cores_c3 %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "C6 and C7. Derived from unc_p_power_state_occupancy.cores_c6", + "BriefDescription": "This is an occupancy event that tracks the number of cores that are in C6. It can be used by itself to get the average number of cores in C0, with threshholding to generate histograms, or with other PCU events ", "Counter": "0,1,2,3", "EventCode": "0x80", "EventName": "UNC_P_POWER_STATE_OCCUPANCY.CORES_C6", "Filter": "occ_sel=3", "MetricExpr": "(UNC_P_POWER_STATE_OCCUPANCY.CORES_C6 / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "power_state_occupancy.cores_c6 %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "External Prochot. Derived from unc_p_prochot_external_cycles", + "BriefDescription": "Counts the number of cycles that we are in external PROCHOT mode. This mode is triggered when a sensor off the die determines that something off-die (like DRAM) is too hot and must throttle to avoid damaging the chip", "Counter": "0,1,2,3", "EventCode": "0xA", "EventName": "UNC_P_PROCHOT_EXTERNAL_CYCLES", "MetricExpr": "(UNC_P_PROCHOT_EXTERNAL_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "prochot_external_cycles %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "Thermal Strongest Upper Limit Cycles. Derived from unc_p_freq_max_limit_thermal_cycles", + "BriefDescription": "Counts the number of cycles when temperature is the upper limit on frequency", "Counter": "0,1,2,3", "EventCode": "0x4", "EventName": "UNC_P_FREQ_MAX_LIMIT_THERMAL_CYCLES", "MetricExpr": "(UNC_P_FREQ_MAX_LIMIT_THERMAL_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "freq_max_limit_thermal_cycles %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "OS Strongest Upper Limit Cycles. Derived from unc_p_freq_max_os_cycles", + "BriefDescription": "Counts the number of cycles when the OS is the upper limit on frequency", "Counter": "0,1,2,3", "EventCode": "0x6", "EventName": "UNC_P_FREQ_MAX_OS_CYCLES", "MetricExpr": "(UNC_P_FREQ_MAX_OS_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "freq_max_os_cycles %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "Power Strongest Upper Limit Cycles. Derived from unc_p_freq_max_power_cycles", + "BriefDescription": "Counts the number of cycles when power is the upper limit on frequency", "Counter": "0,1,2,3", "EventCode": "0x5", "EventName": "UNC_P_FREQ_MAX_POWER_CYCLES", "MetricExpr": "(UNC_P_FREQ_MAX_POWER_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "freq_max_power_cycles %", "PerPkg": "1", "Unit": "PCU" }, { - "BriefDescription": "Cycles spent changing Frequency. Derived from unc_p_freq_trans_cycles", + "BriefDescription": "Counts the number of cycles when current is the upper limit on frequency", "Counter": "0,1,2,3", "EventCode": "0x74", "EventName": "UNC_P_FREQ_TRANS_CYCLES", "MetricExpr": "(UNC_P_FREQ_TRANS_CYCLES / UNC_P_CLOCKTICKS) * 100.", + "MetricName": "freq_trans_cycles %", "PerPkg": "1", "Unit": "PCU" }
tools/perf/pmu-events/arch/x86/ivytown/uncore-cache.json +11 -11
@@ -1,13 +1,13 @@ [ { - "BriefDescription": "Uncore cache clock ticks. Derived from unc_c_clockticks", + "BriefDescription": "Uncore cache clock ticks", "Counter": "0,1,2,3", "EventName": "UNC_C_CLOCKTICKS", "PerPkg": "1", "Unit": "CBO" }, { - "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch). Derived from unc_c_llc_lookup.any", + "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch)", "Counter": "0,1", "EventCode": "0x34", "EventName": "UNC_C_LLC_LOOKUP.ANY",
@@ -18,7 +18,7 @@ "Unit": "CBO" }, { - "BriefDescription": "M line evictions from LLC (writebacks to memory). Derived from unc_c_llc_victims.m_state", + "BriefDescription": "M line evictions from LLC (writebacks to memory)", "Counter": "0,1", "EventCode": "0x37", "EventName": "UNC_C_LLC_VICTIMS.M_STATE",
@@ -237,7 +237,7 @@ "Unit": "CBO" }, { - "BriefDescription": "Occupancy for all LLC misses that are addressed to local memory. Derived from unc_c_tor_occupancy.miss_local", + "BriefDescription": "Occupancy for all LLC misses that are addressed to local memory", "EventCode": "0x36", "EventName": "UNC_C_TOR_OCCUPANCY.MISS_LOCAL", "PerPkg": "1",
@@ -254,7 +254,7 @@ "Unit": "CBO" }, { - "BriefDescription": "Occupancy for all LLC misses that are addressed to remote memory. Derived from unc_c_tor_occupancy.miss_remote", + "BriefDescription": "Occupancy for all LLC misses that are addressed to remote memory", "EventCode": "0x36", "EventName": "UNC_C_TOR_OCCUPANCY.MISS_REMOTE", "PerPkg": "1",
@@ -262,7 +262,7 @@ "Unit": "CBO" }, { - "BriefDescription": "Read requests to home agent. Derived from unc_h_requests.reads", + "BriefDescription": "Read requests to home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.READS",
@@ -271,7 +271,7 @@ "Unit": "HA" }, { - "BriefDescription": "Write requests to home agent. Derived from unc_h_requests.writes", + "BriefDescription": "Write requests to home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.WRITES",
@@ -280,7 +280,7 @@ "Unit": "HA" }, { - "BriefDescription": "M line forwarded from remote cache along with writeback to memory. Derived from unc_h_snoop_resp.rsp_fwd_wb", + "BriefDescription": "M line forwarded from remote cache along with writeback to memory", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSP_FWD_WB",
@@ -290,7 +290,7 @@ "Unit": "HA" }, { - "BriefDescription": "M line forwarded from remote cache with no writeback to memory. Derived from unc_h_snoop_resp.rspifwd", + "BriefDescription": "M line forwarded from remote cache with no writeback to memory", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPIFWD",
@@ -300,7 +300,7 @@ "Unit": "HA" }, { - "BriefDescription": "Shared line response from remote cache. Derived from unc_h_snoop_resp.rsps", + "BriefDescription": "Shared line response from remote cache", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPS",
@@ -310,7 +310,7 @@ "Unit": "HA" }, { - "BriefDescription": "Shared line forwarded from remote cache. Derived from unc_h_snoop_resp.rspsfwd", + "BriefDescription": "Shared line forwarded from remote cache", "Counter": "0,1,2,3", "EventCode": "0x21", "EventName": "UNC_H_SNOOP_RESP.RSPSFWD",
tools/perf/pmu-events/arch/x86/ivytown/uncore-interconnect.json +7 -5
@@ -1,6 +1,6 @@ [ { - "BriefDescription": "QPI clock ticks. Use to get percentages for QPI cycles events. Derived from unc_q_clockticks", + "BriefDescription": "QPI clock ticks. Use to get percentages for QPI cycles events", "Counter": "0,1,2,3", "EventCode": "0x14", "EventName": "UNC_Q_CLOCKTICKS",
@@ -8,25 +8,27 @@ "Unit": "QPI LL" }, { - "BriefDescription": "Cycles where receiving QPI link is in half-width mode. Derived from unc_q_rxl0p_power_cycles", + "BriefDescription": "Cycles where receiving QPI link is in half-width mode", "Counter": "0,1,2,3", "EventCode": "0x10", "EventName": "UNC_Q_RxL0P_POWER_CYCLES", "MetricExpr": "(UNC_Q_RxL0P_POWER_CYCLES / UNC_Q_CLOCKTICKS) * 100.", + "MetricName": "rxl0p_power_cycles %", "PerPkg": "1", "Unit": "QPI LL" }, { - "BriefDescription": "Cycles where transmitting QPI link is in half-width mode. Derived from unc_q_txl0p_power_cycles", + "BriefDescription": "Cycles where transmitting QPI link is in half-width mode", "Counter": "0,1,2,3", "EventCode": "0xd", "EventName": "UNC_Q_TxL0P_POWER_CYCLES", "MetricExpr": "(UNC_Q_TxL0P_POWER_CYCLES / UNC_Q_CLOCKTICKS) * 100.", + "MetricName": "txl0p_power_cycles %", "PerPkg": "1", "Unit": "QPI LL" }, { - "BriefDescription": "Number of data flits transmitted . Derived from unc_q_txl_flits_g0.data", + "BriefDescription": "Number of data flits transmitted ", "Counter": "0,1,2,3", "EventName": "UNC_Q_TxL_FLITS_G0.DATA", "PerPkg": "1",
@@ -35,7 +37,7 @@ "Unit": "QPI LL" }, { - "BriefDescription": "Number of non data (control) flits transmitted . Derived from unc_q_txl_flits_g0.non_data", + "BriefDescription": "Number of non data (control) flits transmitted ", "Counter": "0,1,2,3", "EventName": "UNC_Q_TxL_FLITS_G0.NON_DATA", "PerPkg": "1",
tools/perf/pmu-events/arch/x86/ivytown/uncore-memory.json +11 -8
@@ -1,6 +1,6 @@ [ { - "BriefDescription": "Memory page activates for reads and writes. Derived from unc_m_act_count.rd", + "BriefDescription": "Memory page activates for reads and writes", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_M_ACT_COUNT.RD",
@@ -13,7 +13,7 @@ "BriefDescription": "Read requests to memory controller. Derived from unc_m_cas_count.rd", "Counter": "0,1,2,3", "EventCode": "0x4", - "EventName": "UNC_M_CAS_COUNT.RD", + "EventName": "LLC_MISSES.MEM_READ", "PerPkg": "1", "ScaleUnit": "64Bytes", "UMask": "0x3",
@@ -23,48 +23,51 @@ "BriefDescription": "Write requests to memory controller. Derived from unc_m_cas_count.wr", "Counter": "0,1,2,3", "EventCode": "0x4", - "EventName": "UNC_M_CAS_COUNT.WR", + "EventName": "LLC_MISSES.MEM_WRITE", "PerPkg": "1", "ScaleUnit": "64Bytes", "UMask": "0xC", "Unit": "iMC" }, { - "BriefDescription": "Memory controller clock ticks. Use to generate percentages for memory controller CYCLES events. Derived from unc_m_clockticks", + "BriefDescription": "Memory controller clock ticks. Use to generate percentages for memory controller CYCLES events", "Counter": "0,1,2,3", "EventName": "UNC_M_CLOCKTICKS", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles where DRAM ranks are in power down (CKE) mode. Derived from unc_m_power_channel_ppd", + "BriefDescription": "Cycles where DRAM ranks are in power down (CKE) mode", "Counter": "0,1,2,3", "EventCode": "0x85", "EventName": "UNC_M_POWER_CHANNEL_PPD", "MetricExpr": "(UNC_M_POWER_CHANNEL_PPD / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_channel_ppd %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles all ranks are in critical thermal throttle. Derived from unc_m_power_critical_throttle_cycles", + "BriefDescription": "Cycles all ranks are in critical thermal throttle", "Counter": "0,1,2,3", "EventCode": "0x86", "EventName": "UNC_M_POWER_CRITICAL_THROTTLE_CYCLES", "MetricExpr": "(UNC_M_POWER_CRITICAL_THROTTLE_CYCLES / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_critical_throttle_cycles %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles Memory is in self refresh power mode. Derived from unc_m_power_self_refresh", + "BriefDescription": "Cycles Memory is in self refresh power mode", "Counter": "0,1,2,3", "EventCode": "0x43", "EventName": "UNC_M_POWER_SELF_REFRESH", "MetricExpr": "(UNC_M_POWER_SELF_REFRESH / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_self_refresh %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Memory page conflicts. Derived from unc_m_pre_count.page_miss", + "BriefDescription": "Memory page conflicts", "Counter": "0,1,2,3", "EventCode": "0x2", "EventName": "UNC_M_PRE_COUNT.PAGE_MISS",
tools/perf/pmu-events/arch/x86/ivytown/uncore-power.json +39 -14
239 lines not on this page · raw message
tools/perf/pmu-events/arch/x86/jaketown/uncore-cache.json +7 -6
@@ -1,13 +1,13 @@ [ { - "BriefDescription": "Uncore cache clock ticks. Derived from unc_c_clockticks", + "BriefDescription": "Uncore cache clock ticks", "Counter": "0,1,2,3", "EventName": "UNC_C_CLOCKTICKS", "PerPkg": "1", "Unit": "CBO" }, { - "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch). Derived from unc_c_llc_lookup.any", + "BriefDescription": "All LLC Misses (code+ data rd + data wr - including demand and prefetch)", "Counter": "0,1", "EventCode": "0x34", "EventName": "UNC_C_LLC_LOOKUP.ANY",
@@ -18,7 +18,7 @@ "Unit": "CBO" }, { - "BriefDescription": "M line evictions from LLC (writebacks to memory). Derived from unc_c_llc_victims.m_state", + "BriefDescription": "M line evictions from LLC (writebacks to memory)", "Counter": "0,1", "EventCode": "0x37", "EventName": "UNC_C_LLC_VICTIMS.M_STATE",
@@ -171,11 +171,12 @@ "Unit": "CBO" }, { - "BriefDescription": "Occupancy counter for all LLC misses; we divide this by UNC_C_CLOCKTICKS to get average Q depth. Derived from unc_c_tor_occupancy.miss_all", + "BriefDescription": "Occupancy counter for all LLC misses; we divide this by UNC_C_CLOCKTICKS to get average Q depth", "EventCode": "0x36", "EventName": "UNC_C_TOR_OCCUPANCY.MISS_ALL", "Filter": "filter_opc=0x182", "MetricExpr": "(UNC_C_TOR_OCCUPANCY.MISS_ALL / UNC_C_CLOCKTICKS) * 100.", + "MetricName": "tor_occupancy.miss_all %", "PerPkg": "1", "UMask": "0xa", "Unit": "CBO"
@@ -189,7 +190,7 @@ "Unit": "CBO" }, { - "BriefDescription": "read requests to home agent. Derived from unc_h_requests.reads", + "BriefDescription": "read requests to home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.READS",
@@ -198,7 +199,7 @@ "Unit": "HA" }, { - "BriefDescription": "write requests to home agent. Derived from unc_h_requests.writes", + "BriefDescription": "write requests to home agent", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_H_REQUESTS.WRITES",
tools/perf/pmu-events/arch/x86/jaketown/uncore-interconnect.json +7 -5
@@ -1,6 +1,6 @@ [ { - "BriefDescription": "QPI clock ticks. Used to get percentages of QPI cycles events. Derived from unc_q_clockticks", + "BriefDescription": "QPI clock ticks. Used to get percentages of QPI cycles events", "Counter": "0,1,2,3", "EventCode": "0x14", "EventName": "UNC_Q_CLOCKTICKS",
@@ -8,25 +8,27 @@ "Unit": "QPI LL" }, { - "BriefDescription": "Cycles where receiving QPI link is in half-width mode. Derived from unc_q_rxl0p_power_cycles", + "BriefDescription": "Cycles where receiving QPI link is in half-width mode", "Counter": "0,1,2,3", "EventCode": "0x10", "EventName": "UNC_Q_RxL0P_POWER_CYCLES", "MetricExpr": "(UNC_Q_RxL0P_POWER_CYCLES / UNC_Q_CLOCKTICKS) * 100.", + "MetricName": "rxl0p_power_cycles %", "PerPkg": "1", "Unit": "QPI LL" }, { - "BriefDescription": "Cycles where transmitting QPI link is in half-width mode. Derived from unc_q_txl0p_power_cycles", + "BriefDescription": "Cycles where transmitting QPI link is in half-width mode", "Counter": "0,1,2,3", "EventCode": "0xd", "EventName": "UNC_Q_TxL0P_POWER_CYCLES", "MetricExpr": "(UNC_Q_TxL0P_POWER_CYCLES / UNC_Q_CLOCKTICKS) * 100.", + "MetricName": "txl0p_power_cycles %", "PerPkg": "1", "Unit": "QPI LL" }, { - "BriefDescription": "Number of data flits transmitted . Derived from unc_q_txl_flits_g0.data", + "BriefDescription": "Number of data flits transmitted ", "Counter": "0,1,2,3", "EventName": "UNC_Q_TxL_FLITS_G0.DATA", "PerPkg": "1",
@@ -35,7 +37,7 @@ "Unit": "QPI LL" }, { - "BriefDescription": "Number of non data (control) flits transmitted . Derived from unc_q_txl_flits_g0.non_data", + "BriefDescription": "Number of non data (control) flits transmitted ", "Counter": "0,1,2,3", "EventName": "UNC_Q_TxL_FLITS_G0.NON_DATA", "PerPkg": "1",
tools/perf/pmu-events/arch/x86/jaketown/uncore-memory.json +12 -9
@@ -1,6 +1,6 @@ [ { - "BriefDescription": "Memory page activates. Derived from unc_m_act_count", + "BriefDescription": "Memory page activates", "Counter": "0,1,2,3", "EventCode": "0x1", "EventName": "UNC_M_ACT_COUNT",
@@ -11,7 +11,7 @@ "BriefDescription": "read requests to memory controller. Derived from unc_m_cas_count.rd", "Counter": "0,1,2,3", "EventCode": "0x4", - "EventName": "UNC_M_CAS_COUNT.RD", + "EventName": "LLC_MISSES.MEM_READ", "PerPkg": "1", "UMask": "0x3", "Unit": "iMC"
@@ -20,47 +20,50 @@ "BriefDescription": "write requests to memory controller. Derived from unc_m_cas_count.wr", "Counter": "0,1,2,3", "EventCode": "0x4", - "EventName": "UNC_M_CAS_COUNT.WR", + "EventName": "LLC_MISSES.MEM_WRITE", "PerPkg": "1", "UMask": "0xc", "Unit": "iMC" }, { - "BriefDescription": "Memory controller clock ticks. Used to get percentages of memory controller cycles events. Derived from unc_m_clockticks", + "BriefDescription": "Memory controller clock ticks. Used to get percentages of memory controller cycles events", "Counter": "0,1,2,3", "EventName": "UNC_M_CLOCKTICKS", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles where DRAM ranks are in power down (CKE) mode. Derived from unc_m_power_channel_ppd", + "BriefDescription": "Cycles where DRAM ranks are in power down (CKE) mode", "Counter": "0,1,2,3", "EventCode": "0x85", "EventName": "UNC_M_POWER_CHANNEL_PPD", "MetricExpr": "(UNC_M_POWER_CHANNEL_PPD / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_channel_ppd %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles all ranks are in critical thermal throttle. Derived from unc_m_power_critical_throttle_cycles", + "BriefDescription": "Cycles all ranks are in critical thermal throttle", "Counter": "0,1,2,3", "EventCode": "0x86", "EventName": "UNC_M_POWER_CRITICAL_THROTTLE_CYCLES", "MetricExpr": "(UNC_M_POWER_CRITICAL_THROTTLE_CYCLES / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_critical_throttle_cycles %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Cycles Memory is in self refresh power mode. Derived from unc_m_power_self_refresh", + "BriefDescription": "Cycles Memory is in self refresh power mode", "Counter": "0,1,2,3", "EventCode": "0x43", "EventName": "UNC_M_POWER_SELF_REFRESH", "MetricExpr": "(UNC_M_POWER_SELF_REFRESH / UNC_M_CLOCKTICKS) * 100.", + "MetricName": "power_self_refresh %", "PerPkg": "1", "Unit": "iMC" }, { - "BriefDescription": "Memory page conflicts. Derived from unc_m_pre_count.page_miss", + "BriefDescription": "Memory page conflicts", "Counter": "0,1,2,3", "EventCode": "0x2", "EventName": "UNC_M_PRE_COUNT.PAGE_MISS",
@@ -69,7 +72,7 @@ "Unit": "iMC" }, { - "BriefDescription": "Occupancy counter for memory read queue. Derived from unc_m_rpq_occupancy", + "BriefDescription": "Occupancy counter for memory read queue", "Counter": "0,1,2,3", "EventCode": "0x80", "EventName": "UNC_M_RPQ_OCCUPANCY",
tools/perf/pmu-events/arch/x86/jaketown/uncore-power.json +39 -14
238 lines not on this page · raw message
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 16/20 perf pmu: Support MetricExpr header in JSON event list
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Add support for parsing the MetricExpr header in the JSON event lists and storing them in the alias structure.
Used in the next patch.
v2: Change DividedBy to MetricExpr
v3: Really catch all uses of DividedBy
--- tools/perf/pmu-events/jevents.c | 18 ++++++++++++++---- tools/perf/pmu-events/jevents.h | 2 +- tools/perf/pmu-events/pmu-events.h | 1 + tools/perf/util/pmu.c | 9 ++++++--- tools/perf/util/pmu.h | 1 + 5 files changed, 23 insertions(+), 8 deletions(-)
tools/perf/pmu-events/jevents.c +14 -4
@@ -291,7 +291,8 @@ static void print_events_table_prefix(FILE *fp, const char *tblname)static int print_events_table_entry (void *data,char *name,char *event,char *desc,char *long_desc, -char *pmu,char *unit,char *perpkg) +char *pmu,char *unit,char *perpkg, +char *metric_expr) {struct perf_entry_data *pd = data;FILE *outfp = pd->outfp;
@@ -315,6 +316,8 @@ static int print_events_table_entry(void *data, char *name, char *event,fprintf (outfp,"\t.unit = \"%s\",\n" , unit);if (perpkg)fprintf (outfp,"\t.perpkg = \"%s\",\n" , perpkg); +if (metric_expr) +fprintf (outfp,"\t.metric_expr = \"%s\",\n" , metric_expr);fprintf (outfp,"},\n" );return 0 ;
@@ -362,7 +365,8 @@ static char *real_event(const char *name, char *event)int json_events (const char *fn,int (*func)(void *data,char *name,char *event,char *desc,char *long_desc, -char *pmu,char *unit,char *perpkg), +char *pmu,char *unit,char *perpkg, +char *metric_expr),void *data) {int err = -EIO ;
@@ -388,6 +392,7 @@ int json_events(const char *fn,char *filter =NULL ;char *perpkg =NULL ;char *unit =NULL ; +char *metric_expr =NULL ;unsigned long long eventcode =0 ;struct msrmap *msr =NULL ;jsmntok_t *msrval =NULL ;
@@ -398,6 +403,7 @@ int json_events(const char *fn,for (j =0 ; j < obj->size; j +=2 ) {jsmntok_t *field, *val;int nz; +char *s; field = tok + j; EXPECT(field->type == JSMN_STRING, tok + j,
@@ -444,7 +450,6 @@ int json_events(const char *fn, NULL); }else if (json_streq (map, field,"Unit" )) {const char *ppmu; -char *s; ppmu =field_to_perf (unit_to_pmu, map, val);if (ppmu) {
@@ -464,6 +469,10 @@ int json_events(const char *fn,addfield (map, &unit,"" ,"" , val); }else if (json_streq (map, field,"PerPkg" )) {addfield (map, &perpkg,"" ,"" , val); + }else if (json_streq (map, field,"MetricExpr" )) { +addfield (map, &metric_expr,"" ,"" , val); +for (s = metric_expr; *s; s++) + *s =tolower (*s); }/* ignore unknown fields */ }
@@ -488,7 +497,7 @@ int json_events(const char *fn,fixname (name); err =func (data, name,real_event (name, event), desc, long_desc, - pmu, unit, perpkg); + pmu, unit, perpkg, metric_expr);free (event);free (desc);free (name);
@@ -498,6 +507,7 @@ int json_events(const char *fn,free (filter);free (perpkg);free (unit); +free (metric_expr);if (err)break ; tok += j;
tools/perf/pmu-events/jevents.h +1 -1
@@ -5,7 +5,7 @@ int json_events(const char *fn,int (*func)(void *data,char *name,char *event,char *desc,char *long_desc,char *pmu, -char *unit,char *perpkg), +char *unit,char *perpkg,char *metric_expr), void *data);char *get_cpu_str (void );
tools/perf/pmu-events/pmu-events.h +1 -0
@@ -13,6 +13,7 @@ struct pmu_event {const char *pmu;const char *unit;const char *perpkg; +const char *metric_expr; };/*
tools/perf/util/pmu.c +6 -3
@@ -231,7 +231,8 @@ static int perf_pmu__parse_snapshot(struct perf_pmu_alias *alias,static int __perf_pmu__new_alias (struct list_head *list,char *dir,char *name,char *desc,char *val,char *long_desc,char *topic, -char *unit,char *perpkg) +char *unit,char *perpkg, +char *metric_expr) {struct perf_pmu_alias *alias;int ret;
@@ -265,6 +266,7 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name,perf_pmu__parse_snapshot (alias, dir, name); } + alias->metric_expr = metric_expr ?strdup (metric_expr) :NULL ; alias->desc = desc ?strdup (desc) :NULL ; alias->long_desc = long_desc ?strdup (long_desc) : desc ?strdup (desc) :NULL ;
@@ -294,7 +296,7 @@ static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FI buf[ret] =0 ;return __perf_pmu__new_alias (list, dir, name,NULL , buf,NULL ,NULL ,NULL , -NULL ); +NULL ,NULL ); }static inline bool pmu_alias_info_file (char *name)
@@ -564,7 +566,8 @@ static void pmu_add_cpu_aliases(struct list_head *head, const char *name)__perf_pmu__new_alias (head,NULL , (char *)pe->name, (char *)pe->desc, (char *)pe->event, (char *)pe->long_desc, (char *)pe->topic, - (char *)pe->unit, (char *)pe->perpkg); + (char *)pe->unit, (char *)pe->perpkg, + (char *)pe->metric_expr); } out:
tools/perf/util/pmu.h +1 -0
@@ -50,6 +50,7 @@ struct perf_pmu_alias {double scale;bool per_pkg;bool snapshot; +char *metric_expr; };struct perf_pmu *perf_pmu__find (const char *name);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 17/20 perf stat: Output JSON MetricExpr metric
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Add generic infrastructure to perf stat to output ratios for "MetricExpr" entries in the event lists. Many events are more useful as ratios than in raw form, typically some count in relation to total ticks.
Transfer the MetricExpr information from the alias to the evsel.
We mark the events that need to be collected for MetricExpr, and also link the events using them with a pointer. The code is careful to always prefer the right event in the same group to minimize multiplexing errors. At the moment only a single relation is supported.
Then add a rblist to the stat shadow code that remembers stats based on the cpu and context.
Then finally update and retrieve and print these values similarly to the existing hardcoded perf metrics. We use the simple expression parser added earlier to evaluate the expression.
Normally we just output the result without further commentary, but for --metric-only this would lead to empty columns. So for this case use the original event as description.
There is no attempt to automatically add the MetricExpr event, if it is missing, however we suggest it to the user, because the user tool doesn't have enough information to reliably construct a group that is guaranteed to schedule. So we leave that to the user.
% perf stat -a -I 1000 -e '{unc_p_clockticks,unc_p_freq_max_os_cycles}'
1.000147889 800,085,181 unc_p_clockticks
1.000147889 93,126,241 unc_p_freq_max_os_cycles # 11.6
2.000448381 800,218,217 unc_p_clockticks
2.000448381 142,516,095 unc_p_freq_max_os_cycles # 17.8
3.000639852 800,243,057 unc_p_clockticks
3.000639852 162,292,689 unc_p_freq_max_os_cycles # 20.3 % perf stat -a -I 1000 -e '{unc_p_clockticks,unc_p_freq_max_os_cycles}' --metric-only
# time freq_max_os_cycles %
1.000127077 0.9
2.000301436 0.7
3.000456379 0.0v2: Change from DivideBy to MetricExpr
v3: Use expr__ prefix. Support more than one other event.
v4: Update description
v5: Only print warning message once for multiple PMUs.
--- tools/perf/builtin-stat.c | 3 + tools/perf/util/evsel.c | 3 + tools/perf/util/evsel.h | 3 + tools/perf/util/parse-events.c | 1 + tools/perf/util/pmu.c | 2 + tools/perf/util/pmu.h | 1 + tools/perf/util/stat-shadow.c | 195 +++++++++++++++++++++++++++++++++++++++++ tools/perf/util/stat.h | 2 + 8 files changed, 210 insertions(+)
tools/perf/builtin-stat.c +3 -0
@@ -1145,6 +1145,7 @@ static void printout(int id, int nr, struct perf_evsel *counter, double uval, out.print_metric = pm; out.new_line = nl; out.ctx = &os; + out.force_header = false;if (csv_output && !metric_only) {print_noise (counter, noise);
@@ -1480,6 +1481,7 @@ static void print_metric_headers(const char *prefix, bool no_indent) out.ctx = &os; out.print_metric = print_metric_header; out.new_line = new_line_metric; + out.force_header = true; os.evsel = counter; perf_stat__print_shadow_stats(counter, 0, 0,
@@ -2498,6 +2500,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused) argc =parse_options_subcommand (argc, argv, stat_options, stat_subcommands, (const char **) stat_usage,PARSE_OPT_STOP_AT_NON_OPTION ); +perf_stat__collect_metric_expr (evsel_list);perf_stat__init_shadow_stats ();if (csv_sep) {
tools/perf/util/evsel.c +3 -0
@@ -236,6 +236,9 @@ void perf_evsel__init(struct perf_evsel *evsel, evsel->sample_size =__perf_evsel__sample_size (attr->sample_type);perf_evsel__calc_id_pos (evsel); evsel->cmdline_group_boundary = false; + evsel->metric_expr =NULL ; + evsel->metric_events =NULL ; + evsel->collect_stat = false; }struct perf_evsel *perf_evsel__new_idx (struct perf_event_attr *attr,int idx)
tools/perf/util/evsel.h +3 -0
@@ -132,6 +132,9 @@ struct perf_evsel {struct list_head config_terms;int bpf_fd;bool merged_stat; +const char * metric_expr; +struct perf_evsel **metric_events; +bool collect_stat; };union u64_swap {
tools/perf/util/parse-events.c +1 -0
@@ -1255,6 +1255,7 @@ int parse_events_add_pmu(struct parse_events_evlist *data, evsel->scale = info.scale; evsel->per_pkg = info.per_pkg; evsel->snapshot = info.snapshot; + evsel->metric_expr = info.metric_expr; }return evsel ?0 : -ENOMEM ;
tools/perf/util/pmu.c +2 -0
@@ -994,6 +994,7 @@ int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms, info->unit =NULL ; info->scale =0.0 ; info->snapshot = false; + info->metric_expr =NULL ;list_for_each_entry_safe (term, h, head_terms, list) { alias =pmu_find_alias (pmu, term);
@@ -1009,6 +1010,7 @@ int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms,if (alias->per_pkg) info->per_pkg = true; + info->metric_expr = alias->metric_expr;list_del (&term->list);free (term);
tools/perf/util/pmu.h +1 -0
@@ -31,6 +31,7 @@ struct perf_pmu {struct perf_pmu_info {const char *unit; +const char *metric_expr;double scale;bool per_pkg;bool snapshot;
tools/perf/util/stat-shadow.c +195 -0
244 lines not on this page · raw message
tools/perf/util/stat.h +2 -0
@@ -85,11 +85,13 @@ struct perf_stat_output_ctx {void *ctx;print_metric_t print_metric;new_line_t new_line; +bool force_header; };void perf_stat__print_shadow_stats (struct perf_evsel *evsel,double avg,int cpu,struct perf_stat_output_ctx *out); +void perf_stat__collect_metric_expr (struct perf_evlist *);int perf_evlist__alloc_stats (struct perf_evlist *evlist,bool alloc_raw);void perf_evlist__free_stats (struct perf_evlist *evlist);
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 18/20 perf list: Support printing MetricExpr with --debug
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Output the metric expr in perf list when --debug is specified, so that the user can check the formula.
Before:
% perf list
...
unc_m_power_channel_ppd
[Cycles where DRAM ranks are in power down (CKE) mode. Derived from unc_m_power_channel_ppd. Unit:
uncore_imc]
uncore_imc_2/event=0x85/After:
% perf list --debug
...
unc_m_power_channel_ppd
[Cycles where DRAM ranks are in power down (CKE) mode. Derived from unc_m_power_channel_ppd. Unit:
uncore_imc]
Perf: uncore_imc_2/event=0x85/ MetricExpr: (unc_m_power_channel_ppd / unc_m_clockticks) * 100.--- tools/perf/util/pmu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
tools/perf/util/pmu.c +8 -2
@@ -1105,6 +1105,7 @@ struct sevent {char *topic;char *str;char *pmu; +char *metric_expr; };static int cmp_sevent (const void *a,const void *b)
@@ -1203,6 +1204,7 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, aliases[j].topic = alias->topic; aliases[j].str = alias->str; aliases[j].pmu = pmu->name; + aliases[j].metric_expr = alias->metric_expr; j++; } if (pmu->selectable &&
@@ -1237,8 +1239,12 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag,printf ("%*s" ,8 ,"[" );wordwrap (aliases[j].desc,8 , columns,0 );printf ("]\n" ); -if (verbose >0 ) -printf ("%*s%s/%s/\n" ,8 ,"" , aliases[j].pmu, aliases[j].str); +if (verbose >0 ) { +printf ("%*s%s/%s/ " ,8 ,"" , aliases[j].pmu, aliases[j].str); +if (aliases[j].metric_expr) +printf (" MetricExpr: %s" , aliases[j].metric_expr); +putchar ('\n' ); + } }else printf (" %-50s [Kernel PMU event]\n" , aliases[j].name); printed++;
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 19/20 perf pmu: Add support for MetricName JSON attribute
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Add support for a new JSON event attribute to name MetricExpr for better output in perf stat.
If the event has no MetricName it uses the normal event name instead to describe the metric.
Before
% perf stat -a -I 1000 -e '{unc_p_clockticks,unc_p_freq_max_os_cycles}' --metric-only
time unc_p_freq_max_os_cycles
1.000149775 15.7
2.000344807 19.3
3.000502544 16.7
4.000640656 6.6
5.000779955 9.9After
% perf stat -a -I 1000 -e '{unc_p_clockticks,unc_p_freq_max_os_cycles}' --metric-only
time freq_max_os_cycles %
1.000149775 15.7
2.000344807 19.3
3.000502544 16.7
4.000640656 6.6
5.000779955 9.9--- tools/perf/pmu-events/jevents.c | 14 +++++++++++--- tools/perf/pmu-events/jevents.h | 3 ++- tools/perf/pmu-events/pmu-events.h | 1 + tools/perf/util/evsel.c | 1 + tools/perf/util/evsel.h | 1 + tools/perf/util/parse-events.c | 1 + tools/perf/util/pmu.c | 15 ++++++++++++--- tools/perf/util/pmu.h | 2 ++ tools/perf/util/stat-shadow.c | 4 +++- 9 files changed, 34 insertions(+), 8 deletions(-)
tools/perf/pmu-events/jevents.c +11 -3
@@ -292,7 +292,8 @@ static void print_events_table_prefix(FILE *fp, const char *tblname)static int print_events_table_entry (void *data,char *name,char *event,char *desc,char *long_desc,char *pmu,char *unit,char *perpkg, -char *metric_expr) +char *metric_expr, +char *metric_name) {struct perf_entry_data *pd = data;FILE *outfp = pd->outfp;
@@ -318,6 +319,8 @@ static int print_events_table_entry(void *data, char *name, char *event,fprintf (outfp,"\t.perpkg = \"%s\",\n" , perpkg);if (metric_expr)fprintf (outfp,"\t.metric_expr = \"%s\",\n" , metric_expr); +if (metric_name) +fprintf (outfp,"\t.metric_name = \"%s\",\n" , metric_name);fprintf (outfp,"},\n" );return 0 ;
@@ -366,7 +369,8 @@ int json_events(const char *fn,int (*func)(void *data,char *name,char *event,char *desc,char *long_desc,char *pmu,char *unit,char *perpkg, -char *metric_expr), +char *metric_expr, +char *metric_name), void *data) { int err = -EIO;
@@ -393,6 +397,7 @@ int json_events(const char *fn,char *perpkg =NULL ;char *unit =NULL ;char *metric_expr =NULL ; +char *metric_name =NULL ;unsigned long long eventcode =0 ;struct msrmap *msr =NULL ;jsmntok_t *msrval =NULL ;
@@ -469,6 +474,8 @@ int json_events(const char *fn,addfield (map, &unit,"" ,"" , val); }else if (json_streq (map, field,"PerPkg" )) {addfield (map, &perpkg,"" ,"" , val); + }else if (json_streq (map, field,"MetricName" )) { +addfield (map, &metric_name,"" ,"" , val); }else if (json_streq (map, field,"MetricExpr" )) {addfield (map, &metric_expr,"" ,"" , val);for (s = metric_expr; *s; s++)
@@ -497,7 +504,7 @@ int json_events(const char *fn,fixname (name); err =func (data, name,real_event (name, event), desc, long_desc, - pmu, unit, perpkg, metric_expr); + pmu, unit, perpkg, metric_expr, metric_name);free (event);free (desc);free (name);
@@ -508,6 +515,7 @@ int json_events(const char *fn,free (perpkg);free (unit);free (metric_expr); +free (metric_name);if (err)break ; tok += j;
tools/perf/pmu-events/jevents.h +2 -1
@@ -5,7 +5,8 @@ int json_events(const char *fn,int (*func)(void *data,char *name,char *event,char *desc,char *long_desc,char *pmu, -char *unit,char *perpkg,char *metric_expr), +char *unit,char *perpkg,char *metric_expr, +char *metric_name), void *data);char *get_cpu_str (void );
tools/perf/pmu-events/pmu-events.h +1 -0
@@ -14,6 +14,7 @@ struct pmu_event {const char *unit;const char *perpkg;const char *metric_expr; +const char *metric_name; };/*
tools/perf/util/evsel.c +1 -0
@@ -237,6 +237,7 @@ void perf_evsel__init(struct perf_evsel *evsel,perf_evsel__calc_id_pos (evsel); evsel->cmdline_group_boundary = false; evsel->metric_expr =NULL ; + evsel->metric_name =NULL ; evsel->metric_events =NULL ; evsel->collect_stat = false; }
tools/perf/util/evsel.h +1 -0
@@ -133,6 +133,7 @@ struct perf_evsel {int bpf_fd;bool merged_stat;const char * metric_expr; +const char * metric_name;struct perf_evsel **metric_events;bool collect_stat; };
tools/perf/util/parse-events.c +1 -0
@@ -1256,6 +1256,7 @@ int parse_events_add_pmu(struct parse_events_evlist *data, evsel->per_pkg = info.per_pkg; evsel->snapshot = info.snapshot; evsel->metric_expr = info.metric_expr; + evsel->metric_name = info.metric_name; }return evsel ?0 : -ENOMEM ;
tools/perf/util/pmu.c +12 -3
@@ -232,7 +232,8 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, char *desc, char *val, char *long_desc, char *topic, char *unit, char *perpkg, - char *metric_expr) + char *metric_expr, + char *metric_name) { struct perf_pmu_alias *alias;int ret;
@@ -267,6 +268,7 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, } alias->metric_expr = metric_expr ?strdup (metric_expr) :NULL ; + alias->metric_name = metric_name ?strdup (metric_name):NULL ; alias->desc = desc ?strdup (desc) :NULL ; alias->long_desc = long_desc ?strdup (long_desc) : desc ?strdup (desc) :NULL ;
@@ -296,7 +298,7 @@ static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FI buf[ret] =0 ;return __perf_pmu__new_alias (list, dir, name,NULL , buf,NULL ,NULL ,NULL , -NULL ,NULL ); +NULL ,NULL ,NULL ); }static inline bool pmu_alias_info_file (char *name)
@@ -567,7 +569,8 @@ static void pmu_add_cpu_aliases(struct list_head *head, const char *name) (char *)pe->desc, (char *)pe->event, (char *)pe->long_desc, (char *)pe->topic, (char *)pe->unit, (char *)pe->perpkg, - (char *)pe->metric_expr); + (char *)pe->metric_expr, + (char *)pe->metric_name); } out:
@@ -995,6 +998,7 @@ int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms, info->scale =0.0 ; info->snapshot = false; info->metric_expr =NULL ; + info->metric_name =NULL ;list_for_each_entry_safe (term, h, head_terms, list) { alias =pmu_find_alias (pmu, term);
@@ -1011,6 +1015,7 @@ int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms,if (alias->per_pkg) info->per_pkg = true; info->metric_expr = alias->metric_expr; + info->metric_name = alias->metric_name;list_del (&term->list);free (term);
@@ -1106,6 +1111,7 @@ struct sevent {char *str;char *pmu;char *metric_expr; +char *metric_name; };static int cmp_sevent (const void *a,const void *b)
@@ -1205,6 +1211,7 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, aliases[j].str = alias->str; aliases[j].pmu = pmu->name; aliases[j].metric_expr = alias->metric_expr; + aliases[j].metric_name = alias->metric_name; j++; } if (pmu->selectable &&
@@ -1241,6 +1248,8 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag,printf ("]\n" );if (verbose >0 ) {printf ("%*s%s/%s/ " ,8 ,"" , aliases[j].pmu, aliases[j].str); +if (aliases[j].metric_name) +printf (" MetricName: %s" , aliases[j].metric_name);if (aliases[j].metric_expr)printf (" MetricExpr: %s" , aliases[j].metric_expr);putchar ('\n' );
tools/perf/util/pmu.h +2 -0
@@ -32,6 +32,7 @@ struct perf_pmu {struct perf_pmu_info {const char *unit;const char *metric_expr; +const char *metric_name;double scale;bool per_pkg;bool snapshot;
@@ -52,6 +53,7 @@ struct perf_pmu_alias {bool per_pkg;bool snapshot;char *metric_expr; +char *metric_name; };struct perf_pmu *perf_pmu__find (const char *name);
tools/perf/util/stat-shadow.c +3 -1
@@ -803,7 +803,9 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,if (expr__parse (&ratio, &pctx, &p) ==0 )print_metric (ctxp,NULL ,"%8.1f" , - out->force_header ? evsel->name :"" , + evsel->metric_name ? + evsel->metric_name : + out->force_header ? evsel->name :"" , ratio);else print_metric (ctxp,NULL ,NULL ,"" ,0 );
Signature · 1 line
2.9.3
Arnaldo Carvalho de Melo
maintainerPATCH 20/20 perf list: Move extra details printing to new option
In reply to Arnaldo Carvalho de MeloFrom: Andi Kleen <[email protected]>
Move the printing of perf expressions and internal events to a new clearer --details flag, instead of lumping it together with other debug options in --debug. This makes it clearer to use.
Before
perf list --debug
...
unc_m_power_critical_throttle_cycles
[Cycles all ranks are in critical thermal throttle. Unit: uncore_imc]
uncore_imc_2/event=0x86/ MetricName: power_critical_throttle_cycles % MetricExpr: (unc_m_power_critical_throttle_cycles / unc_m_clockticks) * 100.
after
perf list --details
...
unc_m_power_critical_throttle_cycles
[Cycles all ranks are in critical thermal throttle. Unit: uncore_imc]
uncore_imc_2/event=0x86/ MetricName: power_critical_throttle_cycles % MetricExpr: (unc_m_power_critical_throttle_cycles / unc_m_clockticks) * 100.
--- tools/perf/Documentation/perf-list.txt | 4 ++++ tools/perf/builtin-list.c | 14 ++++++++++---- tools/perf/util/parse-events.c | 5 +++-- tools/perf/util/parse-events.h | 2 +- tools/perf/util/pmu.c | 4 ++-- tools/perf/util/pmu.h | 2 +- 6 files changed, 21 insertions(+), 10 deletions(-)
tools/perf/Documentation/perf-list.txt +4 -0
@@ -24,6 +24,10 @@ Don't print descriptions. --long-desc:: Print longer event descriptions. +--details:: +Print how named events are resolved internally into perf events, and also +any extra expressions computed by perf stat. + [[EVENT_MODIFIERS]] EVENT MODIFIERS
tools/perf/builtin-list.c +10 -4
@@ -18,6 +18,7 @@#include <subcmd/parse-options.h> static bool desc_flag = true; +static bool details_flag;int cmd_list (int argc,const char **argv,const char *prefix__maybe_unused ) {
@@ -30,6 +31,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) "Print extra event descriptions. --no-desc to not print."),OPT_BOOLEAN ('v' ,"long-desc" , &long_desc_flag,"Print longer event descriptions." ), +OPT_BOOLEAN (0 ,"details" , &details_flag, +"Print information on the perf event names and expressions used internally by events." ),OPT_INCR (0 ,"debug" , &verbose,"Enable debugging output" ),OPT_END ()
@@ -50,7 +53,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)printf ("\nList of pre-defined events (to be used in -e):\n\n" );if (argc ==0 ) { -print_events (NULL , raw_dump, !desc_flag, long_desc_flag); +print_events (NULL , raw_dump, !desc_flag, long_desc_flag, + details_flag);return 0 ; }
@@ -72,7 +76,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)print_hwcache_events (NULL , raw_dump); else if (strcmp(argv[i], "pmu") == 0)print_pmu_events (NULL , raw_dump, !desc_flag, - long_desc_flag); + long_desc_flag, details_flag); else if (strcmp(argv[i], "sdt") == 0) print_sdt_events(NULL, NULL, raw_dump); else if ((sep = strchr(argv[i], ':')) != NULL) {
@@ -80,7 +84,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)if (sep ==NULL ) {print_events (argv[i], raw_dump, !desc_flag, - long_desc_flag); + long_desc_flag, + details_flag);continue ; } sep_idx = sep - argv[i];
@@ -103,7 +108,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) event_symbols_sw, PERF_COUNT_SW_MAX, raw_dump);print_hwcache_events (s, raw_dump);print_pmu_events (s, raw_dump, !desc_flag, - long_desc_flag); + long_desc_flag, + details_flag);print_tracepoint_events (NULL , s, raw_dump);print_sdt_events (NULL , s, raw_dump);free (s);
tools/perf/util/parse-events.c +3 -2
@@ -2325,7 +2325,7 @@ void print_symbol_events(const char *event_glob, unsigned type,* Print the help text for the event symbols: */ void print_events (const char *event_glob,bool name_only,bool quiet_flag, -bool long_desc) +bool long_desc,bool details_flag) {print_symbol_events (event_glob,PERF_TYPE_HARDWARE , event_symbols_hw,PERF_COUNT_HW_MAX , name_only);
@@ -2335,7 +2335,8 @@ void print_events(const char *event_glob, bool name_only, bool quiet_flag,print_hwcache_events (event_glob, name_only); -print_pmu_events (event_glob, name_only, quiet_flag, long_desc); +print_pmu_events (event_glob, name_only, quiet_flag, long_desc, + details_flag);if (event_glob !=NULL )return ;
tools/perf/util/parse-events.h +1 -1
@@ -184,7 +184,7 @@ void parse_events_evlist_error(struct parse_events_evlist *data, int idx, const char *str);void print_events (const char *event_glob,bool name_only,bool quiet, -bool long_desc); +bool long_desc,bool details_flag);struct event_symbol {const char *symbol;
tools/perf/util/pmu.c +2 -2
@@ -1154,7 +1154,7 @@ static void wordwrap(char *s, int start, int max, int corr) }void print_pmu_events (const char *event_glob,bool name_only,bool quiet_flag, -bool long_desc) +bool long_desc,bool details_flag) {struct perf_pmu *pmu;struct perf_pmu_alias *alias;
@@ -1246,7 +1246,7 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag,printf ("%*s" ,8 ,"[" );wordwrap (aliases[j].desc,8 , columns,0 );printf ("]\n" ); -if (verbose >0 ) { +if (details_flag) {printf ("%*s%s/%s/ " ,8 ,"" , aliases[j].pmu, aliases[j].str);if (aliases[j].metric_name)printf (" MetricName: %s" , aliases[j].metric_name);
tools/perf/util/pmu.h +1 -1
@@ -80,7 +80,7 @@ int perf_pmu__format_parse(char *dir, struct list_head *head);struct perf_pmu *perf_pmu__scan (struct perf_pmu *pmu);void print_pmu_events (const char *event_glob,bool name_only,bool quiet, -bool long_desc); +bool long_desc,bool details_flag);bool pmu_have_event (const char *pname,const char *name); int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt,
Signature · 1 line
2.9.3
Quoted 135 lines · Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit
267dd0a07eefbb37264fcfad984fffc8856898ad:Merge tag 'perf-core-for-mingo-4.12-20170320' of
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linuxinto perf/core (2017-03-21 07:41:29 +0100)are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gittags/perf-core-for-mingo-4.12-20170324for you to fetch changes up to
bf874fcf9f2fed58510dc83abcee388cee2b427e:perf list: Move extra details printing to new option (2017-03-23 11:42:31 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:User visible:
- Allow suppressing '
uncore_' when specifying PMU events (Andi Kleen)- Collapse identically named PMU events in 'perf stat', allow not merging it via --no-merge (Andi Kleen)
Fixes:
- Use more precise 'grep -v' to suppress unwanted 'objdump -dS' disassembly output to not ditch line:number lines needed by 'perf annotate --print-lines' logic (Taeung Song)
Infrastructure:
- SDT (Statically Defined Tracing)/uprobes_events arguments improvements (Alexis Berlemont, Ravi Bangoria)
- Improvements for the handling of JSON described vendor events, including having an expression parser to calculate metrics from multiple vendor events (Andi Kleen)
- Update Intel JSON vendor event files (Andi Kleen)
- Restore error reporting in 'perf probe -d' when none of the events requested to be deleted exist. (Kefeng Wang)
- Bump
MAX_CMDLENin 'perf probe' to match what the kernel accepts (Ravi Bangoria)Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Alexis Berlemont (2):
perf sdt: Add scanning of sdt probes arguments
perf probe: Add sdt probes arguments into the uprobe cmd stringAndi Kleen (13):
perf stat: Factor out callback for collecting event values perf stat: Collapse identically named events
perf stat: Handle partially bad results with merging perf tools: Factor out PMU matching in parser
perf pmu: Expand PMU events by prefix match
perf pmu: Special caseuncore_prefix
perf tools: Add a simple expression parser for JSON perf vendor events intel: Update Intel uncore JSON event files perf pmu: Support MetricExpr header in JSON event list perf stat: Output JSON MetricExpr metric
perf list: Support printing MetricExpr with --debug perf pmu: Add support for MetricName JSON attribute perf list: Move extra details printing to new optionArnaldo Carvalho de Melo (1):
perf annotate: Add comment clarifying how the source code line is parsedKefeng Wang (1):
perf probe: Return errno when not hitting any eventRavi Bangoria (2):
perf probe: ChangeMAX_CMDLEN
perf sdt x86: Add renaming logic for rNN and other registersTaeung Song (1):
perf annotate: More exactly grep -v of the objdump commandtools/perf/Documentation/perf-list.txt | 4 + tools/perf/Documentation/perf-stat.txt | 3 + tools/perf/arch/x86/util/perf_regs.c | 103 +++++++++++ tools/perf/builtin-list.c | 14 +- tools/perf/builtin-probe.c | 6 +- tools/perf/builtin-stat.c | 146 ++++++++++++--- .../arch/x86/broadwellde/uncore-cache.json | 28 +-- .../arch/x86/broadwellde/uncore-memory.json | 26 ++- .../arch/x86/broadwellde/uncore-power.json | 26 ++- .../arch/x86/broadwellx/uncore-cache.json | 28 +-- .../arch/x86/broadwellx/uncore-interconnect.json | 6 +- .../arch/x86/broadwellx/uncore-memory.json | 21 ++- .../arch/x86/broadwellx/uncore-power.json | 26 ++- .../pmu-events/arch/x86/haswellx/uncore-cache.json | 28 +-- .../arch/x86/haswellx/uncore-interconnect.json | 6 +- .../arch/x86/haswellx/uncore-memory.json | 21 ++- .../pmu-events/arch/x86/haswellx/uncore-power.json | 26 ++- .../pmu-events/arch/x86/ivytown/uncore-cache.json | 22 +-- .../arch/x86/ivytown/uncore-interconnect.json | 12 +- .../pmu-events/arch/x86/ivytown/uncore-memory.json | 19 +- .../pmu-events/arch/x86/ivytown/uncore-power.json | 53 ++++-- .../pmu-events/arch/x86/jaketown/uncore-cache.json | 13 +- .../arch/x86/jaketown/uncore-interconnect.json | 12 +- .../arch/x86/jaketown/uncore-memory.json | 21 ++- .../pmu-events/arch/x86/jaketown/uncore-power.json | 53 ++++-- tools/perf/pmu-events/jevents.c | 26 ++- tools/perf/pmu-events/jevents.h | 3 +- tools/perf/pmu-events/pmu-events.h | 2 + tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c | 4 + tools/perf/tests/expr.c | 56 ++++++ tools/perf/tests/tests.h | 1 + tools/perf/util/Build | 6 + tools/perf/util/annotate.c | 8 +- tools/perf/util/evsel.c | 4 + tools/perf/util/evsel.h | 5 + tools/perf/util/expr.h | 25 +++ tools/perf/util/expr.y | 173 ++++++++++++++++++ tools/perf/util/parse-events.c | 78 +++++++- tools/perf/util/parse-events.h | 10 +- tools/perf/util/parse-events.y | 73 ++++---- tools/perf/util/perf_regs.c | 6 + tools/perf/util/perf_regs.h | 6 + tools/perf/util/pmu.c | 32 +++- tools/perf/util/pmu.h | 6 +- tools/perf/util/probe-event.c | 1 - tools/perf/util/probe-file.c | 173 +++++++++++++++++-
Quoted 8 lines
tools/perf/util/stat-shadow.c | 197 +++++++++++++++++++++ tools/perf/util/stat.h | 2 + tools/perf/util/symbol-elf.c | 25 ++- tools/perf/util/symbol.h | 1 + 51 files changed, 1370 insertions(+), 277 deletions(-) create mode 100644 tools/perf/tests/expr.c create mode 100644 tools/perf/util/expr.h create mode 100644 tools/perf/util/expr.y
Pulled, thanks a lot Arnaldo!
Ingo