Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp433438ybz; Wed, 22 Apr 2020 00:50:47 -0700 (PDT) X-Google-Smtp-Source: APiQypJFeQS83d5PozpcX/i96TL+rkayOVV3ejEPJMOzvh5pZFllsYGz7dt5H/bn84aReQEiIQAq X-Received: by 2002:a50:e841:: with SMTP id k1mr21756806edn.245.1587541847325; Wed, 22 Apr 2020 00:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587541847; cv=none; d=google.com; s=arc-20160816; b=YrdbiaDM1CLUJIZfU/UDguDNSQ9A3XYXAx7WFm0EZXG8IRfd1CqUg7OBn7tG+Yr2rq tYXDPw1gGCKq9F5m6UUEam419MwHn27koZne3sc4GtHqUe35B/xK9C+N1ZCKKJ5CZe7Y BFLrDP3zDz9e7/BL2Ga9leI/LOHJIXEWwdEdzzBFp+CxcKXqe1AItk3Bi73/Bc4xCLMy zqVoKdG6yTxPr1a6VCoVaqCNgqT/iQcj6wATKFVPshDKlcJBL0e0aJlWEv3Ey41ZBDIO POKXba3LXC6yqtdgUtiLqpr35q6vFdcMQxT2u1J2kM3RciC5Yqij8uzGhLRFdtzsnCX7 YX5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=9v/SqbpPNd1vIjcwX2QJUR1yjeQPBkaJciMvLWYLL8Q=; b=a/yzy79X9uO7kIm0pX9oB9SmnrL57wVV3VIsi+R1oBIkGNhLhE7mi9iyg5AyipNBtb Q8JSGPniTPDwCLGsAAaX7FM2gGSMDxpc8Fnc7zkmMRsXD9GaX+lsA/gRDgyuOQgJppqH vqybI+uXv/5jRDnu/q/trWYrjIHd1z3XPd3Rihiawc6x+vm93kVZ0Z1h2R4E9NfqLuvC giU4lIlINcwP4H5aG/+w7if4sCO1SRNXDx3vur2HAVDwp6fUycLv29IfAOOEql5VMqzK 3K+vex0Ql7vRvdDw67K84v/hChPFrKA0PJsmLGljntrbmCXxR62qgpH1Dcze37CE0XqW BZcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=N7XDNZPh; 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 w2si3110205edx.70.2020.04.22.00.50.23; Wed, 22 Apr 2020 00:50:47 -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=20161025 header.b=N7XDNZPh; 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 S1726584AbgDVHse (ORCPT + 99 others); Wed, 22 Apr 2020 03:48:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726543AbgDVHs3 (ORCPT ); Wed, 22 Apr 2020 03:48:29 -0400 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80FA0C03C1A7 for ; Wed, 22 Apr 2020 00:48:29 -0700 (PDT) Received: by mail-pl1-x64a.google.com with SMTP id m2so1289123pls.20 for ; Wed, 22 Apr 2020 00:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=9v/SqbpPNd1vIjcwX2QJUR1yjeQPBkaJciMvLWYLL8Q=; b=N7XDNZPhdsdEwyU0vzOcl7tqswM6/F96CeW5rWLFd8PJ2pGRriXzxQ4P5D5hUNnCLi Wkxurn0ainfOjMX3Yfd9j5mT/NDrfM3uSfbl4MIwacfbKj4q0oZ7bvuBw20IB9WmeltV BccwCq/J/XTgMURhICnVja+lEcQ2X3cyZAlEsfFVJIBDLFYgDFVNWxSQA+korr1df4yR cG15Nu3O6rPPB/tBltaGgVdCcU09ZPw7J/KawMUQsMCtvAPk9k2JuJHOopWbrWgRDF1z axTtqMvDoDD68E19FSn0DU2w6+ytHwu0e2clpzQJYB5NYC3aMo3CgsTBKg7M4dhBLirA pZJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=9v/SqbpPNd1vIjcwX2QJUR1yjeQPBkaJciMvLWYLL8Q=; b=SpmxXo9kGFFzBr/HNS2c0fJv0Ur36M9jagzU7kK8KW0rCEsP6/KklrzJL+5QkoQMPj IY9cef6pi1klX59IGqHFPfcZmXTOj+famY2l/YXiUScZG6XXeXLwTkaTOZqdfgeuwTnM +KPLcGEmdkEe0okaC4tFIkb0/MeLAIxEvcf7OjGApcislIXd0kgKotK09i1wFnAoXBEh L+3isyFgwI3yUUfvKpnLKtB/NkDz326pd6f04eRkb7cV5rr1SPcr01M2+kDwEWRseyeY AHipY8DmBgNoC5i7oLTPOet7hLVTpdPieS0aEH6f3dOeLuzBCjWI16+mZaNzMMWOP5K3 UxyQ== X-Gm-Message-State: AGi0PuYPaYWCktqTUFH2w8L8OAB3C7ysiF1MtVRPjl2Tx1WdFYZndyTb kGdfABTEGP2C3WCU2X42d1rgewcXFJ75 X-Received: by 2002:a17:90a:2401:: with SMTP id h1mr10520336pje.1.1587541709004; Wed, 22 Apr 2020 00:48:29 -0700 (PDT) Date: Wed, 22 Apr 2020 00:48:07 -0700 In-Reply-To: <20200422074809.160248-1-irogers@google.com> Message-Id: <20200422074809.160248-7-irogers@google.com> Mime-Version: 1.0 References: <20200422074809.160248-1-irogers@google.com> X-Mailer: git-send-email 2.26.2.303.gf8c07b1a785-goog Subject: [PATCH 6/8] perf expr: parse numbers as doubles From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Kan Liang , Andi Kleen , Haiyan Song , Jin Yao , Ravi Bangoria , John Garry , Leo Yan , Adrian Hunter , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Stephane Eranian , Ian Rogers Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is expected in expr.y and metrics use floating point values such as x86 broadwell IFetch_Line_Utilization. Fixes: 26226a97724d (perf expr: Move expr lexer to flex) Signed-off-by: Ian Rogers --- tools/perf/util/expr.l | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/expr.l b/tools/perf/util/expr.l index 95bcf3629edf..0efda2ce2766 100644 --- a/tools/perf/util/expr.l +++ b/tools/perf/util/expr.l @@ -10,12 +10,12 @@ char *expr_get_text(yyscan_t yyscanner); YYSTYPE *expr_get_lval(yyscan_t yyscanner); -static int __value(YYSTYPE *yylval, char *str, int base, int token) +static double __value(YYSTYPE *yylval, char *str, int token) { - u64 num; + double num; errno = 0; - num = strtoull(str, NULL, base); + num = strtod(str, NULL); if (errno) return EXPR_ERROR; @@ -23,12 +23,12 @@ static int __value(YYSTYPE *yylval, char *str, int base, int token) return token; } -static int value(yyscan_t scanner, int base) +static int value(yyscan_t scanner) { YYSTYPE *yylval = expr_get_lval(scanner); char *text = expr_get_text(scanner); - return __value(yylval, text, base, NUMBER); + return __value(yylval, text, NUMBER); } /* @@ -68,7 +68,7 @@ static int str(yyscan_t scanner, int token) } %} -number [0-9]+ +number [0-9]*\.?[0-9]+ sch [-,=] spec \\{sch} @@ -92,7 +92,7 @@ min { return MIN; } if { return IF; } else { return ELSE; } #smt_on { return SMT_ON; } -{number} { return value(yyscanner, 10); } +{number} { return value(yyscanner); } {symbol} { return str(yyscanner, ID); } "|" { return '|'; } "^" { return '^'; } -- 2.26.2.303.gf8c07b1a785-goog