summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/expr.h
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2020-07-19 20:13:12 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-07-30 07:01:49 -0300
commitacf71b05d1a19726594a8436ba9d8af871941e6c (patch)
tree2accfa42f619cd1ab1032a094abefd5331fae1d4 /tools/perf/util/expr.h
parentfc393839c11bbe2c7f1a44ab34e5f2a219d8366e (diff)
downloadlinux-stable-acf71b05d1a19726594a8436ba9d8af871941e6c.tar.gz
linux-stable-acf71b05d1a19726594a8436ba9d8af871941e6c.tar.bz2
linux-stable-acf71b05d1a19726594a8436ba9d8af871941e6c.zip
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 <jolsa@kernel.org> Reviewed-by: Kajol Jain <kjain@linux.ibm.com> Acked-by: Ian Rogers <irogers@google.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: John Garry <john.garry@huawei.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Clarke <pc@us.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20200719181320.785305-12-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/expr.h')
-rw-r--r--tools/perf/util/expr.h3
1 files changed, 3 insertions, 0 deletions
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,