summaryrefslogtreecommitdiffstats
path: root/pcp/Platform.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2021-03-17 09:54:15 +1100
committerNathan Scott <nathans@redhat.com>2021-06-09 17:09:29 +1000
commitb424a5b137797ef1b921b7ed1e6ee6521b7b65b0 (patch)
treeb49def5a70ffa17fddafcc9faa715bdbee1ece23 /pcp/Platform.c
parentd3af4e670d65a4d7b4a0509efd53473578afb96c (diff)
Implement shared memory support on the PCP platform
Uses the mem.util.shared metric (Shmem from meminfo).
Diffstat (limited to 'pcp/Platform.c')
-rw-r--r--pcp/Platform.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/pcp/Platform.c b/pcp/Platform.c
index 91b92673..70af0a85 100644
--- a/pcp/Platform.c
+++ b/pcp/Platform.c
@@ -1,7 +1,7 @@
/*
htop - linux/Platform.c
(C) 2014 Hisham H. Muhammad
-(C) 2020 htop dev team
+(C) 2020-2021 htop dev team
(C) 2020-2021 Red Hat, Inc. All Rights Reserved.
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
@@ -152,6 +152,7 @@ static const char *Platform_metricNames[] = {
[PCP_MEM_AVAILABLE] = "mem.util.available",
[PCP_MEM_BUFFERS] = "mem.util.bufmem",
[PCP_MEM_CACHED] = "mem.util.cached",
+ [PCP_MEM_SHARED] = "mem.util.shared",
[PCP_MEM_SRECLAIM] = "mem.util.slabReclaimable",
[PCP_MEM_SWAPCACHED] = "mem.util.swapCached",
[PCP_MEM_SWAPTOTAL] = "mem.util.swapTotal",
@@ -587,18 +588,17 @@ double Platform_setCPUValues(Meter* this, int cpu) {
void Platform_setMemoryValues(Meter* this) {
const ProcessList* pl = this->pl;
const PCPProcessList* ppl = (const PCPProcessList*) pl;
- long int usedMem = pl->usedMem;
- long int buffersMem = pl->buffersMem;
- long int cachedMem = pl->cachedMem;
- usedMem -= buffersMem + cachedMem;
- this->total = pl->totalMem;
- this->values[0] = usedMem;
- this->values[1] = buffersMem;
- this->values[2] = cachedMem;
+
+ 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;
if (ppl->zfs.enabled != 0) {
this->values[0] -= ppl->zfs.size;
- this->values[2] += ppl->zfs.size;
+ this->values[3] += ppl->zfs.size;
}
}

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