Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp339686pxb; Thu, 23 Sep 2021 00:50:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTBKxVT4PV27198s3JXYMR4rkHPzOjHrkrJL9e6uOklv9/Tw86ercLjf5mwKvRzVFgiexG X-Received: by 2002:a17:906:31ca:: with SMTP id f10mr3460310ejf.73.1632383427812; Thu, 23 Sep 2021 00:50:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632383427; cv=none; d=google.com; s=arc-20160816; b=WnEPN6+VH3uMHErhfMqHD1UHIq3Iz9djV8B2sERxmV2ISHDEOfkIexaG5Wdw4LNvef o68lwgpFOcd7rEzGbDqIXUTxOmh0SBVewzkZFxRfOpilywad45Ip6BgD/iotQnafbfZ6 XRdg1SW1qtzj9Tr+gOcXg1dU+Ijx3N0PN3NIVWMdIylp6REBqsBePpg4ULnznxmfpFIK FDfjPf0vPvt0XPCz1DDsXTQFfP42fQL4Vh7MaTxWB2cduDvTyDUC1R7Ak2G6LW+Z+dVc 0IiXjx4EUAO45bwBpufYQib2lx3JORazcF5Nez/qPqqqnaBX/gJfHsJYM0S+xrUdo0zp AxAQ== 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:dkim-signature; bh=0X+bRUj0ZqyVq9AjBewJSvN4Dct/DQ49eGdrq3G0ots=; b=pfdXLUuOw8Tu4FpHh8gnPf6f7im/coDCMu0w9K+Z+nSych7rYSajJvYI3GVk7aAEed Sa/Y6JbTT8kvkansHyF2AUE+1iu0kGQq8sBJM26zBlf77fKXh9suJzvvbzFRzxpGX1Zr volBAsbzkPtQmJ7cYsYumuSDC65WLWWIyDMy5DS7B+EWeFVLaTMsZXDkQ8ZJBzUfvacV C4kYXtW5kzsrXvwb2vYmCxfD/WEPOeV19ju8jNo+YPx3IMlnlgZ/NezVhsbdeF9o04mv NkSZCPrI+s9jQzQu58FmeLqVSrJXaFkpPHDwpXuMvFTNfYVRVef/y+JvrmLS95iyfyMB nDfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=f64qiW4s; 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 t10si5266579edj.386.2021.09.23.00.50.04; Thu, 23 Sep 2021 00:50:27 -0700 (PDT) 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=20210112 header.b=f64qiW4s; 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 S239814AbhIWHsS (ORCPT + 99 others); Thu, 23 Sep 2021 03:48:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239755AbhIWHsL (ORCPT ); Thu, 23 Sep 2021 03:48:11 -0400 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9293BC061760 for ; Thu, 23 Sep 2021 00:46:40 -0700 (PDT) Received: by mail-qt1-x849.google.com with SMTP id d20-20020ac81194000000b002a53ffbd04dso15869380qtj.12 for ; Thu, 23 Sep 2021 00:46:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=0X+bRUj0ZqyVq9AjBewJSvN4Dct/DQ49eGdrq3G0ots=; b=f64qiW4sLGFTJCjmROAwqLNrF8ScIgWzcEMjevIjuuIu0L7GU8xz39XOY86aami4T7 OwliwH4aL8ysE9bG68d/2vjS//FBViqBN58jMpKte/RJK2Rhq5tk7mShuQP7OgFHIZXk Zfbvg/vPnlcyczJxyhrgJv9GE9PM+h8V7qZlsVRRIfSgAec3Rnj5J2qn67EdwRhQU2Xm B2FY0o5u4rR/vOt6Wy77QzFZ2OOreoVkiPPMBFYktSTl06AGrPAS9zXlwfJEocdQOfqj /EIAHBOmW0XS/0LO8/xE/1BVqsOyKi6PjQWbWUtzv+mw5miKH3fCZ631jnkvV3EXQAaC guRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=0X+bRUj0ZqyVq9AjBewJSvN4Dct/DQ49eGdrq3G0ots=; b=wtJWKMMI6JaiJ+V0pduwkaJLkkU8TfbhrofLLAWO3rkDyxiV9+eKXLer0MJllFGduf rpAALHz7NuTUHp5eQdInUO1vTQYJ44cPz9hyjN9QsZDS72LSucbeZSXTPKQTm8/qh9aY jKSZGS6rGIl05+V1diu59xieh6rZzypcOBYN5adbUAtN7/btEyGfPlMjg/Tkrqzlcn/O +9bZ3KLQc/NmspUtyKIdooQXfNtInY0iI2UP/eMKKHleuuHGwgeekqZ6q4AtOOWqJXAI 6pZ8Lq7N0Q+ZdD4tHMeQQeF6l0qD6osyfPyvmGthf6VBQ/5nykepV2VR84pBm2+LkNeW 9l0A== X-Gm-Message-State: AOAM531obAghGL7CLGOHxNNRutN6MPpu7uuxs6LbtH1wqU+ZUUy8fXa6 ZHAUJLOaQ1Yf5BJ/IRVpHdGfj4X4D/JL X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:d3ff:e8f7:11f4:c738]) (user=irogers job=sendgmr) by 2002:a25:9941:: with SMTP id n1mr3997064ybo.247.1632383199627; Thu, 23 Sep 2021 00:46:39 -0700 (PDT) Date: Thu, 23 Sep 2021 00:46:05 -0700 In-Reply-To: <20210923074616.674826-1-irogers@google.com> Message-Id: <20210923074616.674826-3-irogers@google.com> Mime-Version: 1.0 References: <20210923074616.674826-1-irogers@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v9 02/13] 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 , linux-perf-users@vger.kernel.org Cc: Stephane Eranian , Sandeep Dasgupta , 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. Reviewed-by: Andi Kleen 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.33.0.464.g1972c5931b-goog