diff options
author | jhb <jhb@FreeBSD.org> | 2011-07-15 17:23:45 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2011-07-15 17:23:45 +0000 |
commit | 482c49a8edde3d3726192ba0462d23a52818a745 (patch) | |
tree | 07cd778b84b569a67916a4e0fee0582480d040d8 /usr.bin/top | |
parent | 40b131bdaf10a8762fefdeac2b6c7a8ae66e57e4 (diff) | |
download | FreeBSD-src-482c49a8edde3d3726192ba0462d23a52818a745.zip FreeBSD-src-482c49a8edde3d3726192ba0462d23a52818a745.tar.gz |
Revert 130163 and let top use KERN_PROC_PROC when individual threads are
not displayed. The KERN_PROC_PROC sysctl was fixed in 188764.
Diffstat (limited to 'usr.bin/top')
-rw-r--r-- | usr.bin/top/machine.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 1d2d743..02dc847 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -624,7 +624,6 @@ get_process_info(struct system_info *si, struct process_select *sel, int active_procs; struct kinfo_proc **prefp; struct kinfo_proc *pp; - struct kinfo_proc *prev_pp = NULL; /* these are copied out of sel for speed */ int show_idle; @@ -657,7 +656,8 @@ get_process_info(struct system_info *si, struct process_select *sel, } previous_proc_count = nproc; - pbase = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc); + pbase = kvm_getprocs(kd, sel->thread ? KERN_PROC_ALL : KERN_PROC_PROC, + 0, &nproc); if (nproc > onproc) pref = realloc(pref, sizeof(*pref) * (onproc = nproc)); if (pref == NULL || pbase == NULL) { @@ -727,21 +727,8 @@ get_process_info(struct system_info *si, struct process_select *sel, /* skip proc. that don't belong to the selected UID */ continue; - /* - * When not showing threads, take the first thread - * for output and add the fields that we can from - * the rest of the process's threads rather than - * using the system's mostly-broken KERN_PROC_PROC. - */ - if (sel->thread || prev_pp == NULL || - prev_pp->ki_pid != pp->ki_pid) { - *prefp++ = pp; - active_procs++; - prev_pp = pp; - } else { - prev_pp->ki_pctcpu += pp->ki_pctcpu; - prev_pp->ki_runtime += pp->ki_runtime; - } + *prefp++ = pp; + active_procs++; } /* if requested, sort the "interesting" processes */ |