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>
This commit is contained in:
Jiri Olsa
2020-07-19 20:13:12 +02:00
committed by Arnaldo Carvalho de Melo
parent fc393839c1
commit acf71b05d1
3 changed files with 36 additions and 2 deletions

View File

@@ -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);
}