aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/expr.h
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2020-07-19 20:13:11 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-07-30 07:01:49 -0300
commitfc393839c11bbe2c7f1a44ab34e5f2a219d8366e (patch)
tree8df69099077ec328f9ba30e1b3197afba45aa3a0 /tools/perf/util/expr.h
parentperf metric: Collect referenced metrics in struct metric_expr (diff)
downloadlinux-dev-fc393839c11bbe2c7f1a44ab34e5f2a219d8366e.tar.xz
linux-dev-fc393839c11bbe2c7f1a44ab34e5f2a219d8366e.zip
perf metric: Add referenced metrics to hash data
Adding referenced metrics to the parsing context so they can be resolved during the metric processing. Adding expr__add_ref function to store referenced metrics into parse context. 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-11-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.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/perf/util/expr.h b/tools/perf/util/expr.h
index 2462abd0ac65..81d04ff7f857 100644
--- a/tools/perf/util/expr.h
+++ b/tools/perf/util/expr.h
@@ -11,12 +11,22 @@
#include "util/hashmap.h"
//#endif
+struct metric_ref;
+
struct expr_parse_ctx {
struct hashmap ids;
};
struct expr_id_data {
- double val;
+ union {
+ double val;
+ struct {
+ const char *metric_name;
+ const char *metric_expr;
+ } ref;
+ };
+
+ bool is_ref;
};
struct expr_scanner_ctx {
@@ -29,6 +39,7 @@ void expr__ctx_clear(struct expr_parse_ctx *ctx);
void expr__del_id(struct expr_parse_ctx *ctx, const char *id);
int expr__add_id(struct expr_parse_ctx *ctx, const char *id);
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__parse(double *final_val, struct expr_parse_ctx *ctx,