mirror of https://github.com/xzeldon/htop.git
Reduce scope of cached values
This commit is contained in:
parent
be568b1153
commit
be39de14dd
|
@ -31,9 +31,6 @@ static unsigned long int cached_write_diff = 0;
|
||||||
static double cached_utilisation_diff = 0.0;
|
static double cached_utilisation_diff = 0.0;
|
||||||
|
|
||||||
static void DiskIOMeter_updateValues(Meter* this, char* buffer, int len) {
|
static void DiskIOMeter_updateValues(Meter* this, char* buffer, int len) {
|
||||||
static unsigned long int cached_read_total = 0;
|
|
||||||
static unsigned long int cached_write_total = 0;
|
|
||||||
static unsigned long int cached_msTimeSpend_total = 0;
|
|
||||||
static unsigned long long int cached_last_update = 0;
|
static unsigned long long int cached_last_update = 0;
|
||||||
|
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
@ -43,6 +40,10 @@ static void DiskIOMeter_updateValues(Meter* this, char* buffer, int len) {
|
||||||
|
|
||||||
/* update only every 500ms */
|
/* update only every 500ms */
|
||||||
if (passedTimeInMs > 500) {
|
if (passedTimeInMs > 500) {
|
||||||
|
static unsigned long int cached_read_total = 0;
|
||||||
|
static unsigned long int cached_write_total = 0;
|
||||||
|
static unsigned long int cached_msTimeSpend_total = 0;
|
||||||
|
|
||||||
cached_last_update = timeInMilliSeconds;
|
cached_last_update = timeInMilliSeconds;
|
||||||
|
|
||||||
DiskIOData data;
|
DiskIOData data;
|
||||||
|
|
|
@ -18,16 +18,13 @@ static const int NetworkIOMeter_attributes[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool hasData = false;
|
static bool hasData = false;
|
||||||
|
|
||||||
static unsigned long int cached_rxb_diff = 0;
|
static unsigned long int cached_rxb_diff = 0;
|
||||||
static unsigned long int cached_rxp_diff = 0;
|
static unsigned long int cached_rxp_diff = 0;
|
||||||
static unsigned long int cached_txb_diff = 0;
|
static unsigned long int cached_txb_diff = 0;
|
||||||
static unsigned long int cached_txp_diff = 0;
|
static unsigned long int cached_txp_diff = 0;
|
||||||
|
|
||||||
static void NetworkIOMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, int len) {
|
static void NetworkIOMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, int len) {
|
||||||
static unsigned long int cached_rxb_total = 0;
|
|
||||||
static unsigned long int cached_rxp_total = 0;
|
|
||||||
static unsigned long int cached_txb_total = 0;
|
|
||||||
static unsigned long int cached_txp_total = 0;
|
|
||||||
static unsigned long long int cached_last_update = 0;
|
static unsigned long long int cached_last_update = 0;
|
||||||
|
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
@ -37,6 +34,11 @@ static void NetworkIOMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, i
|
||||||
|
|
||||||
/* update only every 500ms */
|
/* update only every 500ms */
|
||||||
if (passedTimeInMs > 500) {
|
if (passedTimeInMs > 500) {
|
||||||
|
static unsigned long int cached_rxb_total = 0;
|
||||||
|
static unsigned long int cached_rxp_total = 0;
|
||||||
|
static unsigned long int cached_txb_total = 0;
|
||||||
|
static unsigned long int cached_txp_total = 0;
|
||||||
|
|
||||||
cached_last_update = timeInMilliSeconds;
|
cached_last_update = timeInMilliSeconds;
|
||||||
|
|
||||||
unsigned long int bytesReceived, packetsReceived, bytesTransmitted, packetsTransmitted;
|
unsigned long int bytesReceived, packetsReceived, bytesTransmitted, packetsTransmitted;
|
||||||
|
|
Loading…
Reference in New Issue