linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] perf test: make metric validation test return early when there is no metric supported on the test system
@ 2024-05-22 20:42 weilin.wang
  2024-05-25  1:26 ` Ian Rogers
  0 siblings, 1 reply; 5+ messages in thread
From: weilin.wang @ 2024-05-22 20:42 UTC (permalink / raw)
  To: weilin.wang, Ian Rogers, Kan Liang, Namhyung Kim,
	Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter
  Cc: linux-perf-users, linux-kernel, Perry Taylor, Samantha Alt,
	Caleb Biggers

From: Weilin Wang <weilin.wang@intel.com>

Add a check to return the metric validation test early when perf list metric
does not output any metric. This would happen when NO_JEVENTS=1 is set or in a
system that there is no metric supported.


Signed-off-by: Weilin Wang <weilin.wang@intel.com>
---
 tools/perf/tests/shell/lib/perf_metric_validation.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/shell/lib/perf_metric_validation.py b/tools/perf/tests/shell/lib/perf_metric_validation.py
index a2d235252183..0b94216c9c46 100644
--- a/tools/perf/tests/shell/lib/perf_metric_validation.py
+++ b/tools/perf/tests/shell/lib/perf_metric_validation.py
@@ -95,7 +95,7 @@ class Validator:
                       indent=4)

     def get_results(self, idx: int = 0):
-        return self.results[idx]
+        return self.results.get(idx)

     def get_bounds(self, lb, ub, error, alias={}, ridx: int = 0) -> list:
         """
@@ -173,7 +173,10 @@ class Validator:
         pcnt = 0
         tcnt = 0
         rerun = list()
-        for name, val in self.get_results().items():
+        results = self.get_results()
+        if not results:
+            return
+        for name, val in results.items():
             if val < 0:
                 negmetric[name] = val
                 rerun.append(name)
@@ -532,6 +535,9 @@ class Validator:
         '''
         if not self.collectlist:
             self.parse_perf_metrics()
+        if not self.metrics:
+            print("No metric found for testing")
+            return 0
         self.create_rules()
         for i in range(0, len(self.workloads)):
             self.wlidx = i
--
2.42.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] perf test: make metric validation test return early when there is no metric supported on the test system
  2024-05-22 20:42 [PATCH v1 1/1] perf test: make metric validation test return early when there is no metric supported on the test system weilin.wang
@ 2024-05-25  1:26 ` Ian Rogers
  2024-07-15 22:25   ` Ian Rogers
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Rogers @ 2024-05-25  1:26 UTC (permalink / raw)
  To: weilin.wang
  Cc: Kan Liang, Namhyung Kim, Arnaldo Carvalho de Melo, Peter Zijlstra,
	Ingo Molnar, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	linux-perf-users, linux-kernel, Perry Taylor, Samantha Alt,
	Caleb Biggers

On Wed, May 22, 2024 at 1:43 PM <weilin.wang@intel.com> wrote:
>
> From: Weilin Wang <weilin.wang@intel.com>
>
> Add a check to return the metric validation test early when perf list metric
> does not output any metric. This would happen when NO_JEVENTS=1 is set or in a
> system that there is no metric supported.
>
>
> Signed-off-by: Weilin Wang <weilin.wang@intel.com>

Tested-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/tests/shell/lib/perf_metric_validation.py | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/tests/shell/lib/perf_metric_validation.py b/tools/perf/tests/shell/lib/perf_metric_validation.py
> index a2d235252183..0b94216c9c46 100644
> --- a/tools/perf/tests/shell/lib/perf_metric_validation.py
> +++ b/tools/perf/tests/shell/lib/perf_metric_validation.py
> @@ -95,7 +95,7 @@ class Validator:
>                        indent=4)
>
>      def get_results(self, idx: int = 0):
> -        return self.results[idx]
> +        return self.results.get(idx)
>
>      def get_bounds(self, lb, ub, error, alias={}, ridx: int = 0) -> list:
>          """
> @@ -173,7 +173,10 @@ class Validator:
>          pcnt = 0
>          tcnt = 0
>          rerun = list()
> -        for name, val in self.get_results().items():
> +        results = self.get_results()
> +        if not results:
> +            return
> +        for name, val in results.items():
>              if val < 0:
>                  negmetric[name] = val
>                  rerun.append(name)
> @@ -532,6 +535,9 @@ class Validator:
>          '''
>          if not self.collectlist:
>              self.parse_perf_metrics()
> +        if not self.metrics:
> +            print("No metric found for testing")
> +            return 0
>          self.create_rules()
>          for i in range(0, len(self.workloads)):
>              self.wlidx = i
> --
> 2.42.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] perf test: make metric validation test return early when there is no metric supported on the test system
  2024-05-25  1:26 ` Ian Rogers
@ 2024-07-15 22:25   ` Ian Rogers
  2024-07-30 18:44     ` Ian Rogers
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Rogers @ 2024-07-15 22:25 UTC (permalink / raw)
  To: Namhyung Kim, Arnaldo Carvalho de Melo
  Cc: Kan Liang, Peter Zijlstra, Ingo Molnar, Alexander Shishkin,
	Jiri Olsa, Adrian Hunter, linux-perf-users, linux-kernel,
	Perry Taylor, Samantha Alt, Caleb Biggers, weilin.wang

On Fri, May 24, 2024 at 6:26 PM Ian Rogers <irogers@google.com> wrote:
>
> On Wed, May 22, 2024 at 1:43 PM <weilin.wang@intel.com> wrote:
> >
> > From: Weilin Wang <weilin.wang@intel.com>
> >
> > Add a check to return the metric validation test early when perf list metric
> > does not output any metric. This would happen when NO_JEVENTS=1 is set or in a
> > system that there is no metric supported.
> >
> >
> > Signed-off-by: Weilin Wang <weilin.wang@intel.com>
>
> Tested-by: Ian Rogers <irogers@google.com>

Ping.

Thanks,
Ian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] perf test: make metric validation test return early when there is no metric supported on the test system
  2024-07-15 22:25   ` Ian Rogers
@ 2024-07-30 18:44     ` Ian Rogers
  2024-07-30 19:14       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Rogers @ 2024-07-30 18:44 UTC (permalink / raw)
  To: Namhyung Kim, Arnaldo Carvalho de Melo
  Cc: Kan Liang, Peter Zijlstra, Ingo Molnar, Alexander Shishkin,
	Jiri Olsa, Adrian Hunter, linux-perf-users, linux-kernel,
	Perry Taylor, Samantha Alt, Caleb Biggers, weilin.wang

On Mon, Jul 15, 2024 at 3:25 PM Ian Rogers <irogers@google.com> wrote:
>
> On Fri, May 24, 2024 at 6:26 PM Ian Rogers <irogers@google.com> wrote:
> >
> > On Wed, May 22, 2024 at 1:43 PM <weilin.wang@intel.com> wrote:
> > >
> > > From: Weilin Wang <weilin.wang@intel.com>
> > >
> > > Add a check to return the metric validation test early when perf list metric
> > > does not output any metric. This would happen when NO_JEVENTS=1 is set or in a
> > > system that there is no metric supported.
> > >
> > >
> > > Signed-off-by: Weilin Wang <weilin.wang@intel.com>
> >
> > Tested-by: Ian Rogers <irogers@google.com>
>
> Ping.

Ping.

Thanks,
Ian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] perf test: make metric validation test return early when there is no metric supported on the test system
  2024-07-30 18:44     ` Ian Rogers
@ 2024-07-30 19:14       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-07-30 19:14 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Namhyung Kim, Kan Liang, Peter Zijlstra, Ingo Molnar,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, linux-perf-users,
	linux-kernel, Perry Taylor, Samantha Alt, Caleb Biggers,
	weilin.wang

On Tue, Jul 30, 2024 at 11:44:32AM -0700, Ian Rogers wrote:
> On Mon, Jul 15, 2024 at 3:25 PM Ian Rogers <irogers@google.com> wrote:
> >
> > On Fri, May 24, 2024 at 6:26 PM Ian Rogers <irogers@google.com> wrote:
> > >
> > > On Wed, May 22, 2024 at 1:43 PM <weilin.wang@intel.com> wrote:
> > > >
> > > > From: Weilin Wang <weilin.wang@intel.com>
> > > >
> > > > Add a check to return the metric validation test early when perf list metric
> > > > does not output any metric. This would happen when NO_JEVENTS=1 is set or in a
> > > > system that there is no metric supported.
> > > >
> > > >
> > > > Signed-off-by: Weilin Wang <weilin.wang@intel.com>
> > >
> > > Tested-by: Ian Rogers <irogers@google.com>
> >
> > Ping.
> 
> Ping.

Thanks, applied to tmp.perf-tools-next,

- Arnaldo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-30 19:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-22 20:42 [PATCH v1 1/1] perf test: make metric validation test return early when there is no metric supported on the test system weilin.wang
2024-05-25  1:26 ` Ian Rogers
2024-07-15 22:25   ` Ian Rogers
2024-07-30 18:44     ` Ian Rogers
2024-07-30 19:14       ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).