From acf71b05d1a19726594a8436ba9d8af871941e6c Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Sun, 19 Jul 2020 20:13:12 +0200 Subject: perf metric: Compute referenced metrics Adding computation (expr__parse call) of referenced metric at the point when it needs to be resolved during the parent metric computation. Once the inner metric is computed, the result is stored and used if there's another usage of that metric. Signed-off-by: Jiri Olsa Reviewed-by: Kajol Jain Acked-by: Ian Rogers Cc: Alexander Shishkin Cc: Andi Kleen Cc: John Garry Cc: Michael Petlan Cc: Namhyung Kim Cc: Paul Clarke Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lore.kernel.org/lkml/20200719181320.785305-12-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/expr.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools/perf/util/expr.h') diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h index 81d04ff7f857..9ed208d93418 100644 --- a/tools/perf/util/expr.h +++ b/tools/perf/util/expr.h @@ -23,6 +23,7 @@ struct expr_id_data { struct { const char *metric_name; const char *metric_expr; + bool counted; } ref; }; @@ -42,6 +43,8 @@ int expr__add_id_val(struct expr_parse_ctx *ctx, const char *id, double val); int expr__add_ref(struct expr_parse_ctx *ctx, struct metric_ref *ref); int expr__get_id(struct expr_parse_ctx *ctx, const char *id, struct expr_id_data **data); +int expr__resolve_id(struct expr_parse_ctx *ctx, const char *id, + struct expr_id_data **datap); int expr__parse(double *final_val, struct expr_parse_ctx *ctx, const char *expr, int runtime); int expr__find_other(const char *expr, const char *one, -- cgit v1.2.3