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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F6D7C433EF for ; Fri, 17 Jun 2022 18:31:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230325AbiFQSbp (ORCPT ); Fri, 17 Jun 2022 14:31:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230011AbiFQSbm (ORCPT ); Fri, 17 Jun 2022 14:31:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECDAF33350; Fri, 17 Jun 2022 11:31:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9B896B82A03; Fri, 17 Jun 2022 18:31:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 098C7C3411B; Fri, 17 Jun 2022 18:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655490698; bh=2/knutDxckjBdkBXfrZLSAKW2wg72XY5+Fy5skCxEVI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MF5JdofyYxxqaZmk43bNRCfBOacUQ3k+eK3Ow+OY1V525OWbgv5koJy9Tr8ZNInpo YDQCY7bkTboxclR2QJbf/OJ6uuD6Sag6yesPKdWq/z3uZ2c70pQ6DMv+8SyhG8nfH7 VXTW3VvVeW+1BQBsmizWooSX1iW0mO8+RkZ0vOdK2lveM/eRfDbBjla/Idx+I9nUYf QhKavYZ6mNUX/L0Sh0/AY5pAhy5nMFQ7al+M4+jf8mhK8dxSAztFEd72ACq+OY6b+x gMZ7fmJdVAtHskdpR3TpKuM87mBo8Fdgz7M8M8KEg2Wqr+RVHKH9WqgBC8+W5hMgrR qOvj7+/fd+RDw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 678864096F; Fri, 17 Jun 2022 15:31:35 -0300 (-03) Date: Fri, 17 Jun 2022 15:31:35 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: kajoljain , Zhengjun Xing , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andi Kleen , Thomas Richter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Stephane Eranian Subject: Re: [PATCH] perf expr: Allow exponents on floating point values Message-ID: References: <20220527020653.4160884-1-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org Em Wed, Jun 15, 2022 at 10:16:32PM -0700, Ian Rogers escreveu: > On Wed, Jun 8, 2022 at 10:47 PM kajoljain wrote: > > > Patch looks fine to me > > > > Reviewed-By: Kajol Jain > > > > Thanks! Arnaldo, can this one go in? Sure, applied. - Arnaldo > Ian > > > > > > On 5/27/22 07:36, Ian Rogers wrote: > > > Pass the optional exponent component through to strtod that already > > > supports it. We already have exponents in ScaleUnit and so this adds > > > uniformity. > > > > > > Reported-by: Zhengjun Xing > > > Signed-off-by: Ian Rogers > > > --- > > > tools/perf/tests/expr.c | 2 ++ > > > tools/perf/util/expr.l | 2 +- > > > 2 files changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c > > > index d54c5371c6a6..5c0032fe93ae 100644 > > > --- a/tools/perf/tests/expr.c > > > +++ b/tools/perf/tests/expr.c > > > @@ -97,6 +97,8 @@ static int test__expr(struct test_suite *t > > __maybe_unused, int subtest __maybe_u > > > ret |= test(ctx, "2.2 > 2.2", 0); > > > ret |= test(ctx, "2.2 < 1.1", 0); > > > ret |= test(ctx, "1.1 > 2.2", 0); > > > + ret |= test(ctx, "1.1e10 < 1.1e100", 1); > > > + ret |= test(ctx, "1.1e2 > 1.1e-2", 1); > > > > > > if (ret) { > > > expr__ctx_free(ctx); > > > diff --git a/tools/perf/util/expr.l b/tools/perf/util/expr.l > > > index 0a13eb20c814..4dc8edbfd9ce 100644 > > > --- a/tools/perf/util/expr.l > > > +++ b/tools/perf/util/expr.l > > > @@ -91,7 +91,7 @@ static int literal(yyscan_t scanner) > > > } > > > %} > > > > > > -number ([0-9]+\.?[0-9]*|[0-9]*\.?[0-9]+) > > > +number ([0-9]+\.?[0-9]*|[0-9]*\.?[0-9]+)(e-?[0-9]+)? > > > > > > sch [-,=] > > > spec \\{sch} > > -- - Arnaldo