diff mbox series

[11/17] rt-tests: hwlatdetect: Remove class Hwlat

Message ID 20211111204207.10167-11-jkacur@redhat.com
State New
Headers show
Series [01/17] rt-tests:hwlatdetect: Remove useless object in class declaration | expand

Commit Message

John Kacur Nov. 11, 2021, 8:42 p.m. UTC
hwlatdetect converted to using ftrace a long time ago.
Since we no longer need to load a kernel module, the class Hwlat can be
removed.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 src/hwlatdetect/hwlatdetect.py | 61 +---------------------------------
 1 file changed, 1 insertion(+), 60 deletions(-)
diff mbox series

Patch

diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py
index c07ddbb0e89e..ff8265ac39c5 100755
--- a/src/hwlatdetect/hwlatdetect.py
+++ b/src/hwlatdetect/hwlatdetect.py
@@ -380,6 +380,7 @@  class Tracer(Detector):
                     f.write("%s\n" % str(s))
                 print("report saved to %s (%d samples)" % (output, len(self.samples)))
 
+
     def display(self):
         for s in self.samples:
             s.display()
@@ -391,66 +392,6 @@  class Tracer(Detector):
             raise RuntimeError("Failed to unmount debugfs")
 
 
-#
-# Class to simplify running the hwlat kernel module
-#
-class Hwlat(Detector):
-    '''class to wrap access to hwlat debugfs files'''
-    def __init__(self):
-        super().__init__()
-        self.kmod = Kmod("hwlat_detector")
-        self.type = "kmodule"
-        self.kmod.load()
-
-    def get(self, field):
-        return int(self.debugfs.getval(os.path.join("hwlat_detector", field)))
-
-    def set(self, field, val):
-        if field == "enable" and val:
-            val = 1
-        self.debugfs.putval(os.path.join("hwlat_detector", field), str(val))
-
-    def get_sample(self):
-        return self.debugfs.getval("hwlat_detector/sample", nonblocking=True)
-
-    def detect(self):
-        self.samples = []
-        testend = time.time() + self.testduration
-        pollcnt = 0
-        self.start()
-        try:
-            while time.time() < testend:
-                pollcnt += 1
-                val = self.get_sample()
-                while val:
-                    val = val.strip()
-                    self.samples.append(val)
-                    if watch:
-                        print(val)
-                    val = self.get_sample()
-                time.sleep(0.1)
-        except KeyboardInterrupt as e:
-            print("interrupted")
-        self.stop()
-        return self.samples
-
-    def display(self):
-        for s in self.samples:
-            print(s)
-
-    def save(self, output=None):
-        if output:
-            with open(output, "w") as f:
-                for s in self.samples:
-                    f.write("%s\n" % str(s))
-                print("report saved to %s (%d samples)" % (output, len(self.samples)))
-
-    def cleanup(self):
-        if not self.kmod.unload():
-            raise RuntimeError("Failed to unload %s" % self.name)
-        if not self.debugfs.umount():
-            raise RuntimeError("Failed to unmount debugfs")
-
 def seconds(str):
     "convert input string to value in seconds"
     if str.isdigit():