Check duration > 0 before calculating stream rates
Avoid divide by zero error and/or inf/nan values
This commit is contained in:
parent
d9cd90a13d
commit
b296c5fddd
@ -163,20 +163,24 @@ QVariant StreamStatsModel::data(const QModelIndex &index, int role) const
|
|||||||
case kTxDuration:
|
case kTxDuration:
|
||||||
return QString("%L1").arg(aggrGuidStats_.value(guid).txDuration);
|
return QString("%L1").arg(aggrGuidStats_.value(guid).txDuration);
|
||||||
case kAvgTxFrameRate:
|
case kAvgTxFrameRate:
|
||||||
return QString("%L1").arg(
|
return aggrGuidStats_.value(guid).txDuration <= 0 ? QString("-") :
|
||||||
|
QString("%L1").arg(
|
||||||
aggrGuidStats_.value(guid).txPkts
|
aggrGuidStats_.value(guid).txPkts
|
||||||
/ aggrGuidStats_.value(guid).txDuration);
|
/ aggrGuidStats_.value(guid).txDuration);
|
||||||
case kAvgRxFrameRate:
|
case kAvgRxFrameRate:
|
||||||
return QString("%L1").arg(
|
return aggrGuidStats_.value(guid).txDuration <= 0 ? QString("-") :
|
||||||
|
QString("%L1").arg(
|
||||||
aggrGuidStats_.value(guid).rxPkts
|
aggrGuidStats_.value(guid).rxPkts
|
||||||
/ aggrGuidStats_.value(guid).txDuration);
|
/ aggrGuidStats_.value(guid).txDuration);
|
||||||
case kAvgTxBitRate:
|
case kAvgTxBitRate:
|
||||||
return XLocale().toBitRateString(
|
return aggrGuidStats_.value(guid).txDuration <= 0 ? QString("-") :
|
||||||
|
XLocale().toBitRateString(
|
||||||
(aggrGuidStats_.value(guid).txBytes
|
(aggrGuidStats_.value(guid).txBytes
|
||||||
+ 24 * aggrGuidStats_.value(guid).txPkts) * 8
|
+ 24 * aggrGuidStats_.value(guid).txPkts) * 8
|
||||||
/ aggrGuidStats_.value(guid).txDuration);
|
/ aggrGuidStats_.value(guid).txDuration);
|
||||||
case kAvgRxBitRate:
|
case kAvgRxBitRate:
|
||||||
return XLocale().toBitRateString(
|
return aggrGuidStats_.value(guid).txDuration <= 0 ? QString("-") :
|
||||||
|
XLocale().toBitRateString(
|
||||||
(aggrGuidStats_.value(guid).rxBytes
|
(aggrGuidStats_.value(guid).rxBytes
|
||||||
+ 24 * aggrGuidStats_.value(guid).rxPkts) * 8
|
+ 24 * aggrGuidStats_.value(guid).rxPkts) * 8
|
||||||
/ aggrGuidStats_.value(guid).txDuration);
|
/ aggrGuidStats_.value(guid).txDuration);
|
||||||
|
Loading…
Reference in New Issue
Block a user