From: John Kacur <jkacur@redhat.com>
To: RT <linux-rt-users@vger.kernel.org>
Cc: Clark Williams <williams@redhat.com>, John Kacur <jkacur@redhat.com>
Subject: [PATCH] rteval: Use get instead of setdefault for calculating range
Date: Thu, 2 May 2024 13:14:03 -0400 [thread overview]
Message-ID: <20240502171403.20863-1-jkacur@redhat.com> (raw)
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
reply other threads:[~2024-05-02 17:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240502171403.20863-1-jkacur@redhat.com \
--to=jkacur@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).