summaryrefslogtreecommitdiffstats
path: root/usr.bin/top
Commit message (Collapse)AuthorAgeFilesLines
* MFC r265267:bdrewery2014-05-171-15/+23
| | | | | Fix width/alignment of JID column. Make it support up to the maximum 7-wide JIDs. On a system using jails for common tasks the JID can quickly increase.
* MFC r265249,r265250,r265251:bdrewery2014-05-172-2/+8
| | | | | | | - Add -J command/flag to filter by jail name/jid. This will automatically display the JID as well (the -j command/flag). - Add a hint for 'u' and 'J' command that '+' displays all. - Add J command to help.
* Bump the CPU/WCPU column width by one so that it fits values from 100% upjhb2013-06-111-6/+6
| | | | | | | | | to 999.99% CPU. It still won't be aligned if you have a multithreaded process using more than 1000% CPU (e.g. idle process on an idle 12-way system), but 100% is a common case. Submitted by: Jeremy Chadwick (partial) MFC after: 1 week
* Fix the 'C' field for a running thread to match the behavior describedjhb2013-03-111-2/+9
| | | | | | | | | in the manpage by having it display the current CPU (ki_oncpu) rather than the previously used CPU (ki_lastcpu). ki_lastcpu is still used for all other thread states. Reported by: Chris Ross <cross+freebsd@distal.com> MFC after: 1 week
* Use the correct size when allocating the cmdbuf string.rpaulo2012-11-191-14/+15
| | | | | | | | | | | | cmdlengthdelta is the size of the header and we were using it to allocate a buffer to store the command line. This would mean that the cmdbuf could be too short. In practice this was never noticed unless you usually run top -a. On a stock FreeBSD system you can see the problem by running sendmail and then running top -a on a big terminal window. In practice this doubles to size available to cmdbuf since the header is around 65-68 bytes. Reviewed by: adrian
* Add the PID column to the list of sort keys.rpaulo2012-11-111-1/+1
|
* Correct the order of the MFU and MRU labels. I had reversed them.jhb2012-10-191-1/+1
| | | | | | Submitted by: Nikolay Denev ndenev gmail Pointy hat to: jhb MFC after: 3 days
* Fix two layout bugs in the previous change:jhb2012-07-021-1/+3
| | | | | | | - Properly increase y_mem when per-CPU stats are enabled. - Update y_arc for per-CPU stats being enabled/disabled. MFC after: 3 days
* Add a new line to top that provides a brief summary of the ZFS ARC memoryjhb2012-06-272-21/+84
| | | | | | | | | | usage on hosts using ZFS. The new line displays the total amount of RAM used by the ARC along with the size of MFU, MRU, anonymous (in flight), headers, and other (miscellaneous) sub-categories. The line is not displayed on systems that are not using ZFS. Reviewed by: avg, fs@ MFC after: 3 days
* Clarify that the cached file data pages included in the "Wired" countjhb2012-06-271-1/+1
| | | | | | | in top are the BIO-level cached data (i.e. "Buf"), since the previous phrase was a bit ambiguous with the "Cache" count. MFC after: 3 days
* Fix string buffer overflow when preparing the line of output.kib2012-04-181-2/+2
| | | | | | PR: bin/161739 Submitted by: Jeremy Chadwick <freebsd jdc parodius com> MFC after: 1 week
* Remove trailing whitespace per mdoc lint warningeadler2012-03-291-10/+10
| | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days
* Spelling fixes for usr.bin/uqs2011-12-301-1/+1
|
* Rework the dynamic per-CPU stats code a bit. Always set 'statics->ncpus'jhb2011-07-181-5/+3
| | | | | | | | | | | | to the maximum number of CPUs to ensure that lcpustates[] array is always allocated to the maximum size. Previously, if top was started without per-CPU stats it would allocate a smaller lcpustates[] array. When per-CPU stats were then enabled, it would overflow the array and trash the cpustates_columns[] array causing the CPU stats to be printed in the wrong locations. Approved by: re (kib) MFC after: 1 week
* Constantly print the command name and if set include the threadbz2011-07-181-8/+20
| | | | | | | | | | name in per-thread mode. Discussed with: jhb Obtained from: Ed Maste at Sandvine Incorporated Sponsored by: Sandvine Incorporated MFC after: 1 week Approved by: re (kib)
* Rename ki_ocomm to ki_tdname and OCOMMLEN to TDNAMLEN.bz2011-07-181-4/+4
| | | | | | | | | Provide backward compatibility defines under BURN_BRIDGES. Suggested by: jhb Reviewed by: emaste Sponsored by: Sandvine Incorporated Approved by: re (kib)
* - Export each thread's individual resource usage in in struct kinfo_proc'sjhb2011-07-181-2/+15
| | | | | | | | | | | | ki_rusage member when KERN_PROC_INC_THREAD is passed to one of the process sysctls. - Correctly account for the current thread's cputime in the thread when doing the runtime fixup in calcru(). - Use TIDs as the key to lookup the previous thread to compute IO stat deltas in IO mode in top when thread display is enabled. Reviewed by: kib Approved by: re (kib)
* Revert 130163 and let top use KERN_PROC_PROC when individual threads arejhb2011-07-151-17/+4
| | | | not displayed. The KERN_PROC_PROC sysctl was fixed in 188764.
* Fix indentation.bz2011-07-141-1/+1
| | | | | | Obtained from: Ed Maste at Sandvine Incorporated Sponsored by: Sandvine Incorporated MFC after: 3 days
* Allow per-CPU statistics to be toggled at runtime via the 'P' key.jhb2011-07-111-70/+78
| | | | | | | While here, make -P a toggle similar to other options such as -I. Reviewed by: arundel MFC after: 1 week
* Always skip the kernel idle process if requested, it is not specific tojhb2011-07-071-5/+4
| | | | | | | | the 'CPU' mode. PR: bin/158677 Reported by: arundel MFC after: 3 days
* - Document the -H option and 'H' key alongside other options and keysjhb2011-05-311-4/+0
| | | | | | | | | | | rather than at the bottom of the manpage. - Remove an obsolete comment about SWAIT being a stale state. It was resurrected for a different purpose in FreeBSD 5 to mark idle ithreads. - Add a comment documenting that the SLEEP and LOCK states typically display the name of the event being waited on with lock names being prefixed with an asterisk and sleep event names not having a prefix. MFC after: 1 week
* Add a new option to toggle the display of the system idle process (per-CPUjhb2011-05-311-0/+7
| | | | | | | | | | | idle threads). The process is displayed by default (subject to whether or not system processes are displayed) to preserve existing behavior. The system idle process can be hidden via the '-z' command line argument or the 'z' key while top is running. When it is hidden, top more closely matches the behavior of FreeBSD <= 4.x where idle time was not accounted to any process. MFC after: 2 weeks
* Add missing header file.pluknet2011-05-201-0/+1
| | | | MFC after: 1 week
* Touch up the sample memory usage numbers a bit, to avoid wrappingkeramida2011-01-231-3/+6
| | | | | | | | | on terminal boundary. While here add definition for 'G' and fix the indentation of 'K' units. Submitted by: plunket PR: docs/153614 MFC after: 3 days
* Memory stats are reported in bytes, not pages.brucec2010-11-131-10/+10
| | | | | | PR: docs/151283 Submitted by: Bas Smeelen <b.smeelen at ose.nl> MFC after: 3 days
* Build usr.bin/ with WARNS=6 by default.ed2010-01-021-0/+2
| | | | Also add some missing $FreeBSD$ to keep svn happy.
* Update top and systat for vfs.bufcache now being a long rather than an int.jhb2009-03-101-1/+1
|
* Right align the CPU column header.rpaulo2008-12-261-2/+2
|
* Make the CPU column in top always be 2 characters and print in decimaljhb2008-10-011-3/+3
| | | | | | rather than hex. Requested by: rwatson
* Display the sum of the runtime of all the threads in a process when it'ssepotvin2008-09-121-0/+1
| | | | | | | | multithreaded instead of picking the time of the first thread found. Reviewed by: jhb Approved by: kan (mentor) MFC after: 1 month
* system_info.cpustates isn't sparse, so a bitmask of available CPU statesru2008-04-111-2/+0
| | | | is redundant (I think it's a leftover from an older implementation).
* Allocate enough memory for pcpu_cp_time[] to stop sysctl() fromru2008-04-111-1/+1
| | | | | writing outside of array bounds. This fully fixes -P display on i386, where kern.cp_times prints zeroes for non-existing CPUs.
* Fix "top -P" (`&' mistyped as `&&' and a botched logic).ru2008-04-101-2/+3
| | | | | | | | | The bug was unnoticed on non-i386 because mp_maxid is initialized differently, kern.cp_times doesn't print zeroes for non-existing CPUs, so no "writing outside of array bounds" happens. MFC after: 3 days
* Use calloc() when requesting zero'ed memory allocation rather than rollingdelphij2008-01-291-8/+4
| | | | our own.
* Add a -P flag to display per-cpu cpu usage stats.peter2008-01-181-5/+95
|
* Improve -u (limit uid lookups) behavior.obrien2008-01-091-2/+8
| | | | | Submitted by: David Frascone <dave@frascone.com> PR: 119490
* Introduce a way to make pure kernal threads.julian2007-10-261-48/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | kthread_add() takes the same parameters as the old kthread_create() plus a pointer to a process structure, and adds a kernel thread to that process. kproc_kthread_add() takes the parameters for kthread_add, plus a process name and a pointer to a pointer to a process instead of just a pointer, and if the proc * is NULL, it creates the process to the specifications required, before adding the thread to it. All other old kthread_xxx() calls return, but act on (struct thread *) instead of (struct proc *). One reason to change the name is so that any old kernel modules that are lying around and expect kthread_create() to make a process will not just accidentally link. fix top to show kernel threads by their thread name in -SH mode add a tdnam formatting option to ps to show thread names. make all idle threads actual kthreads and put them into their own idled process. make all interrupt threads kthreads and put them in an interd process (mainly for aesthetic and accounting reasons) rename proc 0 to be 'kernel' and it's swapper thread is now 'swapper' man page fixes to follow.
* - Move all of the PS_ flags into either p_flag or td_flags.jeff2007-09-171-1/+1
| | | | | | | | | | | | | | - p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or previously the sched_lock. These bugs have existed for some time. - Allow swapout to try each thread in a process individually and then swapin the whole process if any of these fail. This allows us to move most scheduler related swap flags into td_flags. - Keep ki_sflag for backwards compat but change all in source tools to use the new and more correct location of P_INMEM. Reported by: pho Reviewed by: attilio, kib Approved by: re (kensmith)
* Inactive pages don't have to be dirty plus improve description ofru2007-09-021-2/+3
| | | | | | | the cache queue. Submitted by: alc Approved by: re (kensmith)
* Fix the description of the "Cache" memory and clarify theru2007-09-011-2/+2
| | | | | | | description of the "Inact" memory. (They count pages in the cache/inactive page queues, respectively.) Approved by: re (kensmith)
* Third stage of unbreaking printing of pseudo-nice values (realtimebde2007-06-151-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | priorities, etc.) in the NICE field: Use a combination of pri_native and pri_user instead of pri_level to guess the original realtime priority. Using pri_level here has been wrong since 2001/02/12. Using only pri_native here would be correct if the kernel actually initialized it reasonably. (The kernel exports its raw td_base_priority as pri_native, but userland mostly wants a refined base priority). Give up on waiting pri_native to work correctly and only use it when there is nothing better (for kthreads). This should reduce printing of bizarre pseudo-nice values. Bizarre values are still printed if we observe a transient borrowed priority for a kthread (transient borrowing is the main thing that makes the raw td_base_priority almost useless in userland), or if there is a kernel bug. One current kernel bug involves the kernel idprio thread pagezero permanently changing its priority from PRI_MAX_IDLE (255) to PUSER (160). Then the bizarre value "ki-6" is printed instead of "ki31". Here "-6" is PRI_MIN_IDLE - PUSER = -64 truncated to 2 characters. We are observing a transient borrowed priority that has become permanent due to a bug. ps/print.c:priorityr() needs similar changes (including ones in stage 2 here).
* - Add a new 'j' switch and runtime option to toggle display jail id forrafan2007-04-171-10/+47
| | | | | | | | | | each process. - While I'm here, keep help message sorted by keys PR: 98489, 98975 Submitted by: clsung Approved by: delphij (mentor) MFC after: 2 weeks
* - Add new 'a' switch and runtime option that allows 'top' to display processstas2007-04-141-3/+70
| | | | | | | | | titles extracted from argv vector instead of the real executable names. This is useful when you want to watch applications that set their status information via setproctitle(3). Approved by: alfred MFC after: 2 weeks
* The sigconv.awk script generates a sigdesc.h header file, whichkeramida2006-12-012-55/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | contains a sigdec[] vector of structures, but the generated output is missing braces around the initializer of each struct, which triggers warnings in WARNS=3: src/usr.bin/top/sigdesc.h:10: warning: missing braces around initializer src/usr.bin/top/sigdesc.h:10: warning: (near initialization for `sigdesc[0]') * Fix the sigconv.awk script to generate a header with initializers which look better. * Add rules to usr.bin/top/Makefile that rebuilds a new sigconv.h header which matches the correct signal set from the build-time version of `${DESTDIR}/usr/include/signal.h' (so sigconv.h doesn't get stale once changes are made to the header). * Remove the old sigconv.h header, now that it is autoupdated at build time. * Various Makefile style fixes (the committed Makefile was kindly submitted by Ruslan): - Reorder .PATH, PROG, SRCS and CFLAGS to match style.Makefile(5) - Split off the generated sources (sigdesc.h top.local.h) in an SRCS+= line of their own. - Add entries to CLEANFILES near the rules that generate the respective files. - Move the explicit rule which builds top.1 after the implicit rules which generate its dependencies. Reviewed by: ru, bde Submitted by: ru (Makefile) MFC after: 2 weeks
* Second stage of unbreaking thr formatting of the NICE field: decode thebde2006-11-071-15/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | priority class and use this to: - print "-" instead of a garbage value for ithreads. Print "-" instead of the unused nice value for kthreads which are (mis)classified as PRI_TIMESHARE. For such threads, the nice value can be set to nonzero by root, but it is never used (at least by the 4bsd scheduler). For ithreads, we didn't even print the unused value. - print "i<priority>" and "r<priority>" instead of a biased "<priority>" for idletime and realtime threads, Here <priority> is the priority parameter to idprio/rtprio(1). Just add the prefix and remove the bias for now. <priority> has been stored indirectly in the kernel since 2001/02/12, and even the kernel cannot recover the original value in all cases. Here we need to handle more cases than pri_to_rtp(), but actually handle fewer cases, and end up printing garbage after a thread changes its current priority while in the kernel. - for idletime and realtime threads, if they are kthreads then add a prefix of "k" to the previous string. - for idletime and realtime threads, if they in the FIFO scheduling class then add a suffix of "F" to the previous string (if it fits; the other parts of the string are sure to fit unless <priority> is garbage).
* Fix display of idle processes, which had been broken since rev. 1.56 ofse2006-06-111-1/+2
| | | | | | | | | | | machine.c. The traditional condition was (pctcpu > 0 || SRUN), but the negation of the condition logic (from select to skip) made this come out as (pctcpu > 0 && SRUN), leading to a very erratic display, except for purely CPU bound processes. This has been discussed in the mail lists some time ago and I have used top with this patch on my systems for more than a year without problems (just forgot to commit it earlier, since my systems were all fixed ...).
* Move the formatting of the NICE column to a new function format_nice()bde2006-05-041-20/+30
| | | | | | | | so that it can be more easily unbroken and extended. Try to use `static', `const' (as appropriate), prototypes declared together, and parameter names in prototypes for all private functions, not just the new one.
* Fixed some style bugs (mainly missing and wrong splitting of long lines).bde2006-05-041-48/+54
|
* (1) Revert unnecessary indentation changes I committed as part of thekeramida2005-05-181-11/+9
| | | | | | | last version and (2) remove a disabled debugging fprintf() that I accidentally committed here. Noticed by: simon (2)
OpenPOWER on IntegriCloud