rteval/rteval-Use-get-instead-of-setdefault-for-calculating.patch
John Kacur 3db03791e8 Add timerlat as a measurement module
Add timerlat as a measurement module

Resolves: RHEL-28058
Signed-off-by: John Kacur <jkacur@redhat.com>
2024-05-06 17:15:09 -04:00

46 lines
1.6 KiB
Diff

From a5f3289e2ee6577cbbb78661bea58b821942ba56 Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@redhat.com>
Date: Thu, 2 May 2024 13:09:01 -0400
Subject: [PATCH 12/13] rteval: Use get instead of setdefault for calculating
range
As Crystal Wood <crwood@redhat.com> points out, there is no
need to setdefault when calculating the range, just use get
if there is no value.
Signed-off-by: John Kacur <jkacur@redhat.com>
---
rteval/modules/measurement/cyclictest.py | 2 +-
rteval/modules/measurement/timerlat.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py
index 925065367eaf..3301e1b45e11 100644
--- a/rteval/modules/measurement/cyclictest.py
+++ b/rteval/modules/measurement/cyclictest.py
@@ -115,7 +115,7 @@ class RunData:
low = i
break
high = keys[-1]
- while high and self.__samples.setdefault(high, 0) == 0:
+ while high and self.__samples.get(high, 0) == 0:
high -= 1
self.__range = high - low
diff --git a/rteval/modules/measurement/timerlat.py b/rteval/modules/measurement/timerlat.py
index 9fa931043e40..e8345fab1ad7 100644
--- a/rteval/modules/measurement/timerlat.py
+++ b/rteval/modules/measurement/timerlat.py
@@ -106,7 +106,7 @@ class TLRunData:
low = i
break
high = keys[-1]
- while high and self.__samples.setdefault(high, 0) == 0:
+ while high and self.__samples.get(high, 0) == 0:
high -= 1
self.__range = high - low
--
2.44.0