Commit 184ff884 authored by Vincent Michel's avatar Vincent Michel

Add underflows and overflows to the stats

parent 8d4dc6ef
Pipeline #1030 passed with stages
in 1 minute and 18 seconds
......@@ -36,7 +36,9 @@ MAX_STRING_LENGTH = 80
# Helpers
Stats = namedtuple(
'Stats', 'realtime livetime triggers events icr ocr deadtime')
'Stats',
'realtime livetime triggers events icr ocr deadtime '
'underflows overflows')
def stats_from_buffer(array):
......@@ -68,7 +70,9 @@ def stats_from_buffer(array):
# Prospect uses 0% so 0. it is.
deadtime = 1 - float(ocr) / icr if icr != 0 else 0.
return Stats(realtime, livetime, triggers, events, icr, ocr, deadtime)
return Stats(
realtime, livetime, triggers, events, icr, ocr, deadtime,
underflows, overflows)
def to_bytes(arg):
......
......@@ -285,9 +285,9 @@ def test_get_module_statistics(interface):
3088.,
2742.,
3131.720827046904,
2721.350825353351,
0.,
0.]
2724.3282332585513,
1.,
2.]
expected = {8: interface.Stats(
1.00758784,
......@@ -295,8 +295,10 @@ def test_get_module_statistics(interface):
3088,
2742,
3131.720827046904,
2721.350825353351,
0.13103658479051494)}
2724.3282332585513,
0.1300858589533055,
1,
2)}
m.side_effect = side_effect
with mock.patch('handel.interface.get_module_channels') as m2:
......@@ -314,7 +316,7 @@ def test_get_module_statistics(interface):
assert ctx[0].message.args[0].startswith(
'ICR buffer inconsistency: 4.56 != 3131.7208')
assert ctx[1].message.args[0].startswith(
'OCR buffer inconsistency: 1.23 != 2721.3508')
'OCR buffer inconsistency: 1.23 != 2724.3282')
# Make sure errors have been checked
interface.check_error.assert_called_with(0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment