diff options
author | Benny Baumann <BenBE@geshi.org> | 2020-11-22 00:53:12 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2020-11-22 14:24:18 +0100 |
commit | be39de14dd324231cc0c255934787fb24f7b9185 (patch) | |
tree | bb5818bb132b650c3bc2c727bc9acc2c2c706d95 /DiskIOMeter.c | |
parent | be568b1153206a067fd09c0f7d2dcea3d7dbaa68 (diff) |
Reduce scope of cached values
Diffstat (limited to 'DiskIOMeter.c')
-rw-r--r-- | DiskIOMeter.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/DiskIOMeter.c b/DiskIOMeter.c index b94af6de..c9db240c 100644 --- a/DiskIOMeter.c +++ b/DiskIOMeter.c @@ -31,9 +31,6 @@ static unsigned long int cached_write_diff = 0; static double cached_utilisation_diff = 0.0; 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; struct timeval tv; @@ -43,6 +40,10 @@ static void DiskIOMeter_updateValues(Meter* this, char* buffer, int len) { /* update only every 500ms */ 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; DiskIOData data; |