From 986dbfc19c6c84f5b86f345257212a1a7abb62f7 Mon Sep 17 00:00:00 2001 From: BowDown097 Date: Fri, 24 Nov 2023 13:12:34 -0800 Subject: Linux + PCP: Add private memory size column --- linux/LinuxProcess.c | 4 ++++ linux/LinuxProcess.h | 1 + linux/LinuxProcessTable.c | 2 ++ linux/ProcessField.h | 1 + 4 files changed, 8 insertions(+) (limited to 'linux') diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index 3321f512..bc91c5d8 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -51,6 +51,7 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { [M_VIRT] = { .name = "M_VIRT", .title = " VIRT ", .description = "Total program size in virtual memory", .flags = 0, .defaultSortDesc = true, }, [M_RESIDENT] = { .name = "M_RESIDENT", .title = " RES ", .description = "Resident set size, size of the text and data sections, plus stack usage", .flags = 0, .defaultSortDesc = true, }, [M_SHARE] = { .name = "M_SHARE", .title = " SHR ", .description = "Size of the process's shared pages", .flags = 0, .defaultSortDesc = true, }, + [M_PRIV] = { .name = "M_PRIV", .title = " PRIV ", .description = "The private memory size of the process - resident set size minus shared memory", .flags = 0, .defaultSortDesc = true, }, [M_TRS] = { .name = "M_TRS", .title = " CODE ", .description = "Size of the .text segment of the process (CODE)", .flags = 0, .defaultSortDesc = true, }, [M_DRS] = { .name = "M_DRS", .title = " DATA ", .description = "Size of the .data segment plus stack usage of the process (DATA)", .flags = 0, .defaultSortDesc = true, }, [M_LRS] = { .name = "M_LRS", .title = " LIB ", .description = "The library size of the process (calculated from memory maps)", .flags = PROCESS_FLAG_LINUX_LRS_FIX, .defaultSortDesc = true, }, @@ -243,6 +244,7 @@ static void LinuxProcess_rowWriteField(const Row* super, RichString* str, Proces break; case M_TRS: Row_printBytes(str, lp->m_trs * lhost->pageSize, coloring); return; case M_SHARE: Row_printBytes(str, lp->m_share * lhost->pageSize, coloring); return; + case M_PRIV: Row_printBytes(str, lp->m_priv, coloring); return; case M_PSS: Row_printKBytes(str, lp->m_pss, coloring); return; case M_SWAP: Row_printKBytes(str, lp->m_swap, coloring); return; case M_PSSWP: Row_printKBytes(str, lp->m_psswp, coloring); return; @@ -339,6 +341,8 @@ static int LinuxProcess_compareByKey(const Process* v1, const Process* v2, Proce return SPACESHIP_NUMBER(p1->m_trs, p2->m_trs); case M_SHARE: return SPACESHIP_NUMBER(p1->m_share, p2->m_share); + case M_PRIV: + return SPACESHIP_NUMBER(p1->m_priv, p2->m_priv); case M_PSS: return SPACESHIP_NUMBER(p1->m_pss, p2->m_pss); case M_SWAP: diff --git a/linux/LinuxProcess.h b/linux/LinuxProcess.h index 081fef9c..d4d67cb5 100644 --- a/linux/LinuxProcess.h +++ b/linux/LinuxProcess.h @@ -41,6 +41,7 @@ typedef struct LinuxProcess_ { unsigned long long int cutime; unsigned long long int cstime; long m_share; + long m_priv; long m_pss; long m_swap; long m_psswp; diff --git a/linux/LinuxProcessTable.c b/linux/LinuxProcessTable.c index 71ad915f..a6c4c716 100644 --- a/linux/LinuxProcessTable.c +++ b/linux/LinuxProcessTable.c @@ -703,6 +703,8 @@ static bool LinuxProcessTable_readStatmFile(LinuxProcess* process, openat_arg_t process->super.m_resident *= host->pageSizeKB; } + process->m_priv = (process->super.m_resident - (process->m_share * host->pageSizeKB)) * ONE_K; + return r == 7; } diff --git a/linux/ProcessField.h b/linux/ProcessField.h index 17cafa96..9adaeacf 100644 --- a/linux/ProcessField.h +++ b/linux/ProcessField.h @@ -46,6 +46,7 @@ in the source distribution for its full text. AUTOGROUP_ID = 127, \ AUTOGROUP_NICE = 128, \ CCGROUP = 129, \ + M_PRIV = 130, \ // End of list -- cgit v1.2.3 From ed1c7450e28f59984bdcb0d6614a7c614f3f7808 Mon Sep 17 00:00:00 2001 From: BowDown097 Date: Fri, 24 Nov 2023 13:25:05 -0800 Subject: Use printKBytes --- linux/LinuxProcess.c | 2 +- linux/LinuxProcessTable.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'linux') diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index bc91c5d8..8c11f23a 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -244,7 +244,7 @@ static void LinuxProcess_rowWriteField(const Row* super, RichString* str, Proces break; case M_TRS: Row_printBytes(str, lp->m_trs * lhost->pageSize, coloring); return; case M_SHARE: Row_printBytes(str, lp->m_share * lhost->pageSize, coloring); return; - case M_PRIV: Row_printBytes(str, lp->m_priv, coloring); return; + case M_PRIV: Row_printKBytes(str, lp->m_priv, coloring); return; case M_PSS: Row_printKBytes(str, lp->m_pss, coloring); return; case M_SWAP: Row_printKBytes(str, lp->m_swap, coloring); return; case M_PSSWP: Row_printKBytes(str, lp->m_psswp, coloring); return; diff --git a/linux/LinuxProcessTable.c b/linux/LinuxProcessTable.c index a6c4c716..cb44b388 100644 --- a/linux/LinuxProcessTable.c +++ b/linux/LinuxProcessTable.c @@ -703,7 +703,7 @@ static bool LinuxProcessTable_readStatmFile(LinuxProcess* process, openat_arg_t process->super.m_resident *= host->pageSizeKB; } - process->m_priv = (process->super.m_resident - (process->m_share * host->pageSizeKB)) * ONE_K; + process->m_priv = process->super.m_resident - (process->m_share * host->pageSizeKB); return r == 7; } -- cgit v1.2.3 From d20fcab197cf475919319a6243d92d6bf0107ce2 Mon Sep 17 00:00:00 2001 From: BowDown097 <42720004+BowDown097@users.noreply.github.com> Date: Sun, 26 Nov 2023 16:57:50 -0800 Subject: Update linux/LinuxProcessTable.c Co-authored-by: BenBE --- linux/LinuxProcessTable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux') diff --git a/linux/LinuxProcessTable.c b/linux/LinuxProcessTable.c index cb44b388..293925a1 100644 --- a/linux/LinuxProcessTable.c +++ b/linux/LinuxProcessTable.c @@ -701,9 +701,9 @@ static bool LinuxProcessTable_readStatmFile(LinuxProcess* process, openat_arg_t if (r == 7) { process->super.m_virt *= host->pageSizeKB; process->super.m_resident *= host->pageSizeKB; - } - process->m_priv = process->super.m_resident - (process->m_share * host->pageSizeKB); + process->m_priv = process->super.m_resident - (process->m_share * host->pageSizeKB); + } return r == 7; } -- cgit v1.2.3