summaryrefslogtreecommitdiffstats
path: root/pcp/PCPProcessTable.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2023-11-27 09:18:50 +1100
committerNathan Scott <nathans@redhat.com>2023-11-27 14:41:26 +1100
commit29137ccc7c83db98ada5c197b765a65a40b4e41f (patch)
tree327c9a0b5902f3d1d7d9064daa2791bd114ede7f /pcp/PCPProcessTable.c
parent1d3a823d5d87c0966b3001f7ee18285e15506806 (diff)
PCP platform implementation of the compressed cgroup column
Diffstat (limited to 'pcp/PCPProcessTable.c')
-rw-r--r--pcp/PCPProcessTable.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/pcp/PCPProcessTable.c b/pcp/PCPProcessTable.c
index 0355e25a..a4634a1b 100644
--- a/pcp/PCPProcessTable.c
+++ b/pcp/PCPProcessTable.c
@@ -26,6 +26,7 @@ in the source distribution for its full text.
#include "Settings.h"
#include "XUtils.h"
+#include "linux/CGroupUtils.h"
#include "pcp/Metric.h"
#include "pcp/PCPMachine.h"
#include "pcp/PCPProcess.h"
@@ -252,6 +253,23 @@ static void PCPProcessTable_updateTTY(Process* process, int pid, int offset) {
static void PCPProcessTable_readCGroups(PCPProcess* pp, int pid, int offset) {
pp->cgroup = setString(PCP_PROC_CGROUPS, pid, offset, pp->cgroup);
+
+ if (pp->cgroup) {
+ char* cgroup_short = CGroup_filterName(pp->cgroup);
+ if (cgroup_short) {
+ Row_updateFieldWidth(CCGROUP, strlen(cgroup_short));
+ free_and_xStrdup(&pp->cgroup_short, cgroup_short);
+ free(cgroup_short);
+ } else {
+ //CCGROUP is alias to normal CGROUP if shortening fails
+ Row_updateFieldWidth(CCGROUP, strlen(pp->cgroup));
+ free(pp->cgroup_short);
+ pp->cgroup_short = NULL;
+ }
+ } else {
+ free(pp->cgroup_short);
+ pp->cgroup_short = NULL;
+ }
}
static void PCPProcessTable_readSecattrData(PCPProcess* pp, int pid, int offset) {

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