Skip to content

Commit c55d56d

Browse files
committed
DiskIOMeter: Move cache update code to a new function
The new function is named DiskIOUpdateCache(). Allows code reuse.
1 parent 496b3fb commit c55d56d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

DiskIOMeter.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ static char cached_write_diff_str[6];
3333
static double cached_utilisation_diff;
3434
static double cached_utilisation_norm;
3535

36-
static void DiskIOMeter_updateValues(Meter* this) {
37-
const Machine* host = this->host;
38-
36+
static void DiskIOUpdateCache(const Machine* host) {
3937
static uint64_t cached_last_update;
4038
uint64_t passedTimeInMs = host->realtimeMs - cached_last_update;
4139
bool hasNewData = false;
@@ -99,6 +97,10 @@ static void DiskIOMeter_updateValues(Meter* this) {
9997
cached_write_total = data.totalBytesWritten;
10098
cached_msTimeSpend_total = data.totalMsTimeSpend;
10199
}
100+
}
101+
102+
static void DiskIOMeter_updateValues(Meter* this) {
103+
DiskIOUpdateCache(this->host);
102104

103105
this->values[0] = cached_utilisation_norm;
104106

0 commit comments

Comments
 (0)