From 266a7b90a5c309327efd519c2c31571af1e0ea15 Mon Sep 17 00:00:00 2001 From: Clark Williams Date: Sat, 29 Mar 2014 10:39:26 -0500 Subject: hwlatdetect: convert to run with both python2 and python3 Ran 2to3 on hwlatdetect.py and checked in the result. Tested on F20 system running 3.12.14-rt23 with both python2 and python3. Signed-off-by: Clark Williams --- src/hwlatdetect/hwlatdetect.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index ca47c1c..a07e5fd 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -53,7 +53,7 @@ class DebugFS(object): cmd = ['/bin/mount', '-t', 'debugfs', 'none', path] self.mounted = (subprocess.call(cmd) == 0) if not self.mounted: - raise RuntimeError, "Failed to mount debugfs" + raise RuntimeError("Failed to mount debugfs") return self.mounted def umount(self): @@ -64,7 +64,7 @@ class DebugFS(object): cmd = ['/bin/umount', self.mountpoint] self.mounted = not (subprocess.call(cmd) == 0) if self.mounted: - raise RuntimeError, "Failed to umount debugfs" + raise RuntimeError("Failed to umount debugfs") return not self.mounted def getval(self, item, nonblocking=False): @@ -77,7 +77,7 @@ class DebugFS(object): fd = os.open(path, os.O_RDONLY|os.O_NONBLOCK) try: val = os.read(fd, 256) - except OSError, e: + except OSError as e: if e.errno == errno.EAGAIN: val = None else: @@ -116,7 +116,7 @@ class Kmod(object): debug("checking %s" % mpath) if os.path.exists(mpath): return m - raise RuntimeError, "no detector module found!" + raise RuntimeError("no detector module found!") def __init__(self): self.preloaded = False @@ -153,7 +153,7 @@ class Detector(object): '''wrapper class for managing detector modules''' def __init__(self): if os.getuid() != 0: - raise RuntimeError, "Must be root" + raise RuntimeError("Must be root") self.debugfs = DebugFS() self.kmod = Kmod() self.setup() @@ -175,15 +175,15 @@ class Detector(object): def setup(self): if not self.debugfs.mount(): - raise RuntimeError, "Failed to mount debugfs" + raise RuntimeError("Failed to mount debugfs") if not self.kmod.load(): - raise RuntimeError, "Failed to unload hwlat" + raise RuntimeError("Failed to unload hwlat") def cleanup(self): if not self.kmod.unload(): - raise RuntimeError, "Failed to unload hwlat" + raise RuntimeError("Failed to unload hwlat") if not self.debugfs.umount(): - raise RuntimeError, "Failed to unmount debugfs" + raise RuntimeError("Failed to unmount debugfs") def get(self, field): return self.detector.get(field) @@ -261,8 +261,8 @@ class Hwlat(object): debug("got a latency sample: %s" % val.strip()) val = self.get_sample() time.sleep(0.1) - except KeyboardInterrupt, e: - print "interrupted" + except KeyboardInterrupt as e: + print("interrupted") sys.exit(1) return self.samples # @@ -298,7 +298,7 @@ class Smi(object): debug("__set: %s <-- %d" % (field, value)) self.debugfs.putval(os.path.join("smi_detector", field), str(value)) if self.__get(field) != value: - raise RuntimeError, "Error setting %s to %d (%d)" % (field, value, self.__get(field)) + raise RuntimeError("Error setting %s to %d (%d)" % (field, value, self.__get(field))) def get(self, field): name = Smi.field_translate[field] @@ -320,7 +320,7 @@ class Smi(object): width = ms2us(int(self.__get('ms_per_sample'))) interval = window - width if interval <= 0: - raise RuntimeError, "Smi: invalid width/interval values (%d/%d (%d))" % (width, interval, window) + raise RuntimeError("Smi: invalid width/interval values (%d/%d (%d))" % (width, interval, window)) self.__set('ms_between_samples', us2ms(interval)) def set(self, field, val): @@ -354,8 +354,8 @@ class Smi(object): self.samples.append(val.strip()) debug("got a latency sample: %s (threshold: %d)" % (val.strip(), self.get("threshold"))) time.sleep(0.1) - except KeyboardInterrupt, e: - print "interrupted" + except KeyboardInterrupt as e: + print("interrupted") sys.exit(1) return self.samples @@ -371,7 +371,7 @@ def seconds(str): if str.isdigit(): return int(str) elif str[-2].isalpha(): - raise RuntimeError, "illegal suffix for seconds: '%s'" % str[-2:-1] + raise RuntimeError("illegal suffix for seconds: '%s'" % str[-2:-1]) elif str[-1:] == 's': return int(str[0:-1]) elif str[-1:] == 'm': @@ -383,7 +383,7 @@ def seconds(str): elif str[-1:] == 'w': return int(str[0:-1]) * 86400 * 7 else: - raise RuntimeError, "invalid input for seconds: '%s'" % str + raise RuntimeError("invalid input for seconds: '%s'" % str) def milliseconds(str): "convert input string to millsecond value" @@ -398,7 +398,7 @@ def milliseconds(str): elif str[-1] == 'h': return int(str[0:-1]) * 1000 * 60 * 60 else: - raise RuntimeError, "invalid input for milliseconds: %s" % str + raise RuntimeError("invalid input for milliseconds: %s" % str) def microseconds(str): @@ -412,7 +412,7 @@ def microseconds(str): elif str[-1:] == 's': return (int(str[0:-1]) * 1000 * 1000) else: - raise RuntimeError, "invalid input for microseconds: '%s'" % str + raise RuntimeError("invalid input for microseconds: '%s'" % str) if __name__ == '__main__': from optparse import OptionParser @@ -528,7 +528,7 @@ if __name__ == '__main__': info("sample data (%d samples) written to %s" % (count, reportfile)) else: for s in detect.samples: - print "%s" % s + print("%s" % s) detect.cleanup() sys.exit(exceeding) -- cgit 1.2.3-korg From 041e643710fd286c550650cfe2813b540d516204 Mon Sep 17 00:00:00 2001 From: Clark Williams Date: Sun, 30 Mar 2014 11:05:49 -0500 Subject: cyclictest: fix leftover debbuging comment in argument processing Left a single line comment in the switch statement for handling affinity options. Removed it. Signed-off-by: Clark Williams --- src/cyclictest/cyclictest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index f305c3d..4547831 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -1985,7 +1985,7 @@ int main(int argc, char **argv) case AFFINITY_UNSPECIFIED: par->cpu = -1; break; case AFFINITY_SPECIFIED: par->cpu = cpu_for_thread(i, max_cpus); - //if (verbose) + if (verbose) printf("Thread %d using cpu %d.\n", i, par->cpu); break; -- cgit 1.2.3-korg From 9164ec4db2645f52ffdd20e6d1b72bb0411ab40e Mon Sep 17 00:00:00 2001 From: Clark Williams Date: Sun, 30 Mar 2014 11:16:44 -0500 Subject: version bump to 0.89 Signed-off-by: Clark Williams --- Makefile | 2 +- rt-tests.spec-in | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 73e4c16..318a5c6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION_STRING = 0.88 +VERSION_STRING = 0.89 sources = cyclictest.c signaltest.c pi_stress.c rt-migrate-test.c \ ptsematest.c sigwaittest.c svsematest.c pmqtest.c sendme.c \ diff --git a/rt-tests.spec-in b/rt-tests.spec-in index 449783e..13bcb1b 100644 --- a/rt-tests.spec-in +++ b/rt-tests.spec-in @@ -65,6 +65,10 @@ rm -rf $RPM_BUILD_ROOT /usr/share/man/man8/hackbench.8.gz %changelog +* Sun Mar 30 2014 Clark Williams - 0.89-1 +- clean up debugging comments and printfs from last release +- ran hwlatdetect.py through 2to3, works for both python2 and 3 + * Fri Mar 28 2014 Clark Williams - 0.88-1 - From Uwe Kleine-König : - cyclictest: Fix tracemark output when the latency threshold is hit on ARM -- cgit 1.2.3-korg