Add Mean Time Between Failures (MTBF) - a valuable statistical metric for evaluating hardware noise and its correlation with configuration. Add the actual duration used for the MTBF calculation. Signed-off-by: Costa Shulyupin <costa.shul@xxxxxxxxxx> --- src/hwlatdetect/hwlatdetect.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index 68f312db639f..570460c9ddae 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -298,6 +298,7 @@ def get(self, field): def detect(self): self.samples = [] + start = time.time() testend = time.time() + self.testduration pollcnt = 0 self.start() @@ -314,6 +315,7 @@ def detect(self): except KeyboardInterrupt as e: print("interrupted") self.stop() + self.act_duration = time.time() - start return self.samples def get_sample(self): @@ -515,6 +517,7 @@ def microseconds(sval): detect.detect() info("test finished") + info(f"Duration: {detect.act_duration:.3f} seconds") max_latency = detect.get("max") if max_latency == 0: @@ -527,6 +530,9 @@ def microseconds(sval): exceeding = detect.get("count") info(f"Samples exceeding threshold: {exceeding}") + if exceeding: + info(f"MTBF: {detect.act_duration / exceeding:.3f} seconds") + if detect.have_msr: finishsmi = detect.getsmicounts() total_smis = 0 -- 2.48.1