Commit Graph

89 Commits

Author SHA1 Message Date
Jim Warner
2efe275512 top: enable recall of previous input lines for re-edit
With this commit, users can now retrieve previous line
input for re-editing and/or re-input using the Up/Down
arrow keys (or their aliases). This mirrors the 'bash'
or 'less' interface and represents a major enhancement
achieved via a somewhat minor impact to our code base.

[ 33 lines of code, 5 closing braces & some comments ]
[ all in 1 function, when TERMIOS_ONLY isn't defined ]

Currently, the upper limit for such recallable strings
has been set at 50 but that could be easily increased.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-24 08:43:45 +11:00
Jim Warner
d04297843f top: enable user filtering via inclusion and exclusion
With this commit top can now display users which match
a user id/name or just those users which do not match.

The distinction is based on the presence or absence of
a leading exclamation point '!' (C negation operator).

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
Wishlist, http://bugs.debian.org/682086

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-24 08:43:45 +11:00
Jim Warner
44e61f0f6d top: man document now properly reflects delay interval
This commit corrects one reference to 'decimal place'.

Even though a running top supports a delay interval of
unlimited precision, and a delay interval of thousands
of a second in the rcfile, we intentionally imply that
any delay interval is limited to tenths of a sec only.

Later in the man document, in section 7a, one finds an
admission that a user can set any desired delay value.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
http://www.freelists.org/post/procps/tt,4

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-02-24 08:43:44 +11:00
Jim Warner
3fc8b69c7a top: update man document for current screen & SIGWINCH
Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-01-24 21:29:24 +11:00
Jim Warner
d9f7c76114 top: prevent display corruption in Locate highlighting
There existed a small chance that the display could be
corrupted when a search string was found within a row.
For that to happen, conditions like these were needed:

. a very short Locate string was active in some window
. the string matched part of a terminfo <esc> sequence
. that sequence was used in highlighting running tasks
. the 'x' toggle was active (sort column highlighting)

One solution to this potential problem was to manually
turn off sort column highlighting before using Locate.
But rather than rely on a user remedy, we'll automate.

Since other top provisions were already being enforced
when Locate was in use (off 'i' and/or 'u'/'U'), we'll
now also force column highlighting off when the search
string in a given window is not empty. However, unlike
idle tasks and user filtering, when that search string
*is* emptied, we restore highlighting for that window.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-01-23 21:23:36 +11:00
Jim Warner
1da293bf59 top: accumulated miscellaneous code and comment tweaks
This commit just addresses the following minor issues:

. restored both lost end-of-job reporting capabilities
. added missing initializers to the DEF_RCFILE #define
. added 'nls_maybe' eye-catcher to the 'Scaled_sfxtab'
. removed a now superfluous 'READMINSZ' assertion test
. man document references to 'top' are more consistent

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-01-23 21:23:36 +11:00
Jim Warner
dec6b8ffe7 top: happy new year while incrementing copyright dates
Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-01-23 21:23:35 +11:00
Jim Warner
2304af908c top: extend command line sort field override provision
In a effort to anticipate a potential future wishlist,
the recent '-o' sort override command line switch will
now support an override of the sort direction as well.

By prepending a '+' or '-' to any valid field name the
user will be able to guarantee a specific desired sort
direction. The '+' forces a high-to-low (normal) order
while a '-' reverses that to yield a low-to-high sort.

Without this addition users would be left to the mercy
of whatever was last specified for Curwin as reflected
in the rcfile or top's default of a high-to-low order.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:11:34 +11:00
Jim Warner
2e7adced74 top: extend scaled process memory range to include PiB
The recent change to task area memory scaling was just
a little short of optimum in its consistency and upper
limits. In fact, top could only scale memory fields up
to a maximum of 99.9999 TiB (with VIRT a little more).

While that seems like more than enough it was actually
artificially low, due to an unnecessary decimal place.

So, this commit standardizes both precision and widths
to achieve a minimum amount of scaling beyond the user
requested target plus reclaim some horizontal spacing.

. VIRT & DATA are now 7 bytes wide (not eight and six)
. other memory fields are 6 wide (were formerly seven)
. as before, KiB shows whole numbers only (no decimal)
. MiB, for its precision, shows a single decimal place
. all other memory ranges display three decimal places

The net result is a more homogeneous display with less
forced scaling and the recovery of three lost columns.

(now that we know a '.' + 2 spaces is squeezed to one)
(everything's perfectly justified, but it's just luck)

Reference(s);
http://www.freelists.org/post/procps/top-enhancements-i-hope,1

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:10:12 +11:00
Jim Warner
e6cb40235e top: extend scaled summary memory range to include EiB
This commit increases the upper limit for summary area
memory scaling to 9999.999 Exbibytes. It also enhances
the man page through a helpful table for equivalences.

(now that we know a '.' + 2 spaces is squeezed to one)
(everything's perfectly justified, but it's just luck)

Reference(s):
http://www.freelists.org/post/procps/top-regression-reports
http://www.freelists.org/post/procps/top-enhancements-i-hope,1

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:10:12 +11:00
Jim Warner
ced5009f75 top: limit task cpu % based on total number of threads
Everyone has either accepted this potential distortion
or patched top to eliminate it. Now, the time has come
to regain some consistency when calculating that %CPU.

We'll now limit such values to: 100.0 * total threads.
And, it took way too long to address this little flaw.

(now that we know a '.' + 2 spaces is squeezed to one)
(everything's perfectly justified, but it's just luck)

Reference(s):
http://www.freelists.org/post/procps/top-regression-reports
http://www.freelists.org/post/procps/top-regression-reports,1

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:10:11 +11:00
Jim Warner
688f4e7399 top: add the ability to suppress zeros in most columns
With the increased width and precision of memory and %
columns, the proliferation of 0's when there's nothing
to report seems like a distraction versus useful data.

This commit introduces the '0' toggle which can either
display or suppress those zeros. And, like the scaling
states this new state is also preserved in the rcfile.

(now that we know a '.' + 2 spaces is squeezed to one)
(everything's perfectly justified, but it's just luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:07:42 +11:00
Jim Warner
21e550bc08 top: provide the means to adjust scaled process memory
This commit is an unrequested outgrowth of the earlier
change dealing with summary area memory field scaling.
That user selectable scaling provision is now extended
to include 6 (at present) task oriented memory fields.

The new companion 'e' (lower case) interactive command
has been added and, like the 'E' command, it can cycle
each of the currently displayed memory columns between
KiB through TiB. There are, however, some differences.

Where '+' indicates summary area truncation at a given
radix, task memory fields are automatically scaled for
their column. Thus, not all rows use the same scaling.

And, while summary area field widths were not changed,
the task memory columns were widened in order to offer
more meaningful data when the radix was increased. The
precision is automatically increased in step with each
radix: MiB displays 2 decimal places, GiB 3 and TiB 4.

To compliment that additional precision, both the %CPU
and %MEM fields were widened by 1 column and now offer
precision up to 3 decimal places. But, unique to %CPU,
widening could already have occurred due to the number
of processors in some massively parallel boxes. At any
rate, total extra width for both memory and percentage
fields could amount to twenty (precious) columns more.

So for both the memory and % fields the original width
(along with loss of precision) can be restored via new
compiler conditionals which this commit also provides.

p.s. and it will be rcfile preserved for any restarts!

(now that we know a '.' + 2 spaces is squeezed to one)
(everything's perfectly justified, but it's just luck)

Reference(s):
http://www.freelists.org/post/procps/top-regression-reports

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:07:41 +11:00
Jim Warner
bc46f67f9a top: provide the means to adjust scaled summary memory
Earlier this year, the switch from KiB to Mib as shown
in top's summary area was postponed to those occasions
when KiB exceeded 8 digits. In hindsight that may have
moved top in the wrong direction, given the difficulty
of digesting such large numbers of digits at a glance.

This commit adds a new 'E' interactive command used to
cycle the displayed memory amounts ranging from KiB to
TiB. Thus, users can choose the radix they wish shown.

p.s. and it will be rcfile preserved for any restarts!

(now that we know a '.' + 2 spaces is squeezed to one)
(everything's perfectly justified, but it's just luck)

Reference(s):
http://www.freelists.org/post/procps/top-regression-reports

commit 95f2201730
Author: James Cloos <cloos@jhcloos.com>
Date:   Mon Feb 6 00:00:00 2012 -0500

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:07:40 +11:00
Jim Warner
407d1fc8f2 top: provide command line sort field override switches
This commit adds two new command line switches dealing
with the potential need to automate/script the setting
of top's current sort field independent of the rcfile.

The -o (lower case) switch requires a lone valid field
name as an argument, from among the 42 currently used.
Then, it overrides the config file's Curwin->sortindx.

And since field names are now translatable, they could
diverge from those reflected in the documentation. So,
a 2nd switch of -O (upper case) is also provided which
outputs all names as translated and understood by top.

(now that we know a '.' + 2 spaces is squeezed to one)
(everything's perfectly justified, but it's just luck)

Reference(s):
Bug-Redhat: https://bugzilla.redhat.com/871844
http://www.freelists.org/post/procps/PATCH-Allow-core-file-generation-by-ps-command-rhbz871825-rhbz512857,9
http://www.freelists.org/post/procps/PATCH-Allow-core-file-generation-by-ps-command-rhbz871825-rhbz512857,15
http://www.freelists.org/post/procps/PATCH-Allow-core-file-generation-by-ps-command-rhbz871825-rhbz512857,16

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-22 17:07:40 +11:00
Jim Warner
14170d0220 top: fix isolated inspect spelling error, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-12-10 09:29:27 +11:00
Jim Warner
12c8d52057 top: add a flexible 'Inspect' capability, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-27 22:08:02 +11:00
Jim Warner
9e99c84c48 top: kill/nice provide for a default pid, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-27 22:08:01 +11:00
Jim Warner
4dfb01aa37 top: quiet lintian with escaped dashes in man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-27 22:08:00 +11:00
Jim Warner
f005411974 top: 'X' command offers auto option, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-11 21:13:14 +11:00
Jim Warner
21237356ab top: map additional navigation keys, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-11 21:10:44 +11:00
Jim Warner
7557f3f754 top: with new 'X' command, WCHAN becomes fixed-width
This 'Sleeping in function' field was made variable
width because the length of current kernel symbols
usually exceeded the former top's 9 character limit.

As a variable width field it would steal valuable
horizontal display positions from other, more likely,
displayed fields such as COMMAND or CGROUPS.

With the advent of the new 'X' toggle, no fixed-width
non-scalable field need suffer permanent truncation.
Thus, WCHAN is being made fixed width with a default
size of 10 characters.

Signed-off-by: Jim Warner <james.warner@comcast.net>

 top/top.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
2012-10-02 20:56:40 +10:00
Jim Warner
bbf8e44fb4 top: extend new 'X' command to include the TTY field
I have no idea what the maximum length of a terminal
name might be.  However, the library provides for up
to 128 characters (ouch).

So just to be safe, this commit extends the ability
to widen columns to embrace this field.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:40 +10:00
Jim Warner
47e1d063ac top: optional wider non-scalable cols, man document 2012-10-02 20:56:40 +10:00
Jim Warner
46bd0085b0 top: column alignment under user control, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:40 +10:00
Jim Warner
718cececc7 top: correct an old man document flaw
This flaw was revealed under 'man2htm' and dates back
to the first Gitorious revised top submission.

Reference:
commit fd62123562
Date:   Thu Mar 31 22:15:12 2011 +1100

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-10-02 20:56:39 +10:00
Jim Warner
d9890fb5ac top: add major/minor page fault deltas, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:37:37 +10:00
Jim Warner
6cc7416441 top: add new scrollable column ENVIRON, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:35:33 +10:00
Jim Warner
06e92e93b8 top: miscellaneous minor tweaks (mostly spelling)
This commit represents mostly spelling corrections
in comments.  It also includes a few very minor logic
changes/relocations.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:29:46 +10:00
Jim Warner
6940430c55 top: correct field order within Section 3a, man document
This section purported to list fields in alphabetical
order, but this was not always true.

With this commit, strict ascii collating sequence is
now observed.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:29:34 +10:00
Jim Warner
896f3deeb9 top: add intra-column horizontal scrolling, man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-08-29 17:28:34 +10:00
Sami Kerola
47100a8125 docs: fix manual page warnings
All warnings where about unnecessary quoting.  The scriptlet
below will tell what was wrong.

for I in ./top/top.1 ./ps/ps.1 ./*.[0-9]; do
    echo "== $I warnings =="
    man --warnings=all $I > /dev/null
done

This should probably be turned to 'make check' script.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-16 12:55:53 +02:00
Jim Warner
e9a9bad264 top: document an existing provision of pid monitoring
Since its inception top has provided for monitoring
only specific process ids via the -p command line
switch.  This provision has also embraced the top
process itself, even though its pid wasn't yet known.

This commit simply documents the special zero value,
which would otherwise be an invalid process id.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-04-16 08:30:06 +10:00
Jim Warner
397810a67f top: some isolated typos and minor code changes
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-16 07:06:53 +11:00
Jim Warner
2fc3f15770 top: refer to memory using strict IEC standard names
Admittedly, top referred to memory quantities in
a variety of non-standard ways.  This commit brings
the program and supporting documentation into strict
compliance with IEC standard binary names.

According to wikipedia, as of 2012 this IEC standard
was still not in widespread use.  However, I'm making
this change now for the anal-retentive among us.

Reference:
http://en.wikipedia.org/wiki/Megabyte

Reported by: Roman Mamedov <rm@romanrm.ru>
Bug-Debian:  http://bugs.debian.org/662786

Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-09 06:56:06 +11:00
Jaromir Capik
0f6b289212 license: update FSF addresses
The license files are synchronized with the versions from GNU web
site.

http://www.gnu.org/licenses/gpl-2.0.html
http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html

Signed-off-by: Jaromir Capik <jcapik@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-04 08:04:24 +11:00
Sami Kerola
8f7eefc9c8 docs: aligh top.1 header with other procps-ng utils
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-01-21 16:49:47 +01:00
Jim Warner
873df28b64 top: additions to search narrative in man documment 2011-12-22 23:48:06 +11:00
Jim Warner
32a9adbc13 top: provide extensive, generalized nls support
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Jim Warner <james.warner@comcast.net>
2011-12-22 23:48:04 +11:00