From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B53A4C3A5A9 for ; Mon, 4 May 2020 06:50:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99E4424954 for ; Mon, 4 May 2020 06:50:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727841AbgEDGuq (ORCPT ); Mon, 4 May 2020 02:50:46 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34106 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726404AbgEDGuq (ORCPT ); Mon, 4 May 2020 02:50:46 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0446X6QP145312; Mon, 4 May 2020 02:50:35 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 30s45s8r0v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 04 May 2020 02:50:34 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0446ZnIt151742; Mon, 4 May 2020 02:50:34 -0400 Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 30s45s8r0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 04 May 2020 02:50:34 -0400 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 0446j6eB019972; Mon, 4 May 2020 06:50:33 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma01wdc.us.ibm.com with ESMTP id 30s0g5xk5j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 04 May 2020 06:50:33 +0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0446oW5A14025292 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 4 May 2020 06:50:32 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 96081112062; Mon, 4 May 2020 06:50:32 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 366CE112064; Mon, 4 May 2020 06:50:26 +0000 (GMT) Received: from localhost.localdomain (unknown [9.85.95.143]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 4 May 2020 06:50:25 +0000 (GMT) Subject: Re: [PATCH v4 06/12] perf expr: parse numbers as doubles To: Ian Rogers , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Kan Liang , Andi Kleen , Haiyan Song , Jin Yao , Song Liu , Ravi Bangoria , John Garry , Leo Yan , Adrian Hunter , Paul Clarke , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Stephane Eranian References: <20200501173333.227162-1-irogers@google.com> <20200501173333.227162-7-irogers@google.com> From: kajoljain Message-ID: <352e5654-8a08-9144-ead4-75d1026ca9fc@linux.ibm.com> Date: Mon, 4 May 2020 12:20:24 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20200501173333.227162-7-irogers@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-05-04_03:2020-05-01,2020-05-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 adultscore=0 phishscore=0 clxscore=1015 suspectscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005040055 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/1/20 11:03 PM, Ian Rogers wrote: > 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 73db6a9ef97e..ceab11bea6f9 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); > } > > /* > @@ -81,7 +81,7 @@ static int str(yyscan_t scanner, int token, int runtime) > } > %} > > -number [0-9]+ > +number [0-9]*\.?[0-9]+ > Acked and Tested by: Kajol Jain > sch [-,=] > spec \\{sch} > @@ -105,7 +105,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, sctx->runtime); } > "|" { return '|'; } > "^" { return '^'; } >