The source for the Linux kernel used in Windows Subsystem for Linux 2 (WSL2)
Перейти к файлу
Ian Rogers 40769665b6 perf jevents: Parse metrics during conversion
Currently the 'MetricExpr' json value is passed from the json
file to the pmu-events.c. This change introduces an expression
tree that is parsed into. The parsing is done largely by using
operator overloading and python's 'eval' function. Two advantages
in doing this are:

1) Broken metrics fail at compile time rather than relying on
   `perf test` to detect. `perf test` remains relevant for checking
   event encoding and actual metric use.

2) The conversion to a string from the tree can minimize the metric's
   string size, for example, preferring 1e6 over 1000000, avoiding
   multiplication by 1 and removing unnecessary whitespace. On x86
   this reduces the string size by 2,930bytes (0.07%).

In future changes it would be possible to programmatically
generate the json expressions (a single line of text and so a
pain to write manually) for an architecture using the expression
tree. This could avoid copy-pasting metrics for all architecture
variants.

v4. Doesn't simplify "0*SLOTS" to 0, as the pattern is used to fix
    Intel metrics with topdown events.
v3. Avoids generic types on standard types like set that aren't
    supported until Python 3.9, fixing an issue with Python 3.6
    reported-by John Garry. v3 also fixes minor pylint issues and adds
    a call to Simplify on the read expression tree.
v2. Improvements to type information.

Committer notes:

Added one-line fixer from Ian, see first Link: tag below.

Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Link: https://lore.kernel.org/r/CAP-5=fWa=zNK_ecpWGoGggHCQx7z-oW0eGMQf19Maywg0QK=4g@mail.gmail.com
Link: https://lore.kernel.org/r/20221207055908.1385448-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-12-14 11:16:12 -03:00
Documentation Input updates for v6.1-rc5 2022-11-18 17:56:29 -08:00
LICENSES
arch - Do not hold fpregs lock when inheriting FPU permissions because the 2022-11-20 10:47:39 -08:00
block block-6.1-2022-11-18 2022-11-18 13:59:45 -08:00
certs
crypto
drivers spi: Fixes for v6.1 2022-11-23 11:19:06 -08:00
fs fscache: fix OOB Read in __fscache_acquire_volume 2022-11-23 10:31:13 -08:00
include fscache: fix OOB Read in __fscache_acquire_volume 2022-11-23 10:31:13 -08:00
init
io_uring io_uring: disallow self-propelled ring polling 2022-11-18 09:29:31 -07:00
ipc
kernel tracing/probes: Fixes for v6.1 2022-11-20 15:31:20 -08:00
lib
mm Networking fixes for 6.1-rc6, including fixes from bpf 2022-11-17 08:58:36 -08:00
net 9p-for-6.1-rc7 2022-11-23 11:06:09 -08:00
rust
samples
scripts kbuild: Restore .version auto-increment behaviour for Debian packages 2022-11-17 17:51:45 +09:00
security
sound
tools perf jevents: Parse metrics during conversion 2022-12-14 11:16:12 -03:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap sound fixes for 6.1-rc6 2022-11-18 09:52:10 -08:00
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS Merge remote-tracking branch 'torvalds/master' into perf/core 2022-11-24 10:08:03 -03:00
Makefile Linux 6.1-rc6 2022-11-20 16:02:16 -08:00
README

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.