Prevent division by zero errors.

This commit is contained in:
facetoe 2014-10-12 11:58:52 +08:00
parent 1b3db989ed
commit 296d26f432

View File

@ -67,6 +67,9 @@ class CpuUsage(IntervalModule):
self.prev_total[cpu] = total
self.prev_busy[cpu] = busy
if diff_total == 0:
return 0
else:
return int(diff_busy / diff_total * 100)
def gen_format_all(self, usage):