summaryrefslogtreecommitdiffstats
path: root/netbsd
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2022-02-27 20:29:40 +0100
committerBenBE <BenBE@geshi.org>2022-03-06 19:56:25 +0100
commitedf319e53d1fb77546505e238d75160a3febe56e (patch)
treec735eef42730d65228958c2e104817ae7362e614 /netbsd
parentb6c0667eae104521e71ab9c4f4a785e386bce3e5 (diff)
Auto-size (normalized) CPU usage columns
Diffstat (limited to 'netbsd')
-rw-r--r--netbsd/NetBSDProcess.c2
-rw-r--r--netbsd/NetBSDProcessList.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/netbsd/NetBSDProcess.c b/netbsd/NetBSDProcess.c
index 8d2b4c40..a7d59bed 100644
--- a/netbsd/NetBSDProcess.c
+++ b/netbsd/NetBSDProcess.c
@@ -148,6 +148,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",
@@ -155,6 +156,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/netbsd/NetBSDProcessList.c b/netbsd/NetBSDProcessList.c
index 22124fe9..197a150b 100644
--- a/netbsd/NetBSDProcessList.c
+++ b/netbsd/NetBSDProcessList.c
@@ -318,8 +318,11 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
proc->m_virt = kproc->p_vm_vsize;
proc->m_resident = kproc->p_vm_rssize;
+
proc->percent_mem = (proc->m_resident * pageSizeKB) / (double)(this->super.totalMem) * 100.0;
proc->percent_cpu = CLAMP(getpcpu(kproc), 0.0, this->super.activeCPUs * 100.0);
+ Process_updateCPUFieldWidths(proc->percent_cpu);
+
proc->nlwp = kproc->p_nlwps;
proc->nice = kproc->p_nice - 20;
proc->time = 100 * (kproc->p_rtime_sec + ((kproc->p_rtime_usec + 500000) / 1000000));

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