diff options
author | Kapileshwar Singh <kapileshwar.singh@arm.com> | 2015-11-02 11:34:00 +0000 |
---|---|---|
committer | Kapileshwar Singh <kapileshwar.singh@arm.com> | 2015-11-02 11:34:51 +0000 |
commit | f20180dce12b2c234660cbbc81f2eafb86e7ad5c (patch) | |
tree | af062fa519192dbf29817475dbc69805acf35806 /bart | |
parent | f742f8074e2286e974d8a7c618914e2d22a6b86f (diff) | |
download | bart-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-x | bart/sched/SchedAssert.py | 5 |
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, |