Fix crash when measured bandwidth is zero

Change-Id: Ib19825def4a8b01c5ea53798307b0947f625b1d5
This commit is contained in:
ahothan 2015-02-18 12:16:41 -08:00
parent a47447a3f6
commit b68f7fd24f

View File

@ -173,8 +173,9 @@ class PerfTool(object):
if (measured_kbps * 100 / kbps) < 80:
# the measured bw is too far away from the requested bw
# take half the distance or 3x the measured bw whichever is lowest
kbps = min(measured_kbps + (kbps - measured_kbps) / 2,
measured_kbps * 3)
kbps = measured_kbps + (kbps - measured_kbps) / 2
if measured_kbps:
kbps = min(kbps, measured_kbps * 3)
max_kbps = kbps
continue
# The measured bw is within striking distance from the requested bw