[PATCH 7/8] rt-tests: hwlatdetect: Update to integer division

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Leah Leshchinsky <lleshchi@xxxxxxxxxx>

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@xxxxxxxxxx>
Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>
---
 src/hwlatdetect/hwlatdetect.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py
index 1efbe7a60059..c5b3a689dcd1 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.38.1




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux