lkml.org 
[lkml]   [2020]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/5] perf metric: Use NAN for missing event IDs.
On Tue, Nov 17, 2020 at 09:03:32PM -0800, Ian Rogers wrote:
> If during computing a metric an event (id) is missing the parsing
> aborts. A later patch will make it so that events that aren't used in
> the output are deliberately omitted, in which case we don't want the
> abort. Modify the missing ID case to report NAN for these cases.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/perf/util/expr.y | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
> index b2ada8f8309a..c22e3500a40f 100644
> --- a/tools/perf/util/expr.y
> +++ b/tools/perf/util/expr.y
> @@ -1,6 +1,7 @@
> /* Simple expression parser */
> %{
> #define YYDEBUG 1
> +#include <math.h>
> #include <stdio.h>
> #include "util.h"
> #include "util/debug.h"
> @@ -89,8 +90,7 @@ expr: NUMBER
> struct expr_id_data *data;
>
> if (expr__resolve_id(ctx, $1, &data)) {
> - free($1);
> - YYABORT;
> + $$ = NAN;

hum, it's directly overwriten in the next line, no?

jirka

> }
>
> $$ = expr_id_data__value(data);

> --
> 2.29.2.299.gdc1121823c-goog
>

\
 
 \ /
  Last update: 2020-11-19 20:48    [W:0.074 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site