From fa831fbb430853ad8c1abb18001dc87bed3cf52b Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Fri, 15 Oct 2021 10:21:16 -0700 Subject: perf metric: Move runtime value to the expr context The runtime value is needed when recursively parsing metrics, currently a value of 1 is passed which is incorrect. Rather than add more arguments to the bison parser, add runtime to the context. Fix call sites not to pass a value. The runtime value is defaulted to 0, which is arbitrary. In some places this replaces a value of 1, which was also arbitrary. This shouldn't affect anything other than PPC. The use of 0 or 1 shouldn't matter as a proper runtime value would be needed in a case that it did matter. Signed-off-by: Ian Rogers Acked-by: Andi Kleen Cc: Adrian Hunter Cc: Alexander Antonov Cc: Alexander Shishkin Cc: Andrew Kilroy Cc: Andrew Morton Cc: Changbin Du Cc: Denys Zagorui Cc: Fabian Hemmer Cc: Felix Fietkau Cc: Heiko Carstens Cc: Ingo Molnar Cc: Jacob Keller Cc: Jiapeng Chong Cc: Jin Yao Cc: Jiri Olsa Cc: Joakim Zhang Cc: John Garry Cc: Kajol Jain Cc: Kan Liang Cc: Kees Kook Cc: Mark Rutland Cc: Namhyung Kim Cc: Nicholas Fraser Cc: Nick Desaulniers Cc: Paul Clarke Cc: Peter Zijlstra Cc: Riccardo Mancini Cc: Sami Tolvanen Cc: ShihCheng Tu Cc: Song Liu Cc: Stephane Eranian Cc: Sumanth Korikkar Cc: Thomas Richter Cc: Wan Jiabing Cc: Zhen Lei Link: https://lore.kernel.org/r/20211015172132.1162559-6-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/expr.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools/perf/util/expr.h') diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h index b20513f0ae59..124475a4f245 100644 --- a/tools/perf/util/expr.h +++ b/tools/perf/util/expr.h @@ -21,6 +21,7 @@ struct expr_id { struct expr_parse_ctx { struct hashmap *ids; struct expr_id *parent; + int runtime; }; struct expr_id_data; @@ -52,10 +53,10 @@ 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); + const char *expr); int expr__find_ids(const char *expr, const char *one, - struct expr_parse_ctx *ids, int runtime); + struct expr_parse_ctx *ids); double expr_id_data__value(const struct expr_id_data *data); struct expr_id *expr_id_data__parent(struct expr_id_data *data); -- cgit v1.2.3-59-g8ed1b