diff options
author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-01-07 17:46:15 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2023-01-07 19:30:23 +0100 |
commit | 560a04ad25c77a8c5bf4cec112a3d8da8df6272c (patch) | |
tree | 76bd2534fc2dae7c03bcd6fbbd815f21677e37df /pcp | |
parent | 29f0b3c5e1184421ee7796ab2e1841733c45f403 (diff) |
Improve code readability by creating constants for memory values
Diffstat (limited to 'pcp')
-rw-r--r-- | pcp/Platform.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pcp/Platform.c b/pcp/Platform.c index 2987c8e9..521e5f11 100644 --- a/pcp/Platform.c +++ b/pcp/Platform.c @@ -528,20 +528,20 @@ void Platform_setMemoryValues(Meter* this) { const PCPProcessList* ppl = (const PCPProcessList*) pl; this->total = pl->totalMem; - this->values[0] = pl->usedMem; - this->values[1] = pl->buffersMem; - this->values[2] = pl->sharedMem; - this->values[3] = pl->cachedMem; - this->values[4] = pl->availableMem; + this->values[MEMORY_METER_USED] = pl->usedMem; + this->values[MEMORY_METER_BUFFERS] = pl->buffersMem; + this->values[MEMORY_METER_SHARED] = pl->sharedMem; + this->values[MEMORY_METER_CACHE] = pl->cachedMem; + this->values[MEMORY_METER_AVAILABLE] = pl->availableMem; if (ppl->zfs.enabled != 0) { // ZFS does not shrink below the value of zfs_arc_min. unsigned long long int shrinkableSize = 0; if (ppl->zfs.size > ppl->zfs.min) shrinkableSize = ppl->zfs.size - ppl->zfs.min; - this->values[0] -= shrinkableSize; - this->values[3] += shrinkableSize; - this->values[4] += shrinkableSize; + this->values[MEMORY_METER_USED] -= shrinkableSize; + this->values[MEMORY_METER_CACHE] += shrinkableSize; + this->values[MEMORY_METER_AVAILABLE] += shrinkableSize; } } |