From: Ian Rogers Date: Tue, 11 Nov 2025 21:21:50 +0000 (-0800) Subject: perf expr: Add #target_cpu literal X-Git-Tag: v6.19-rc1~61^2~135 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e5140849b021889cf4dd8df5d2352e508213607;p=thirdparty%2Flinux.git perf expr: Add #target_cpu literal For CPU nanoseconds a lot of the stat-shadow metrics use either task-clock or cpu-clock, the latter being used when target__has_cpu. Add a #target_cpu literal so that json metrics can perform the same test. Signed-off-by: Ian Rogers Signed-off-by: Namhyung Kim --- diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c index 7fda0ff89c168..4df56f2b283d6 100644 --- a/tools/perf/util/expr.c +++ b/tools/perf/util/expr.c @@ -409,6 +409,9 @@ double expr__get_literal(const char *literal, const struct expr_scanner_ctx *ctx } 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); }