From edf319e53d1fb77546505e238d75160a3febe56e Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Sun, 27 Feb 2022 20:29:40 +0100 Subject: Auto-size (normalized) CPU usage columns --- pcp/PCPProcess.c | 4 ++-- pcp/PCPProcessList.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'pcp') diff --git a/pcp/PCPProcess.c b/pcp/PCPProcess.c index e686d513..d0bcfbb2 100644 --- a/pcp/PCPProcess.c +++ b/pcp/PCPProcess.c @@ -54,8 +54,8 @@ const ProcessFieldData Process_fields[] = { [M_LRS] = { .name = "M_LRS", .title = " LIB ", .description = "The library size of the process (unused since Linux 2.6; always 0)", .flags = 0, .defaultSortDesc = true, }, [M_DT] = { .name = "M_DT", .title = " DIRTY ", .description = "Size of the dirty pages of the process (unused since Linux 2.6; always 0)", .flags = 0, .defaultSortDesc = true, }, [ST_UID] = { .name = "ST_UID", .title = "UID", .description = "User ID of the process owner", .flags = 0, }, - [PERCENT_CPU] = { .name = "PERCENT_CPU", .title = "CPU% ", .description = "Percentage of the CPU time the process used in the last sampling", .flags = 0, .defaultSortDesc = true, }, - [PERCENT_NORM_CPU] = { .name = "PERCENT_NORM_CPU", .title = "NCPU%", .description = "Normalized percentage of the CPU time the process used in the last sampling (normalized by cpu count)", .flags = 0, .defaultSortDesc = true, }, + [PERCENT_CPU] = { .name = "PERCENT_CPU", .title = "CPU% ", .description = "Percentage of the CPU time the process used in the last sampling", .flags = 0, .defaultSortDesc = true, .autoWidth = true, }, + [PERCENT_NORM_CPU] = { .name = "PERCENT_NORM_CPU", .title = "NCPU%", .description = "Normalized percentage of the CPU time the process used in the last sampling (normalized by cpu count)", .flags = 0, .defaultSortDesc = true, .autoWidth = true, }, [PERCENT_MEM] = { .name = "PERCENT_MEM", .title = "MEM% ", .description = "Percentage of the memory the process is using, based on resident memory size", .flags = 0, .defaultSortDesc = true, }, [USER] = { .name = "USER", .title = "USER ", .description = "Username of the process owner (or user ID if name cannot be determined)", .flags = 0, }, [TIME] = { .name = "TIME", .title = " TIME+ ", .description = "Total time the process has spent in user and system time", .flags = 0, .defaultSortDesc = true, }, diff --git a/pcp/PCPProcessList.c b/pcp/PCPProcessList.c index 0664a162..ca82575a 100644 --- a/pcp/PCPProcessList.c +++ b/pcp/PCPProcessList.c @@ -408,6 +408,7 @@ static bool PCPProcessList_updateProcesses(PCPProcessList* this, double period, proc->percent_cpu = isnan(percent_cpu) ? 0.0 : CLAMP(percent_cpu, 0.0, pl->activeCPUs * 100.0); proc->percent_mem = proc->m_resident / (double)pl->totalMem * 100.0; + Process_updateCPUFieldWidths(proc->percent_cpu); PCPProcessList_updateUsername(proc, pid, offset, pl->usersTable); -- cgit v1.2.3