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