Linux-rt-users archive mirror
 help / color / mirror / Atom feed
From: Crystal Wood <crwood@redhat.com>
To: John Kacur <jkacur@redhat.com>, Clark Williams <williams@redhat.com>
Cc: linux-rt-users@vger.kernel.org, Crystal Wood <crwood@redhat.com>
Subject: [PATCH] rteval: cyclictest.py: reduce: Fix exception with missing samples
Date: Wed,  1 May 2024 15:09:22 -0500	[thread overview]
Message-ID: <20240501200922.226347-1-crwood@redhat.com> (raw)

If cyclictest omits a line of zeroes rather than printing it,
__samples[high] will not exist (rather than be zero).  Handle this
in preparation for cyclictest doing this.

Note that get() seems more suitable than setdefault(), but the latter
is used in order to match the code in timerlat.py.

Signed-off-by: Crystal Wood <crwood@redhat.com>
---
 rteval/modules/measurement/cyclictest.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py
index cef73abd1b4b..925065367eaf 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[high] == 0:
+        while high and self.__samples.setdefault(high, 0) == 0:
             high -= 1
         self.__range = high - low
 
-- 
2.44.0


             reply	other threads:[~2024-05-01 20:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-01 20:09 Crystal Wood [this message]
2024-05-01 20:51 ` [PATCH] rteval: cyclictest.py: reduce: Fix exception with missing samples John Kacur

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=20240501200922.226347-1-crwood@redhat.com \
    --to=crwood@redhat.com \
    --cc=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).