Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1753492pxb; Fri, 20 Nov 2020 19:14:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJznlYRehgANkoPlO0FjnAtSZ3ecCd8s8TIAUpAORIc35wxBCGxcjhLYffPfiUUmpWdaU3sz X-Received: by 2002:aa7:d787:: with SMTP id s7mr36948211edq.205.1605928478267; Fri, 20 Nov 2020 19:14:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605928478; cv=none; d=google.com; s=arc-20160816; b=UEZUawRs6K4OiMtAjSNZMU1wRt+p4Nx4DQJzSZnU2HCNefzXKPGxi3w0a3dYrWl3Yo pKMpt2E5XC4oWKjJ7/o3mKyDuWf3S8vGsH27BZ30YmUHrE7sv5vPGhbA++iAODg9Tb6D HdFqjqNLSM1jZe3o8BodorPgovHxdbLCfMF+fmb4hJ2IDbLWU4A5vukxUZOa64v1x0GY 4ohNsvBCY5UFK0T7JXTTrPGZaCWI72GAx+JturTBTectHMumcq+9Qa1XUPrtviuRg8od BC/xVVLqIn8EYkSd2EqBDYbmOWSvWKV/4+dPUigXfjpcOUBAUu+39xyCvUsmRPSIqSNb OZ8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=hD5ejNfyuyCoS/ZIO0QMnxuYssX6WcYQssRc/NoOro8=; b=y0TKMIWP+BYEpVVjlHKL88ZP8Dsu/AmXlooDTCgJKBWQ7QUUDNjltWAki03/ww6O6r ++HqZzU3RSTvgGV4pNg1kJPGGy7Tk+JGjexLCPqq3qwUDZEDqsNluZKqZ00cWI7YOrmC T2tXvLKJslhiFO1EOKYGytEsMSxGF820K+EvmHuR1/tBPSQjXbrYPfjY24O+PGgNB1+l vRs8fKuPl6xazD8iZU0HydxsNyVUT7rHTPzRmsnbBI9r4BGIcZ+aDI+BA1DH/tZVUt1O kV30Txi6qXHwlJ3v6y7h5TsNBeBK0NHh53KTPpiJQK2AFHeeY+dAL41kjulciYHIhJZQ /avw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pKhG4kp2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c2si2824316edu.115.2020.11.20.19.14.15; Fri, 20 Nov 2020 19:14:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pKhG4kp2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727310AbgKUDL3 (ORCPT + 99 others); Fri, 20 Nov 2020 22:11:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727312AbgKUDL2 (ORCPT ); Fri, 20 Nov 2020 22:11:28 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D158DC061A48 for ; Fri, 20 Nov 2020 19:11:27 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id z83so5165142ybz.2 for ; Fri, 20 Nov 2020 19:11:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=hD5ejNfyuyCoS/ZIO0QMnxuYssX6WcYQssRc/NoOro8=; b=pKhG4kp2fu3Kf0Vg8dDYwOua9NYqWjFTTnSDXzN43ene1McqdpT6vnAlBwck7y2FwV LSQIdP6u+EhejIjUqqqYDczUtYt7ldDDRd/s7fBvA1MBgSCME7iZYDNcPcklQoaBFI25 lz/QSXCHblPZROHJ44XFn2fovhxywozKh6H5cJtWfU0gMopZKqFzq3v5CsIBdCNYzcGP Pn79GREFkUHV8D6s+FYX5q9g4RZK6Z2ZLNGl7rdAX+EhNG8wRDn/speh2/NuN7+Uy6d6 YNiwBpVExAwOxY9Q5/ryLWfdqlFEFMJTcQAf4e4ZIknTHG+npbol9hxdzASALPjptEYm U3EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=hD5ejNfyuyCoS/ZIO0QMnxuYssX6WcYQssRc/NoOro8=; b=ucmoQbSeUY39HMdW+E+ZffSqc8c9jDOfX8NTIZg4mS8LIhmdMhUuN1rYfQPqCkUhHZ 76TqEye4KQSIA3ZGmylCzU3K46wTbvqsnFe5Zae5samIbxW/6+68D7xSgH7m9dfQkMvb yXzuffhfysCzFjAKJ3pGoUzXa0muey282hELY66oNi7uzJV6/GijyGYyaDZDnhgsM6GA cpI0M2u2vRrlVavVkG4DHN8GahcRJ1qMhDLQnf6aDmu+LsaqlHb4cXqI6y3kFOzYRoux aG4sBY5sjhA7G95G1vl5EN2KcNElFZ8ddszFzjsVUd7Uz9Lz39DodugOwn309ki3yjOI 58bQ== X-Gm-Message-State: AOAM533OuYmZMuhSV/6EUGskVVrWyTrYjwALjxGqy6T9NqY9aB9bHY/n 0oIT9CjvmL9DzJtiREPrztyXBot1TWkv Sender: "irogers via sendgmr" X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:2:f693:9fff:fef4:4583]) (user=irogers job=sendgmr) by 2002:a25:7355:: with SMTP id o82mr27433034ybc.122.1605928287009; Fri, 20 Nov 2020 19:11:27 -0800 (PST) Date: Fri, 20 Nov 2020 19:11:16 -0800 In-Reply-To: <20201121031119.3554769-1-irogers@google.com> Message-Id: <20201121031119.3554769-3-irogers@google.com> Mime-Version: 1.0 References: <20201121031119.3554769-1-irogers@google.com> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH v3 2/5] perf metric: Use NAN for missing event IDs. From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, Andi Kleen , Jin Yao , John Garry , Paul Clarke , kajoljain Cc: Stephane Eranian , Sandeep Dasgupta , linux-perf-users@vger.kernel.org, Ian Rogers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- tools/perf/util/expr.y | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y index b2ada8f8309a..41c9cd4efadd 100644 --- a/tools/perf/util/expr.y +++ b/tools/perf/util/expr.y @@ -1,6 +1,7 @@ /* Simple expression parser */ %{ #define YYDEBUG 1 +#include #include #include "util.h" #include "util/debug.h" @@ -88,12 +89,10 @@ expr: NUMBER | ID { struct expr_id_data *data; - if (expr__resolve_id(ctx, $1, &data)) { - free($1); - YYABORT; - } + $$ = NAN; + if (expr__resolve_id(ctx, $1, &data) == 0) + $$ = expr_id_data__value(data); - $$ = expr_id_data__value(data); free($1); } | expr '|' expr { $$ = (long)$1 | (long)$3; } -- 2.29.2.454.gaff20da3a2-goog