From 560a04ad25c77a8c5bf4cec112a3d8da8df6272c Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 7 Jan 2023 17:46:15 +0100 Subject: Improve code readability by creating constants for memory values --- freebsd/Platform.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'freebsd') diff --git a/freebsd/Platform.c b/freebsd/Platform.c index 1a731b71..3e8faaea 100644 --- a/freebsd/Platform.c +++ b/freebsd/Platform.c @@ -230,20 +230,20 @@ void Platform_setMemoryValues(Meter* this) { const FreeBSDProcessList* fpl = (const FreeBSDProcessList*) pl; this->total = pl->totalMem; - this->values[0] = pl->usedMem; - this->values[1] = pl->buffersMem; - // this->values[2] = "shared memory, like tmpfs and shm" - this->values[3] = pl->cachedMem; - // this->values[4] = "available memory" + this->values[MEMORY_METER_USED] = pl->usedMem; + this->values[MEMORY_METER_BUFFERS] = pl->buffersMem; + // this->values[MEMORY_METER_SHARED] = "shared memory, like tmpfs and shm" + this->values[MEMORY_METER_CACHE] = pl->cachedMem; + // this->values[MEMORY_METER_AVAILABLE] = "available memory" if (fpl->zfs.enabled) { // ZFS does not shrink below the value of zfs_arc_min. unsigned long long int shrinkableSize = 0; if (fpl->zfs.size > fpl->zfs.min) shrinkableSize = fpl->zfs.size - fpl->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; } } -- cgit v1.2.3