diff mbox series

rteval: Add --cyclictest-threshold=USEC

Message ID 20220112161137.7909-1-jkacur@redhat.com
State New
Headers show
Series rteval: Add --cyclictest-threshold=USEC | expand

Commit Message

John Kacur Jan. 12, 2022, 4:11 p.m. UTC
Add --cyclictest-threshold=USEC
This option causes rteval to exit if latency is greater than USEC

This is similar to --cyclictest-breaktrace=USEC
and uses the --breaktrace option to cyclictest

The difference is that --cyclictest-threshold does NOT write a tracemark
when the latency is exceeded

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 rteval/modules/measurement/cyclictest.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py
index c094df499403..cc74b467913d 100644
--- a/rteval/modules/measurement/cyclictest.py
+++ b/rteval/modules/measurement/cyclictest.py
@@ -295,9 +295,12 @@  class Cyclictest(rtevalModulePrototype):
         if 'threads' in self.__cfg and self.__cfg.threads:
             self.__cmd.append("-t%d" % int(self.__cfg.threads))
 
+        # Should have either breaktrace or threshold, not both
         if 'breaktrace' in self.__cfg and self.__cfg.breaktrace:
             self.__cmd.append("-b%d" % int(self.__cfg.breaktrace))
             self.__cmd.append("--tracemark")
+        elif 'threshold' in self.__cfg and self.__cfg.threshold:
+            self.__cmd.append("-b%d" % int(self.__cfg.threshold))
 
         # Buffer for cyclictest data written to stdout
         self.__cyclicoutput = tempfile.SpooledTemporaryFile(mode='w+b')
@@ -411,7 +414,7 @@  class Cyclictest(rtevalModulePrototype):
         if self.__breaktraceval:
             abrt_n.newProp('reason', 'breaktrace')
             btv_n = abrt_n.newChild(None, 'breaktrace', None)
-            btv_n.newProp('latency_threshold', str(self.__cfg.breaktrace))
+            btv_n.newProp('latency_threshold', str(self.__cfg.breaktrace) if self.__cfg.breaktrace else str(self.__cfg.threshold))
             btv_n.newProp('measured_latency', str(self.__breaktraceval))
             abrt = True
 
@@ -454,7 +457,10 @@  def ModuleParameters():
                          "metavar": "PRIO"},
             "breaktrace": {"descr": "Send a break trace command when latency > USEC",
                            "default": None,
-                           "metavar": "USEC"}
+                           "metavar": "USEC"},
+            "threshold": {"descr": "Exit rteval if latency > USEC",
+                          "default": None,
+                          "metavar": "USEC"}
             }