kernel - Change fill_kinfo_lwp() and fix top
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 19 Jun 2019 05:59:07 +0000 (22:59 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 19 Jun 2019 05:59:07 +0000 (22:59 -0700)
commit5deae5c64cbddbf476d650cf6d16e0f1981e10d8
treedd4f1e49578da95b3349068bd1e889070c1513f5
parent29d19636ae9cd697677888037274b010470f879c
kernel - Change fill_kinfo_lwp() and fix top

* Change fill_kinfo_lwp(), an internal function used by kern_proc.c
  and libkvm, to aggregate lwp data instead of replace it.

  Note that fill_kinfo_proc() will zero the lwp sub-structure and is
  already typically called before zero or more fill_kinfo_lwp() calls,
  so the new aggregation essentially just works even though the API is
  a bit different.

  In addition, when getprocs is told to aggregate lwps the tid field
  will be set to -1 since it is not applicable in the aggregation case.

* 'top' will now properly aggregate the threads belonging to a process
  when thread mode 'H' is not in effect.

* Also allow top to display cpu percentages above 100%, since in the
  aggregation case the sum of threads can easily exceed 100% of one core.

Requested-by: hsw
lib/libkvm/kvm_proc.c
sys/kern/kern_kinfo.c
sys/kern/kern_proc.c
usr.bin/top/m_dragonfly.c