summaryrefslogtreecommitdiffstats
path: root/linux
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2020-11-27 13:22:21 +1100
committerBenBE <BenBE@geshi.org>2020-11-27 07:55:58 +0100
commitf704baeb8211815f80a166c6837f421a82e1c515 (patch)
treebe935b1d2e39ac409aa7960824bab3cba8fb05a5 /linux
parentfee217551c12754db517d1badd448fc9064a48a8 (diff)
Drop unused global ProcessList memory fields
The global ProcessList structure contains a couple of unused fields. 'sharedMem' has never been used by any Meter, since its not been anything other than zero in Linux /proc/meminfo for many, many years. The freeMem field is only used in the usedMem calculation, so it can reside on the stack like some other memory variables used within-calculations-only and not exposed to the user via a Meter.
Diffstat (limited to 'linux')
-rw-r--r--linux/LinuxProcessList.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index 80c35699..c2c88648 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -1502,6 +1502,7 @@ errorReadingProcess:
}
static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
+ unsigned long long int freeMem = 0;
unsigned long long int swapFree = 0;
unsigned long long int shmem = 0;
unsigned long long int sreclaimable = 0;
@@ -1522,8 +1523,7 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
switch (buffer[0]) {
case 'M':
tryRead("MemTotal:", &this->totalMem);
- tryRead("MemFree:", &this->freeMem);
- tryRead("MemShared:", &this->sharedMem);
+ tryRead("MemFree:", &freeMem);
break;
case 'B':
tryRead("Buffers:", &this->buffersMem);
@@ -1549,7 +1549,7 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
#undef tryRead
}
- this->usedMem = this->totalMem - this->freeMem;
+ this->usedMem = this->totalMem - freeMem;
this->cachedMem = this->cachedMem + sreclaimable - shmem;
this->usedSwap = this->totalSwap - swapFree;
fclose(file);

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