summaryrefslogtreecommitdiffstats
path: root/pcp/PCPProcessList.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/PCPProcessList.c
parentd3af4e670d65a4d7b4a0509efd53473578afb96c (diff)
Implement shared memory support on the PCP platform
Uses the mem.util.shared metric (Shmem from meminfo).
Diffstat (limited to 'pcp/PCPProcessList.c')
-rw-r--r--pcp/PCPProcessList.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/pcp/PCPProcessList.c b/pcp/PCPProcessList.c
index a823695e..780862b3 100644
--- a/pcp/PCPProcessList.c
+++ b/pcp/PCPProcessList.c
@@ -1,7 +1,7 @@
/*
htop - PCPProcessList.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.
@@ -584,12 +584,13 @@ static void PCPProcessList_updateMemoryInfo(ProcessList* super) {
super->buffersMem = value.ull;
if (Metric_values(PCP_MEM_SRECLAIM, &value, 1, PM_TYPE_U64) != NULL)
sreclaimableMem = value.ull;
+ if (Metric_values(PCP_MEM_SHARED, &value, 1, PM_TYPE_U64) != NULL)
+ super->sharedMem = value.ull;
if (Metric_values(PCP_MEM_CACHED, &value, 1, PM_TYPE_U64) != NULL) {
super->cachedMem = value.ull;
super->cachedMem += sreclaimableMem;
}
- unsigned long long int usedDiff;
- usedDiff = freeMem + super->cachedMem + super->buffersMem;
+ const memory_t usedDiff = freeMem + super->cachedMem + sreclaimableMem + super->buffersMem + super->sharedMem;
super->usedMem = (super->totalMem >= usedDiff) ?
super->totalMem - usedDiff : super->totalMem - freeMem;
if (Metric_values(PCP_MEM_AVAILABLE, &value, 1, PM_TYPE_U64) != NULL)

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