]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf tool_pmu: Move expr literals to tool_pmu
authorIan Rogers <irogers@google.com>
Wed, 2 Oct 2024 03:20:10 +0000 (20:20 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 11 Oct 2024 06:40:32 +0000 (23:40 -0700)
commit069057239a676a82cce9330a81994129179dc817
tree68cc1932de60a3d9c992418a97276f9dcc44af1c
parentb8f1a1b0680c055bbe9f99e82e2e5b474621a1d6
perf tool_pmu: Move expr literals to tool_pmu

Add the expr literals like "#smt_on" as tool events, this allows stat
events to give the values. On my laptop with hyperthreading enabled:

```
$ perf stat -e "has_pmem,num_cores,num_cpus,num_cpus_online,num_dies,num_packages,smt_on,system_tsc_freq" true

 Performance counter stats for 'true':

                 0      has_pmem
                 8      num_cores
                16      num_cpus
                16      num_cpus_online
                 1      num_dies
                 1      num_packages
                 1      smt_on
     2,496,000,000      system_tsc_freq

       0.001113637 seconds time elapsed

       0.001218000 seconds user
       0.000000000 seconds sys
```

And with hyperthreading disabled:
```
$ perf stat -e "has_pmem,num_cores,num_cpus,num_cpus_online,num_dies,num_packages,smt_on,system_tsc_freq" true

 Performance counter stats for 'true':

                 0      has_pmem
                 8      num_cores
                16      num_cpus
                 8      num_cpus_online
                 1      num_dies
                 1      num_packages
                 0      smt_on
     2,496,000,000      system_tsc_freq

       0.000802115 seconds time elapsed

       0.000000000 seconds user
       0.000806000 seconds sys
```

As zero matters for these values, in stat-display
should_skip_zero_counter only skip the zero value if it is not the
first aggregation index.

The tool event implementations are used in expr but not evaluated as
events for simplicity. Also core_wide isn't made a tool event as it
requires command line parameters.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20241002032016.333748-8-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/arch/arm64/util/pmu.c
tools/perf/arch/x86/util/tsc.c
tools/perf/util/expr.c
tools/perf/util/pmu.c
tools/perf/util/pmu.h
tools/perf/util/stat-display.c
tools/perf/util/stat-shadow.c
tools/perf/util/tool_pmu.c
tools/perf/util/tool_pmu.h
tools/perf/util/tsc.h