Skip to contentSkip to conversation

perf test: make metric validation test return early when there is no metric supported on the test system

PATCH Applied [email protected] 3 participants 5 messages May 22, 2024 – Jul 30, 2024 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf test: make metric validation test return early when there is no metric supported on the test system

From: Weilin Wang <[email protected]>

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.

---
 tools/perf/tests/shell/lib/perf_metric_validation.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tools/perf/tests/shell/lib/perf_metric_validation.py +8 -2
index a2d235252183..0b94216c9c46 100644
@@ -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

reviewer Tested-by on v1 1/1
#1 lore raw
Quoted 9 lines · On Wed, May 22, 2024 at 1:43 PM <[email protected]> wrote:

From: Weilin Wang <[email protected]>

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.

Thanks,
Ian

Quoted 42 lines
---
 tools/perf/tests/shell/lib/perf_metric_validation.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tools/perf/tests/shell/lib/perf_metric_validation.py +8 -3
index a2d235252183..0b94216c9c46 100644
@@ -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

reviewer
#2 lore raw
Quoted 5 lines · Ian Rogers
Quoted 3 lines · On Wed, May 22, 2024 at 1:43 PM <[email protected]> wrote:

From: Weilin Wang <[email protected]>

Quoted 8 lines
Quoted 6 lines

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.

Ping.

Thanks,
Ian

reviewer
#3 lore raw
Quoted 12 lines · Ian Rogers
Quoted 10 lines · Ian Rogers
Quoted 8 lines · On Wed, May 22, 2024 at 1:43 PM <[email protected]> wrote:

From: Weilin Wang <[email protected]>

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.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ping.

Ping.

Thanks,
Ian

maintainer Applied
#4 lore raw
Quoted 13 lines · Ian Rogers
Quoted 12 lines · Ian Rogers
Quoted 10 lines · Ian Rogers
Quoted 8 lines · On Wed, May 22, 2024 at 1:43 PM <[email protected]> wrote:

From: Weilin Wang <[email protected]>

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.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ping.

Ping.

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

- Arnaldo