[PATCH rteval 4/4] measurement: align cyclictest module with upstream changes

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

 



rt-tests commit 0b90cbbfc5 ("cyclictest: only print non-zero values in
histogram output") changed the output format of cyclictest: all-zero
lines are now dropped, as they are superfluous.

cyclictest.py relied on the structure and is unhappy with the new
format.

keys is a sorted list of latencies -- simply reverse it and search for
the highest non-zero value. This works for both, the new and the old
output format of cyclictest.

Additionally, rename the index variable. In fact, the index represents
the latency, so call it latency.

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@xxxxxxxxxxxxxxxxx>
---
 rteval/modules/measurement/cyclictest.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py
index 04f78d1..ae95a7b 100644
--- a/rteval/modules/measurement/cyclictest.py
+++ b/rteval/modules/measurement/cyclictest.py
@@ -113,9 +113,12 @@ class RunData(object):
             if self.__samples[i]:
                 low = i
                 break
-        high = keys[-1]
-        while high and self.__samples[high] == 0:
-            high -= 1
+
+        for i in reversed(keys):
+            if self.__samples[i]:
+                high = i
+                break
+
         self.__range = high - low
 
         # Mean Absolute Deviation and standard deviation
@@ -343,14 +346,14 @@ class Cyclictest(rtevalModulePrototype):
                 continue
 
             try:
-                index = int(vals[0])
+                latency = int(vals[0])
             except:
                 self._log(Log.DEBUG, "cyclictest: unexpected output: %s" % line)
                 continue
 
-            for i,core in enumerate(self.__cpus):
-                self.__cyclicdata[core].bucket(index, int(vals[i+1]))
-                self.__cyclicdata['system'].bucket(index, int(vals[i+1]))
+            for i, core in enumerate(self.__cpus):
+                self.__cyclicdata[core].bucket(latency, int(vals[i+1]))
+                self.__cyclicdata['system'].bucket(latency, int(vals[i+1]))
 
         # generate statistics for each RunData object
         for n in self.__cyclicdata.keys():
-- 
2.19.0




[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