mirror of https://github.com/xzeldon/htop.git
Discard stale information from DiskIO and NetworkIO meters
This ensures the initial read of the data is not misinterpreted as arbitrarily large values. Also this forces the maximum update interval between two subsequent reads to within 30s. Fixes #860
This commit is contained in:
parent
696f79fe50
commit
2977414d54
|
@ -81,6 +81,12 @@ static void DiskIOMeter_updateValues(Meter* this) {
|
|||
cached_msTimeSpend_total = data.totalMsTimeSpend;
|
||||
}
|
||||
|
||||
if (passedTimeInMs > 30000) {
|
||||
// Triggers for the first initialization and
|
||||
// when there was a long time we did not collect updates
|
||||
hasData = false;
|
||||
}
|
||||
|
||||
this->values[0] = cached_utilisation_diff;
|
||||
this->total = MAXIMUM(this->values[0], 100.0); /* fix total after (initial) spike */
|
||||
|
||||
|
|
|
@ -85,6 +85,12 @@ static void NetworkIOMeter_updateValues(Meter* this) {
|
|||
cached_txp_total = data.packetsTransmitted;
|
||||
}
|
||||
|
||||
if (passedTimeInMs > 30000) {
|
||||
// Triggers for the first initialization and
|
||||
// when there was a long time we did not collect updates
|
||||
hasData = false;
|
||||
}
|
||||
|
||||
this->values[0] = cached_rxb_diff;
|
||||
this->values[1] = cached_txb_diff;
|
||||
if (cached_rxb_diff + cached_txb_diff > this->total) {
|
||||
|
|
Loading…
Reference in New Issue