diff options
| author | Ian Rogers <irogers@google.com> | 2025-11-12 00:22:06 +0300 |
|---|---|---|
| committer | Namhyung Kim <namhyung@kernel.org> | 2025-11-12 03:48:36 +0300 |
| commit | 68cc6ec3ac2960f0871421c16e49cba826fdff52 (patch) | |
| tree | fb0fbf0f0ba2cacca8f613a877b0b51fc2462553 /tools/perf/util/expr.c | |
| parent | 02432d920e3b174ff44a9fabb82fc8316f236a65 (diff) | |
| download | linux-68cc6ec3ac2960f0871421c16e49cba826fdff52.tar.xz | |
perf tool_pmu: Make core_wide and target_cpu json events
For the sake of better documentation, add core_wide and target_cpu to
the tool.json. When the values of system_wide and
user_requested_cpu_list are unknown, use the values from the global
stat_config.
Example output showing how '-a' modifies the values in `perf stat`:
```
$ perf stat -e core_wide,target_cpu true
Performance counter stats for 'true':
0 core_wide
0 target_cpu
0.000993787 seconds time elapsed
0.001128000 seconds user
0.000000000 seconds sys
$ perf stat -e core_wide,target_cpu -a true
Performance counter stats for 'system wide':
1 core_wide
1 target_cpu
0.002271723 seconds time elapsed
$ perf list
...
tool:
core_wide
[1 if not SMT,if SMT are events being gathered on all SMT threads 1 otherwise 0. Unit: tool]
...
target_cpu
[1 if CPUs being analyzed,0 if threads/processes. Unit: tool]
...
```
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util/expr.c')
| -rw-r--r-- | tools/perf/util/expr.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c index 4df56f2b283d..465fe2e9bbbe 100644 --- a/tools/perf/util/expr.c +++ b/tools/perf/util/expr.c @@ -401,17 +401,12 @@ double expr__get_literal(const char *literal, const struct expr_scanner_ctx *ctx if (ev != TOOL_PMU__EVENT_NONE) { u64 count; - if (tool_pmu__read_event(ev, /*evsel=*/NULL, &count)) + if (tool_pmu__read_event(ev, /*evsel=*/NULL, + ctx->system_wide, ctx->user_requested_cpu_list, + &count)) result = count; else pr_err("Failure to read '%s'", literal); - - } else if (!strcmp("#core_wide", literal)) { - result = core_wide(ctx->system_wide, ctx->user_requested_cpu_list) - ? 1.0 : 0.0; - } else if (!strcmp("#target_cpu", literal)) { - result = (ctx->system_wide || ctx->user_requested_cpu_list) - ? 1.0 : 0.0; } else { pr_err("Unrecognized literal '%s'", literal); } |
