From: Leah Leshchinsky <lleshchi@redhat.com>
To: jkacur@redhat.com
Cc: linux-rt-users@vger.kernel.org
Subject: [PATCH] rt-tests: hwlatdetect: Update to integer division
Date: Thu, 10 Nov 2022 10:35:27 -0500 [thread overview]
Message-ID: <20221110153527.553524-1-lleshchi@redhat.com> (raw)
In Python 3, "/" is a float division operator, as opposed to Python 2,
which defaults to integer division. This results in an error when
calculating width, which assumes an integer.
Update width division to integer division with the "//" operator.
Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py
index 7b1ae646577a..929107f9c252 100755
--- a/src/hwlatdetect/hwlatdetect.py
+++ b/src/hwlatdetect/hwlatdetect.py
@@ -454,9 +454,10 @@ if __name__ == '__main__':
if args.window:
w = microseconds(args.window)
+ width = w//2
if w < int(detect.get("width")):
- debug(f"shrinking width to {w//2} for new window of {w}")
- detect.set("width", w/2)
+ debug(f"shrinking width to {width} for new window of {w}")
+ detect.set("width", width)
debug(f"window parameter = {w}")
detect.set("window", w)
debug(f"window for sampling set to {w}us")
--
2.31.1
next reply other threads:[~2022-11-10 15:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 15:35 Leah Leshchinsky [this message]
2022-11-11 19:46 ` [PATCH] rt-tests: hwlatdetect: Update to integer division 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=20221110153527.553524-1-lleshchi@redhat.com \
--to=lleshchi@redhat.com \
--cc=jkacur@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
/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