diff options
author | Benny Baumann <BenBE@geshi.org> | 2022-02-27 20:29:40 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2022-03-06 19:56:25 +0100 |
commit | edf319e53d1fb77546505e238d75160a3febe56e (patch) | |
tree | c735eef42730d65228958c2e104817ae7362e614 /openbsd | |
parent | b6c0667eae104521e71ab9c4f4a785e386bce3e5 (diff) |
Auto-size (normalized) CPU usage columns
Diffstat (limited to 'openbsd')
-rw-r--r-- | openbsd/OpenBSDProcess.c | 2 | ||||
-rw-r--r-- | openbsd/OpenBSDProcessList.c | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/openbsd/OpenBSDProcess.c b/openbsd/OpenBSDProcess.c index ac3def3a..feef7c48 100644 --- a/openbsd/OpenBSDProcess.c +++ b/openbsd/OpenBSDProcess.c @@ -146,6 +146,7 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { .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", @@ -153,6 +154,7 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { .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", diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c index 9a21b225..d070e5e9 100644 --- a/openbsd/OpenBSDProcessList.c +++ b/openbsd/OpenBSDProcessList.c @@ -330,8 +330,11 @@ static void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) { fp->addr = kproc->p_addr; proc->m_virt = kproc->p_vm_dsize * pageSizeKB; proc->m_resident = kproc->p_vm_rssize * pageSizeKB; + proc->percent_mem = proc->m_resident / (float)this->super.totalMem * 100.0F; proc->percent_cpu = CLAMP(getpcpu(kproc), 0.0F, this->super.activeCPUs * 100.0F); + Process_updateCPUFieldWidths(proc->percent_cpu); + proc->nice = kproc->p_nice - 20; proc->time = 100 * (kproc->p_rtime_sec + ((kproc->p_rtime_usec + 500000) / 1000000)); proc->priority = kproc->p_priority - PZERO; |