1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-21 20:38:57 +00:00

revent.py: Fix handling of zero-event files

Previously the try clause worked to catch StopIteration exceptions correctly,
however upon catching the exception, another statment which set self._duration
to (last.time - first.time) was being run regardless, which defeated the point
of the try clause.

This has been fixed by introducing an else clause to contain said statement.
This commit is contained in:
Waleed El-Geresy 2017-08-11 16:33:49 +01:00 committed by devlab
parent 5cd9bc756c
commit cd0863d7fa

View File

@ -142,9 +142,10 @@ class ReventRecording(object):
first = last = events.next()
except StopIteration:
self._duration = 0
for last in events:
pass
self._duration = (last.time - first.time).total_seconds()
else:
for last in events:
pass
self._duration = (last.time - first.time).total_seconds()
else: # not streaming
if not self._events:
self._duration = 0