Commit Graph

75 Commits

Author SHA1 Message Date
Jim Warner
cd608f462e top: forest view segmentation fault, the final solution
With forest view mode under procps-ng-3.3.0, top would catch
a SEGV and exit.  The problem was thought to be related to
some linux version 3 anamoly.

In procps-ng-3.3.1, top was protected from abnormal exit and
would display the offending processes with the special orphan
notation '?', instead of the usual artwork.

As it turns out, the problem wasn't with linux and could
surface under a 2.6.xx kernel,  The cause was an occasional
abnormal ordering of tid/tgid/ppid which went unresolved
due to a progressive proc table scan in the recursive
function forest_add().

By default the proc table scan now restarts at the beginning.
However, a #define TREE_ONEPASS is provided should one wish
to restore the 3.3.1 behavior with its reduced overhead.
2011-12-11 22:27:56 +11:00
Jim Warner
88087ec5a5 top: exploit enhanced library memory allocation provisions
Now that the library allows for customizing the response to
memory allocation errors, it is no longer necessary for top
to provide its own.

This library extension was necessary since top modifies the
termios structure and there would otherwise be no way to
restore the users tty.
2011-12-11 22:27:27 +11:00
Craig Small
ed01cfb8a9 Some tweaks for top
tweaked signal setup valgrind complaint as nls
some input error messages made more descriptive
eliminated audible escape a from all error messa
added include of proc readproc.h to top.h
optimization for show_special function
remove unnecessary variables clang analyze
2011-10-26 22:31:48 +11:00
Jim Warner
1055dff047 top: redesign show_special strs, in line with nls 2011-10-20 12:34:13 +02:00
Craig Small
e4c45d6984 added ps etimes, miscellaneous top enhancements
ps program
 . etimes added for ELAPSED expressed in seconds
 . time_t used in place of former unsigned long

top program
 . corrected scroll message bug when 'x' toggle on
 . fixed forest view potential missing libflags bug
 . improved 'k' default signal invocation logic
 . enhanced logic for %CPU maximums displayed
 . made signal handling more robust and efficient
2011-09-12 22:18:23 +10:00
Craig Small
73ade5e2cb top now has a forest view mode 2011-08-30 22:05:45 +10:00
Craig Small
0e6ac0db3e added tgid support plus miscellaneous cleanup
ps
   . added tgid support
   . made process/task naming consistent
 top
   . added tgid support
   . standardized pid related width logic
 documents
   . added tgid to ps & top man documents
 library
   . fixed OOMEM_ENABLE readtask bug
   . corrected header typo for tgid
2011-08-17 21:01:35 +10:00
Craig Small
3ef4823f90 supgid/supgrp support, improved library interface
Library changes
   readproc
    . added support for supplementary groups
    . eliminated 2 potential mem leak sources
       . shortcut used for multi-threaded str
         vectors & ptrs was obsoleted
       . freeing of proc_t related dynamic
         memory now rests with the library
    . standardized/normalized many c comments
   sysinfo
    . corrected note regarding glibc & cpuinfo
   library.map
    . made the visible freeproc accessable
 Program changes
   pmap
    . initialized buffer for new readproc i/f
    . eliminated now obsolete free() call
   ps
    . added width aware supgrp support
    . initialized buffers for new readproc i/f
    . eliminated now obsolete free() calls
   top
    . added supgrp support as variable width
    . eliminated now obsolete free() calls
    . expoilted library freeproc function
    . corrected -h|v args text & spacing
    . updated some c comments
 Documentation changes
   ps.1
    . added supgid and supgrp
   top.1
    . added supgid and supgrp
    . addition of above required renumbering
      many fields in section 3a. DESCRIPTIONS
2011-08-01 21:28:46 +10:00
Craig Small
a26c3bfa39 top hotplug memory support
Another patch from Jim for top to support hot-pluggable memory. Not
fully tested on real hot-pluggable memory because neither of us have
it
2011-07-14 21:16:02 +10:00
Jim Warner
29b8775c39 miscellaneous top program/man document cleanup
Program changes
  . corrected eolcap handling if EQUCOLHDRYES defined
  . added missing terminator for OOMEM_ENABLE comment
  . tightened logic in display_fields
  . eliminated some warnings via type or cast
  . updated miscellaneous source comments
 Man Document changes
  . corrected/expanded CGROUPS narrative
  . standardized/normalized PPID narrative

Signed-off-by: Jan Görig <jgorig@redhat.com>
2011-06-23 15:45:09 +02:00
Jan Görig
034612c480 Fixed per-process swap information in top and related cleanup.
Thanks to KOSAKI Motohiro and Jim.

Bug-Redhat: https://bugzilla.redhat.com/show_bug.cgi?id=532668
2011-06-02 12:15:14 +02:00
Jim Warner
91edf89810 remove trailing spaces in top batch mode
Signed-off-by: Jan Görig <jgorig@redhat.com>
2011-06-01 13:58:06 +02:00
Jim Warner
c2dcbef482 added output width/height override support to top, + misc
This source patch addresses the following:
 Enhancements
  . added -w command line switch, with optional argument
   ( offers complete control over width and height, in  )
   ( combination with env variables COLUMNS= and LINES= )
  . updated man document to reflect the new capability
  . reengineered Fields Management to be more flexible
    thus no longer requiring a normal sized tty
 Buglets fixed
  . forced View_SCROLL off when in 'Batch' mode
  . for narrow xterm, fixed return val in show_pmt
  . for narrow xterm, fixed cursor pos in linein
  . added a window specific end-of-line termcap ptr
   ( so clr_eol does not overwrite last printable char )
 Cosmetic changes
  . eliminated TTYGETENVYES define, incorporated as -w
  . eliminated RESIZE_LIMIT define, no longer needed
  . eliminated FIELD_CURSOR define, no longer possible
  . eliminated extra text on Fields Management screen
  . fixed miscellaneous man document typos/formatting

Signed-off-by: Jan Görig <jgorig@redhat.com>
2011-05-26 11:33:32 +02:00
Jim Warner
7b0fc19e9d enhanced libproc cgroup/cmdline support, exploited by top
Library Changes
. added PROC_EDITCMDLCVT flag
. added an internal (static) fill_cmdline_cvt function:
  - reads and "escapes" /proc/#/cmdline
  - returns result as a single string in a single vector
  - callers are guaranteed a cmdline (no more NULL)
. added vectorize_this_str function, exploited by
  fill_cgroup_cvt, fill_cmdline_cvt
. generalized read_cmdline function as read_unvectored, now
  exploited by fill_cgroup_cvt, fill_cmdline_cvt, read_cmdline
  ( cgroup and cmdline no longer need be converted to string )
  ( vectors before being transformed to final representation )
. fixed bug regarding skipped group numbers (when enabled)
. escape_str made responsible for all single byte translation
  with distinction between control chars + other unprintable
. added escaped_copy function for already escaped strings
. reorganized parts of proc_t to restore formatting standards
  ( displacement changes shouldn't matter with new version # )
. former ZAP_SUSEONLY #define now OOMEM_ENABLE
. added to library.map: escaped_copy; read_cmdline

Top Program Changes
. exploited the new PROC_EDITCMDLCVT provision
. eliminated now obsolete #include "proc/escape.h"
. changed the P_WCH display format if no kernel symbol table
. fixed very old bug in lflgs for out-of-view sort fields
. former ZAP_SUSEONLY #define now OOMEM_ENABLE

Ps Program Changes
. exploited the new PROC_EDITCMDLCVT provision
. exploited the new escaped_copy function
. consolidated pr_args and pr_comm into pr_argcom

Signed-off-by: Jan Görig <jgorig@redhat.com>
2011-05-18 10:33:44 +02:00
Jim Warner
57031319d6 cgroup support migrated to libproc, plus miscellaneous re-formatting
This source patchset addresses the following:
Library Extension (readproc)
 . added PROC_EDITCGRPCVT flag
 . added an internal (static) fill_cgroup_cvt function:
   . reads AND parses /proc/#/cgroup
   . returns result as a single string in a single vector
   . thus no changes to proc_t structure or free memory logic
Program Enhancements (top)
 . removed parse_cgroup logic in favor of libproc
 . eliminated cgroup sort recurring overhead
 . converted WCHAN field to variable width
 . generalized variable width field logic in task_show
 . real-time notation under P col more distinctive as 'rt'
Program Cosmetic (top)
 . CGROUP now known as CGROUPS (plural)
 . moved jan's attribution from top.c to 'Notes' in top.h
 . numerous comments tweaked
Document Enhancements (top)
 . documented CGROUPS field (required renumbering all fields)
 . adapted narratives for the 3 current variable width fields
 . expanded real-time scheduling notes, 'RT' now shown as 'rt'

Signed-off-by: Jan Görig <jgorig@redhat.com>
2011-05-05 12:12:27 +02:00
Craig Small
3ec6a27e8a cgroup support. rcfile errors default to fatal
This source patch addresses the following:
 Conceivable Buglets Avoided
  . added sanity checks for previous assumptions re: pid size, num cpus
  . changed response for rcfile errors to fatal, vs. silent default
 Enhancements
  . reorganized WIN_t struct for reduced padding and better readability
  . generalized code for multiple var-width cols (divorced from pflags)
  . absorbed jan gorig's cgroup patch, with attribution
 Cosmetic
  . reduced numerous #ifdef directives, especially in calibrate_fields
2011-04-15 09:24:29 +10:00
Craig Small
9bbaa0b3d2 several bug fixes, enhancements and formatting
The documentation portion of the patch addresses the following:
  README.top
    . corrected a minor typo
    . updated to reflect current patch level
  top.1
    . fixed potentially misinterpreted Me/ME strings
    . added '.Bd -literal' directives for indented fixed-width font
    . some comments changed from \# to .\" to avoid man2html problems

The source portion of the patch addresses the following:
  Buglets
    . header/task output length now consistent
    . fixed 2 obscure horizontal scrolling bugs
    . fixed potential bug regarding 'help' and 'current' window
    . messages and prompts are now also sensitive to terminal width
    . normalized buffer names/sizes now accommodate any SCREENMAX changes
  Features
    . made %CPU and 'i' mode handling more efficient
    . for input the Up/Dn arrows keys act as alternatives to Ins/Del keys
   . an optional USE_X_COLHDR define eliminates ALL 'x' toggle overhead
    . an optional ZAP_SUSEONLY define was added for Werner's modifications
  Cosmetic
    . defines and format for optional end-of-job reports standardized
2011-04-14 07:08:14 +10:00
Craig Small
fd62123562 New version of top from Jim 2011-03-31 22:15:12 +11:00
albert
9278134e49 top: show CPU time stolen from a virtual machine 2006-06-25 02:15:36 +00:00
albert
1e73c7b8bc bit of top hacking 2006-06-25 01:14:24 +00:00
albert
58f47c6614 terabytes 2006-01-22 07:57:13 +00:00
albert
38d36b4960 top can show loose tasks now 2005-06-21 19:20:39 +00:00
albert
55b3e73334 $TOPRC, eliminate status() fn, avoid /proc/*/stat more 2004-08-30 17:30:41 +00:00
albert
8300609ba9 plenty -- see NEWS file and a diff 2004-07-15 01:17:15 +00:00
albert
d8921adf71 CodingStyle 2004-07-07 17:27:26 +00:00
albert
e8b5f776a3 tolerate sparse CPU numbering 2004-07-07 00:11:19 +00:00
albert
2b55ead81b CodingStyle 2004-07-06 20:05:30 +00:00
albert
658b03bec6 alignment 2004-02-23 19:31:00 +00:00
albert
cb8bd84b21 CodingStyle left out of tarball. Tweak top. Leftovers? 2004-02-23 18:47:42 +00:00
albert
d611d4e66f any leftover changes 2003-09-17 17:14:32 +00:00
albert
e54c8239b1 new Linux 2.6.0-test4 CPU stats shown 2003-09-08 01:39:49 +00:00
albert
6dbef339c2 fix 4 GB wrap-around in top 2003-09-06 05:11:04 +00:00
albert
6ba229fa4c alignment 2003-08-11 01:59:53 +00:00
albert
3e67b58ec2 satisfy GPL section 2a and LGPL section 2b name+date requirement 2002-12-15 00:30:17 +00:00
albert
36ff49a29e the u arg, U arg, u key, and U key 2002-12-10 03:01:17 +00:00
albert
dc5cb1da28 likely to improve performance 2002-12-08 22:51:09 +00:00
albert
967acac8b7 for Jim 2002-12-07 22:36:21 +00:00
albert
f1c02989c7 topz-Phase1.patch 2002-12-06 06:53:29 +00:00
albert
0d04de5f6c broken but interesting 2002-12-05 03:00:42 +00:00
albert
b48907a9d7 add_missing_fields 2002-12-05 01:47:36 +00:00
albert
c7e7b44284 not done yet 2002-12-04 22:48:30 +00:00
albert
b84406584f mostly done ('f' screen needs work) 2002-11-30 15:56:53 +00:00
albert
7860e77d90 prep #1, some structs 2002-11-30 01:22:01 +00:00
albert
f165d14c56 old sort keys, etc. 2002-11-29 16:01:04 +00:00
albert
d614bf02e6 revert the Nov2002 c99 attempt 2002-11-28 23:09:48 +00:00
albert
852f486cd9 topz-SomeMore.patch 2002-11-27 09:13:42 +00:00
albert
98895d57c1 Jim needs restrictions 2002-11-27 00:24:01 +00:00
albert
d0d827dffe B toggle, fix t toggle, windowed batch, 3x to 6x faster, out-of-bounds RT as "RT" 2002-11-24 22:04:03 +00:00
albert
82799b0fea less bold 2002-11-10 10:58:11 +00:00
albert
cbe15808d0 cleaner and 9% faster 2002-11-08 00:31:28 +00:00