mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Auto-size (normalized) CPU usage columns
This commit is contained in:
@ -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",
|
||||
|
@ -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));
|
||||
|
Reference in New Issue
Block a user