summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeah Leshchinsky <lleshchi@redhat.com>2022-11-10 10:35:27 -0500
committerJohn Kacur <jkacur@redhat.com>2022-11-11 14:43:34 -0500
commit1eaa7feae3225ae82d00d2e1f02986e34c31a38d (patch)
tree48ee8440cb3ca5bf4c441feff2ec5843bea0138c
parentd9acad79fa157f90522b3dc2b745bbb3b72fef1d (diff)
downloadrt-tests-1eaa7feae3225ae82d00d2e1f02986e34c31a38d.tar.gz
rt-tests: hwlatdetect: Update to integer division
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> Signed-off-by: John Kacur <jkacur@redhat.com>
-rwxr-xr-xsrc/hwlatdetect/hwlatdetect.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py
index 1efbe7a..c5b3a68 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")