summaryrefslogtreecommitdiffstats
path: root/NetworkIOMeter.c
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-11-22 00:53:12 +0100
committerBenBE <BenBE@geshi.org>2020-11-22 14:24:18 +0100
commitbe39de14dd324231cc0c255934787fb24f7b9185 (patch)
treebb5818bb132b650c3bc2c727bc9acc2c2c706d95 /NetworkIOMeter.c
parentbe568b1153206a067fd09c0f7d2dcea3d7dbaa68 (diff)
Reduce scope of cached values
Diffstat (limited to 'NetworkIOMeter.c')
-rw-r--r--NetworkIOMeter.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/NetworkIOMeter.c b/NetworkIOMeter.c
index c332aa87..a28738a2 100644
--- a/NetworkIOMeter.c
+++ b/NetworkIOMeter.c
@@ -18,16 +18,13 @@ static const int NetworkIOMeter_attributes[] = {
};
static bool hasData = false;
+
static unsigned long int cached_rxb_diff = 0;
static unsigned long int cached_rxp_diff = 0;
static unsigned long int cached_txb_diff = 0;
static unsigned long int cached_txp_diff = 0;
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;
struct timeval tv;
@@ -37,6 +34,11 @@ static void NetworkIOMeter_updateValues(ATTR_UNUSED Meter* this, char* buffer, i
/* update only every 500ms */
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;
unsigned long int bytesReceived, packetsReceived, bytesTransmitted, packetsTransmitted;

© 2014-2024 Faster IT GmbH | imprint | privacy policy