aboutsummaryrefslogtreecommitdiff
path: root/bart
diff options
context:
space:
mode:
authorKapileshwar Singh <kapileshwar.singh@arm.com>2015-11-02 11:34:00 +0000
committerKapileshwar Singh <kapileshwar.singh@arm.com>2015-11-02 11:34:51 +0000
commitf20180dce12b2c234660cbbc81f2eafb86e7ad5c (patch)
treeaf062fa519192dbf29817475dbc69805acf35806 /bart
parentf742f8074e2286e974d8a7c618914e2d22a6b86f (diff)
downloadbart-f20180dce12b2c234660cbbc81f2eafb86e7ad5c.tar.gz
sched: SchedAssert: Fix division by zero in getPeriod
Fixes issue #21 Signed-off-by: Kapileshwar Singh <kapileshwar.singh@arm.com>
Diffstat (limited to 'bart')
-rwxr-xr-xbart/sched/SchedAssert.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/bart/sched/SchedAssert.py b/bart/sched/SchedAssert.py
index 04a7535..906eead 100755
--- a/bart/sched/SchedAssert.py
+++ b/bart/sched/SchedAssert.py
@@ -462,7 +462,10 @@ class SchedAssert(object):
agg = self._aggregator(sconf.period)
period = agg.aggregate(level="all", window=window)[0]
total, length = map(sum, zip(*period))
- return (total * 1000) / length
+ if length == 0:
+ return float("NaN")
+ else:
+ return (total * 1000) / length
def assertPeriod(
self,