* [PATCH] perf expr: Allow exponents on floating point values
@ 2022-05-27 2:06 Ian Rogers
2022-06-09 5:30 ` Ian Rogers
2022-06-09 5:46 ` kajoljain
0 siblings, 2 replies; 4+ messages in thread
From: Ian Rogers @ 2022-05-27 2:06 UTC (permalink / raw)
To: Zhengjun Xing, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, Ian Rogers, Andi Kleen, Thomas Richter,
linux-perf-users, linux-kernel
Cc: Stephane Eranian
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 <zhengjun.xing@linux.intel.com>
Signed-off-by: Ian Rogers <irogers@google.com>
---
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}
--
2.36.1.124.g0e6072fb45-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] perf expr: Allow exponents on floating point values
2022-05-27 2:06 [PATCH] perf expr: Allow exponents on floating point values Ian Rogers
@ 2022-06-09 5:30 ` Ian Rogers
2022-06-09 5:46 ` kajoljain
1 sibling, 0 replies; 4+ messages in thread
From: Ian Rogers @ 2022-06-09 5:30 UTC (permalink / raw)
To: Zhengjun Xing, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, Ian Rogers, Andi Kleen, Thomas Richter,
linux-perf-users, linux-kernel
Cc: Stephane Eranian
On Thu, May 26, 2022 at 7:06 PM Ian Rogers <irogers@google.com> 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 <zhengjun.xing@linux.intel.com>
> Signed-off-by: Ian Rogers <irogers@google.com>
Ping. Simple fix with tests, PTAL. Thanks,
Ian
> ---
> 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}
> --
> 2.36.1.124.g0e6072fb45-goog
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf expr: Allow exponents on floating point values
2022-05-27 2:06 [PATCH] perf expr: Allow exponents on floating point values Ian Rogers
2022-06-09 5:30 ` Ian Rogers
@ 2022-06-09 5:46 ` kajoljain
[not found] ` <CAP-5=fVY-tdEzXi8fcPGQdQf+F93OTzA7z6UksQy=c6Vh7uPpA@mail.gmail.com>
1 sibling, 1 reply; 4+ messages in thread
From: kajoljain @ 2022-06-09 5:46 UTC (permalink / raw)
To: Ian Rogers, Zhengjun Xing, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, Andi Kleen, Thomas Richter,
linux-perf-users, linux-kernel
Cc: Stephane Eranian
Patch looks fine to me
Reviewed-By: Kajol Jain<kjain@linux.ibm.com>
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 <zhengjun.xing@linux.intel.com>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> 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}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] perf expr: Allow exponents on floating point values
[not found] ` <CAP-5=fVY-tdEzXi8fcPGQdQf+F93OTzA7z6UksQy=c6Vh7uPpA@mail.gmail.com>
@ 2022-06-17 18:31 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-06-17 18:31 UTC (permalink / raw)
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, linux-kernel,
Stephane Eranian
Em Wed, Jun 15, 2022 at 10:16:32PM -0700, Ian Rogers escreveu:
> On Wed, Jun 8, 2022 at 10:47 PM kajoljain <kjain@linux.ibm.com> wrote:
>
> > Patch looks fine to me
> >
> > Reviewed-By: Kajol Jain<kjain@linux.ibm.com>
> >
>
> 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 <zhengjun.xing@linux.intel.com>
> > > Signed-off-by: Ian Rogers <irogers@google.com>
> > > ---
> > > 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-17 18:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27 2:06 [PATCH] perf expr: Allow exponents on floating point values Ian Rogers
2022-06-09 5:30 ` Ian Rogers
2022-06-09 5:46 ` kajoljain
[not found] ` <CAP-5=fVY-tdEzXi8fcPGQdQf+F93OTzA7z6UksQy=c6Vh7uPpA@mail.gmail.com>
2022-06-17 18:31 ` Arnaldo Carvalho de Melo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.