in source/console/src/Components/Results/Results.js [44:71]
caculateBandwidth(bandwidth, duration) {
if (isNaN(bandwidth) || isNaN(duration) || duration === 0) {
return '-';
}
bandwidth = Math.round(bandwidth * 100 / duration / 8) / 100; // Initially, Bps
let units = 'Bps';
while (bandwidth > 1024) {
switch (units) {
case 'Bps':
units = 'Kbps';
break;
case 'Kbps':
units = 'Mbps';
break;
case 'Mbps':
units = 'Gbps';
break;
default:
return `${bandwidth} ${units}`;
}
bandwidth = Math.round(bandwidth * 100 / 1024) / 100;
}
return `${bandwidth} ${units}`;
}