aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util/expr.y
diff options
context:
space:
mode:
authorGravatar Jiri Olsa <jolsa@kernel.org> 2020-07-19 20:13:12 +0200
committerGravatar Arnaldo Carvalho de Melo <acme@redhat.com> 2020-07-30 07:01:49 -0300
commitacf71b05d1a19726594a8436ba9d8af871941e6c (patch)
tree2accfa42f619cd1ab1032a094abefd5331fae1d4 /tools/perf/util/expr.y
parentperf metric: Add referenced metrics to hash data (diff)
downloadlinux-acf71b05d1a19726594a8436ba9d8af871941e6c.tar.gz
linux-acf71b05d1a19726594a8436ba9d8af871941e6c.tar.bz2
linux-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.y')
-rw-r--r--tools/perf/util/expr.y4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
index 0d4f5d324be7..d34b370391c6 100644
--- a/tools/perf/util/expr.y
+++ b/tools/perf/util/expr.y
@@ -88,11 +88,11 @@ expr: NUMBER
| ID {
struct expr_id_data *data;
- if (expr__get_id(ctx, $1, &data) || !data) {
- pr_debug("%s not found\n", $1);
+ if (expr__resolve_id(ctx, $1, &data)) {
free($1);
YYABORT;
}
+
$$ = data->val;
free($1);
}