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 2B920C54FD0 for ; Mon, 27 Apr 2020 11:13:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 103F42063A for ; Mon, 27 Apr 2020 11:13:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726974AbgD0LNQ (ORCPT ); Mon, 27 Apr 2020 07:13:16 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34530 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726589AbgD0LNP (ORCPT ); Mon, 27 Apr 2020 07:13:15 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03RB4XeP099825; Mon, 27 Apr 2020 07:11:58 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 30mguuqrqk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Apr 2020 07:11:57 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 03RB6IUm104225; Mon, 27 Apr 2020 07:11:57 -0400 Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com with ESMTP id 30mguuqrpm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Apr 2020 07:11:57 -0400 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 03RBB9Zp007045; Mon, 27 Apr 2020 11:11:55 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma02wdc.us.ibm.com with ESMTP id 30mcu62jat-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Apr 2020 11:11:55 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 03RBBtFH52822286 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Apr 2020 11:11:55 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E5D1DAC059; Mon, 27 Apr 2020 11:11:54 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6F2BAAC05F; Mon, 27 Apr 2020 11:11:48 +0000 (GMT) Received: from localhost.localdomain (unknown [9.199.63.250]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 27 Apr 2020 11:11:47 +0000 (GMT) Subject: Re: [PATCH v2 06/11] 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: <20200422220430.254014-1-irogers@google.com> <20200422220430.254014-7-irogers@google.com> From: kajoljain Message-ID: <0cee674e-4084-07cb-1954-05dafc371648@linux.ibm.com> Date: Mon, 27 Apr 2020 16:41:46 +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: <20200422220430.254014-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-04-27_07:2020-04-24,2020-04-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 impostorscore=0 phishscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004270100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/23/20 3:34 AM, 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 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]+ > Hi Ian, In this patch I saw the parsing of expression with '+number [0-9]*\.?[0-9]+' Could you please explain why '?' is introduced here, so that I can be sure that this is not conflicting with my change to add '?' In this patch : https://lkml.org/lkml/2020/4/1/1427 I have used '?' symbol as part of metric expression in order to replace '?' with runtime parameter. Thanks, Kajol Jain > 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 '^'; } >