Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp634898pxu; Tue, 1 Dec 2020 22:30:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXgi6swCrHQidDoKD34Qhb27RTwepDIRfRMLHXeFjyqFiKrSqG19psrK7vdgryHc/Gw0yJ X-Received: by 2002:a50:dac7:: with SMTP id s7mr1171034edj.106.1606890618770; Tue, 01 Dec 2020 22:30:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606890618; cv=none; d=google.com; s=arc-20160816; b=LjFiYJgzQaxejHzkelQut1XmbQ7+Ka1MmR7ASdLUJyyfBCnKBT5+DnkgRZmBIm+Xd9 V6WPPi/FqWNggFK09KgX0xtyqc+8p57bCWhDcd88HuCs77TSkhR28KvBQeJ+8YZWqO9h rWA0amb+L6Z6dFjfQHJFXuF16Dfr668Yf4C9N1j2wF4bzU//Mte1DTF2i1HqfbpNgCjc 9ODFxy5dEPf+RIIwzYxK9VDLCqEM8y1pUg53PYiEHx6eUamSFcIpy1NGsdjp+fUnlWSG tNpBB4QZh/uhFU+B9/2aedYHYZPTQYWs3AY4w5pYcoAp5H2n4YZ43mHeyxZuz4SjC8u6 FX0Q== 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=spJIR2UdVWpFbLcramfmGXV4+Kgtp9z7KJjvFb6wG0C+SH8JN7YW3+5IHzXKBTrXcE YB8VGHj7bWq3YVS0Aw2+anHpgzkMrSAYhMna6ffx2VLQty/OVPv7XnIipt+AyJvvITu2 2HYQ/jHI8/uNnUtGT6gNCzqPfon3CIkmFRi50sblE06WDZlTg8rMRUW6z7Y8YwlMPSbF EdfcSMAFDquPz2/DU2Xa3ZIQovtxoR39lJvVpkxpm9DA8HAumABJXemjkJSNtTMFXDQd APsNNhmf/JFAFMSYAmHJhhP1aklXCgNjelRoFTASCxTXcSLZoEJXVrNvlGT467VGt/Fy mDlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="gjji7fJ/"; 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 e22si468520edv.437.2020.12.01.22.29.56; Tue, 01 Dec 2020 22:30:18 -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="gjji7fJ/"; 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 S1728618AbgLBG1h (ORCPT + 99 others); Wed, 2 Dec 2020 01:27:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727175AbgLBG1g (ORCPT ); Wed, 2 Dec 2020 01:27:36 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 401A9C0613D6 for ; Tue, 1 Dec 2020 22:26:56 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id i184so628456ybg.7 for ; Tue, 01 Dec 2020 22:26:56 -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=gjji7fJ/bUmVFMRKmo/i0UBGAiQMq3/69prKtzqh1MhiI/4XNIJ9JXOg59MsVzsf8U gPqA+D+/WkUXUHvp6KZJ4od7mEWIV8Woeepl3tr0AgkX1amlkmn45Vn44OANfZD8WWxE mt6c+TAdheAtFvsh//k4KtXXcwBTT3onWUTym6RdgNjNGSoRKtceyplJkPy9xf/UCf7k Wr/3uJOoqTHabjq/hNwXH7dEDU4kOdEDkGwM9aywpt4tuLhV7+qC3bplYtnTawz+yng4 wle8HzhOkrmUrTxJ4m+hnV7M/jwb5z7dezGnNjW7+LARzq2+sG0rNShJBJin+9yruidq QPtg== 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=okVBCSPBqiQNeYwPD4YZmqn2A/GybqId91YnmgTpPN/xSXEgCPa3CWsvQTTy/4jbSo +dffxGv2Yk6MXZP2aWGH6w+cU8Jfzc5qi4ASowaMgVmpiZ9nMRaAQ6skbCCkl07vDhrO LizYrEoHVX1SOkSGpZzKMAEr4P5qVTDyGyWRBmTRmBMYR579UbzOX7gmhQMCBOX3DWTa d4TC+AUCd28d6eZpHBoPFymDkUIHReSimGJr+CYhpeVkgGrKGC3Nx5GeEhZ3StzYxDFD Ingxi9iNb7tV3+dzHTOZpiyo4liVh7Sd4KhvKXgQf8OGbOy3yAEYdGJmDHx1VW98fb7z OIVA== X-Gm-Message-State: AOAM532j98pSLHOZ1ngg+fBA6Pu9gQ1Zu0KT3DZS7Df9hed/X+jECYhC u1dOOUde6F1nNat0TYaKWuu5TH8ZiW0b 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:c343:: with SMTP id t64mr2149244ybf.94.1606890415468; Tue, 01 Dec 2020 22:26:55 -0800 (PST) Date: Tue, 1 Dec 2020 22:26:43 -0800 In-Reply-To: <20201202062646.3780002-1-irogers@google.com> Message-Id: <20201202062646.3780002-3-irogers@google.com> Mime-Version: 1.0 References: <20201202062646.3780002-1-irogers@google.com> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH v4 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 , 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