Commit Graph

107 Commits

Author SHA1 Message Date
Jim Warner
65ec527e4c top: response to revised numa stuff in that <stat> api
[ actually, this patch goes a little beyond what was ]
[ strictly required. some messages were expanded for ]
[ clarity and should an inactive node be selected by ]
[ the '3' command, a second '2' no longer is needed. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-06-25 20:08:22 +10:00
Jim Warner
98ae31584b top: warn users if rcfile save prevents older top read
I'm about to break older top rcfile compatibility when
preserving those two new toggles. And, though this has
happened several times over the years, we never issued
any warnings that such thing was just about to happen.

So, this patch corrects the long standing shortcoming.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-31 22:06:26 +10:00
Jim Warner
94d6db6b40 top: add '!' toggle for combined cpus display, program
When implementing that earlier '4' toggle, in response
to the issue referenced below, I got to thinking about
those environments with massively parallel processors.

Such environments may not benefit from the '4' toggle.

So, I decided to implement a feature that could enable
use of those '1' and/or '4' toggles no matter how many
active processors top may have ultimately encountered.

With the new '!' toggle, adjacent cpus can be combined
to any degree, represented as a single cpu group/line.

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/172

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-28 19:49:40 +10:00
Jim Warner
59f5a37a24 top: add '4' toggle for 2 abreast cpu display, program
In the back of my mind, I've always wanted to enable a
two abreast cpu display. Folks with massively parallel
machines must surely have been frustrated with the '1'
toggle when Off (individual cpus in the Summary Area).

So, I'll use that recently raised issue shown below as
a justification for finally implementing this feature.

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/172

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-05-28 19:49:40 +10:00
Jim Warner
3a3c1604ff top: for symmetry with 'E' add 'e' command line switch
Several years after the 'e' & 'E' interactive commands
were introduce to affect memory scaling, an 'E' switch
was added. This was after discovering a dropped Redhat
patch which provided a unique 'M' command line switch.

If only for symmetry it makes sense to offer a similar
command switch ('e') for the Task Area memory scaling.

As was true with 'E', top's help text will show 'e' as
if it were a switch without arguments in order to keep
help text displayed without wrap in an 80x24 terminal.
The man page, however, will show all of the arguments.

Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/165
. 03/2017, added 'E' command line switch
commit b2bd65407a
. 12/2012, added 'e' interactive command
commit 21e550bc08
. 12/2012, added 'E' interactive command
commit bc46f67f9a

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-04-10 14:37:15 +10:00
Jim Warner
a331659015 top: reposition some data due to a translation comment
In a translator hint, under a caution, a reference was
made to the "next three items". Unfortunately however,
there was one intervening 'item' to which that caution
did not apply. This commit just relocates that 'item'.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2020-01-06 09:11:20 +11:00
Jim Warner
ede4a5f9b0 top: existing 'Inspect' pipe feature now more flexible
Currently, it isn't possible to establish an 'Inspect'
pipe that relies on SIGINT to end. That's because this
signal will also end the parent process (top) as well.

So this patch will temporarily ignore that signal when
processing any 'Inspect' pipe, allowing one like this:

. pipe ^I Trace Calls ^I /usr/bin/strace -r -p %d 2>&1

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-08-01 21:38:44 +10:00
Jim Warner
ab33cd1101 top: '^V' is now 'v' (collapse/expand children toggle)
Using Ctrl-V for the collapse children key now appears
as a mistake. First, it's too close to that Ctrl-C key
which would prematurely terminate top. Second, a lower
case 'v' was unused and perfectly compliments an upper
case 'V' which is used to toggle 'forest view' itself.

Reference(s):
https://gitlab.com/procps-ng/procps/issues/99

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-07-18 20:19:43 +10:00
Jim Warner
1801bacc0d top: exploited the newly added field 'executable path'
[ along the way we'll shorten some of the repetitive ]
[ variable width field narratives in top's man page. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-06-26 21:25:18 +10:00
Jim Warner
a8dc1a6e5a top: refactor the 'scroll coordinates' message support
This patch is simply preparation for upcoming vertical
scrolling enhancements. With those changes, it will be
impossible to predict what the beginning task position
should be at the time the message is currently issued.

This patch will allow such a message to be shown after
the individual windows' tasks have all been displayed.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-06-26 21:25:18 +10:00
Jim Warner
42e8abec0d top: allow collapsible forest view children, pgm logic
The issue cited below really dealt with preserving the
'Other filter' criteria in the rcfile. But as an aside
the htop 'F6' feature (collapsed children) was raised.

I took that as an implied challenge and decided to try
implementing a similar feature in top. So, this commit
will now provide a brand new forest view toggle ('^V')
which will be used to collapse/expand forked children.

[ this patch will also lead to additional patches in ]
[ support of more rational vertical scrolling, since ]
[ many more tasks might now be hidden in some window ]

Reference(s):
. where this secondary issue was raised
https://gitlab.com/procps-ng/procps/issues/99

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-06-26 21:25:18 +10:00
Jim Warner
35e9269bbe top: 'other filters' saved with config file, pgm logic
Well, after the rearranging and refactoring, all those
active 'other filter' entries for each window will now
be preserved in the user's configuration file via 'W'.

For raising the issue below, thanks to Marco Ippolito.

Reference(s):
https://gitlab.com/procps-ng/procps/issues/99

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-06-26 21:25:17 +10:00
Jim Warner
567a9b6240 top: let's honor <Esc> key on color mapping screen too
Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-06-26 21:25:17 +10:00
Jim Warner
80f9815f5f top: a tweak to the recent 256-color termninal support
We now use the actual terminfo 'max_colors' value with
the 'color mapping' screen, not that hard coded '256'.

Reference(s):
https://gitlab.com/procps-ng/procps/issues/96

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-06-09 21:45:38 +10:00
Jim Warner
4d9e4ac4f6 top: provide the means to exploit a 256-color terminal
With the Qualys security audit, we began to harden our
treatment of the top rcfile. In particular, the values
read were checked so as to prevent some malicious user
from editing it in order to achieve an evil objective.

However when it came to colors I was surprised to find
that at least one user edited the rcfile for 256-color
support. Unfortunately, our new checks prevented this.

So this commit will provide the means to exploit those
extra colors with no need to manually edit the rcfile.

Reference(s):
https://gitlab.com/procps-ng/procps/issues/96

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-06-09 21:35:20 +10:00
Jim Warner
2119750a51 top: change to exploit a newly added UID used at login
In addition to exploiting the login user ID provision,
the following miscellaneous changes are also included:

. unnecessary braces have been eliminated from an 'if'

. a comment with case EU_CPU: was corrected to 's_int'
and the associated block of code relocated accordingly

. case EU_CPN: wasn't shared with other enumerators so
reference to 'i' was changed to that actual enumerator

. case EU_SGN: wasn't shared with other enumerators so
reference to 'i' was changed to that actual enumerator

Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-02-19 20:33:59 +11:00
Jim Warner
52f0ee2c41 top: update copyright dates in source and man document
Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-02-19 20:33:59 +11:00
Jim Warner
55a42ae040 top: allow more flexible approach for startup defaults
Those references below offer more detail regarding the
default startup changes beginning with version 3.3.10.

It is important to remember that all such changes were
supposed to impact only new users or users who had not
saved the personal config file (via that 'W' command).
However, I introduced a bug wherein the rcfile was not
fully honored. This gave the changes a bad reputation.

That bug was corrected in release 3.3.11 but the issue
of default startup options keeps resurfacing. And it's
clear there's no consensus on what should be included.

Our --disable-modern-top configure option is of little
help since it remains an all-or-nothing approach. What
we need is an answer offering unlimited customization.
So, this commit will provide distribution packagers or
system administrators with a much more flexible way to
set their own preferred startup default configuration.

A new rcfile is being introduced: '/etc/topdefaultrc',
whose format/content is the same as a personal rcfile.
Thus once a 'proper' enterprise configuration has been
established and saved via 'W', it can be copied to the
/etc/ directory. Thereafter, startup in the absence of
a saved rcfile will use that configuration as default.

Now if a distribution packager or system administrator
wishes to expose their users to some of top's advanced
capabilities they can do so gradually. Perhaps setting
up graph mode for summary area task and memory display
while retaining the %CPU sort could be tried. Or maybe
showing colors, but better customized for a particular
terminal emulator. Such possibilities are now endless.

[ in exploiting this new capability, i hope that the ]
[ other windows (alt display mode) aren't overlooked ]

Reference(s):
. Sep, 2014 - Not fully honoring rcfile bug discussed
https://www.freelists.org/post/procps/top-saved-rcfile-bug
. Oct, 2014 - Attempt to defend new startup defaults
https://bugzilla.redhat.com/show_bug.cgi?id=1153049
. Jul, 2015 - Forest vs. %CPU views discussion
https://gitlab.com/procps-ng/procps/issues/6
. Oct, 2017 - Question the use of --disable-modern-top
https://bugzilla.redhat.com/show_bug.cgi?id=1499410
. Oct, 2017 - Forest vs. %CPU views discussion again
https://www.freelists.org/post/procps/Forest-mode-by-default-in-top-seems-a-bit-strange
. Dec, 2017 - Rehash of 3.3.10 startup defaults change
https://gitlab.com/procps-ng/procps/issues/78

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-12-23 17:44:34 +11:00
Jim Warner
0a502adfd0 top: let's exploit the new standardized errno handling
With the library having now normalized errno handling,
perhaps it is time at least one program took advantage
of it. So, instead of printing just a message with the
programs's line number, top will now also provide that
associated errno string text, compliments of strerror.

[ with those newlib functions returning NULL, we can ]
[ use errno directly in strerror. for the ones which ]
[ yield an int, all we need do is invert such return ]
[ values before passing it to the strerror function. ]

Reference(s):

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-12-23 17:44:34 +11:00
Jim Warner
fd77d86942 top: add and/or expand a couple more translation hints
After noticing that the 'uk' translation expanded what
was supposed to be a 3 line header into 5 lines, seems
appropriate to offer more guidance on max lines count.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-12-20 21:18:53 +11:00
Jim Warner
3afadf56e4 top: ensure bug report suggestion agrees with man page
The top man page was changed back on 10/20/15, in that
commit shown below. There, freelists.org was suggested
as the bug reports recipient. But, the program was not
changed from the original Debian bug reports approach.

Reference(s):
commit b1f7b2a509

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-10-14 21:48:00 +11:00
Jim Warner
0154ffb280 top: ensured one translation hint agrees with template
Now that top can properly handle translated multi-byte
strings I've been reviewing translated efforts so far,
and weighing output against related translation hints.

In one case, a translation hint has not kept pace with
the current program state. In addition, that same hint
could be expanded to suggest translation alternatives.

[ frankly I never expected the translators to tackle ]
[ some of those 'special' strings. the task appeared ]
[ just too daunting. but they have done a great job! ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-10-07 09:07:17 +11:00
Jim Warner
335c070c8d top: improve the translator hint regarding field width
Reference(s):
https://www.freelists.org/post/procps/Does-COMMAND-really-have-to-be-at-most-7-characters,2

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-10-07 09:07:17 +11:00
Jim Warner
1bc25e920a top: correct an insidious occasional truncation buglet
With the help of our Swedish translator, hopefully the
final buglet has now been vanquished in the multi-byte
translation support. This one was a real nasty bugger.

Although it didn't occur with every terminal emulator,
occasionally random text lines were being chopped off.

As it turns out, those terminals were blameless. There
were two separate places in top's show_special routine
where potential multi-byte sequences were inadequately
addressed. Solution: exploit existing utf-8 functions.

[ it also became apparent that the translation hints ]
[ in the top_nls module were deficient. so a special ]
[ caution was added regarding the final line of txt. ]

Reference(s):
https://gitlab.com/procps-ng/procps/issues/68

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-10-02 22:23:13 +11:00
Jim Warner
6002603e2c top: now includes that NUMA node field display support
Reference(s):
https://gitlab.com/procps-ng/procps/issues/58

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-05-22 21:38:10 +10:00
Jim Warner
810e1d38ab top: just update all of the copyright dates in sources
[ this patch has been adapted from the master branch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-03-16 22:08:07 +11:00
Jim Warner
5e708c5db7 top: provide -1 command line switch as 'Cpu(s)' toggle
If built without ./configure --disable-modern-top, the
program displays each cpu individually providing there
is sufficient vertical screen real estate. For massive
SMP environments this will necessitate use of a config
file where the cpu summary toggle ('1') could be saved
via the 'W' command. But, an rcfile may not be viable.

So this commit introduces a '1' command line switch to
emulate exactly the effects of the interactive toggle.

And since it is our first numeric switch some existing
parsing logic had to be changed slightly. Such changes
are, in truth, an improvement. For example, instead of
seeing "inappropriate '2'" with ./top -2 we'll now see
the vastly more appropriate error "unknown option '2'.

References(s):
https://gitlab.com/procps-ng/procps/issues/55

[ this patch has been adapted from the master branch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-03-16 22:08:07 +11:00
Jim Warner
b2bd65407a top: provide -E command line switch for memory scaling
In their 3.2.7 version of top, Redhat introduced an -M
switch to automatically scale Summary Area memory data
to avoid truncation (and the resulting '+' indicator).

The procps-ng top does not employ suffixes with memory
data nor does it allow for different scaling with each
separate value. Rather, scaling appears at line start.

If built without ./configure --disable-modern-top, the
Summary Area memory will be scaled at GiB which should
lessen chance of truncation. Otherwise KiB was used to
reflect such memory, increasing the truncation chance.

And while 'W' can be used to preserve some appropriate
scaling value, there are arguments against such rcfile
approaches as cited in the issue and bug report below.

So this commit will bump the Summary Area memory scale
factor from KiB to MiB when using --disable-modern-top
as a concession to that Redhat bug report noted below.

And it also introduces a new command line switch which
can force any desired scaling regardless of the rcfile
or which ./configure option might have been specified.

[ for top's help text we'll show 'E' as if it were a ]
[ switch without arguments in order to keep the help ]
[ text displayable without wrap in an 80x24 terminal ]

[ the man page, however, will show all k-e arguments ]

Reference(s):
https://gitlab.com/procps-ng/procps/issues/53
https://bugzilla.redhat.com/show_bug.cgi?id=1034466

[ this patch has been adapted from the master branch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-03-16 22:08:07 +11:00
Jim Warner
b09014a7b6 top: share the rcfile between master & newlib branches
Since the decision was made to also add that Linux-4.5
support (was only in this newlib branch) to our master
branch, a tweak to newlib's top is necessary. In order
to share the rcfile between them, any fields unique to
a branch must appear last in it's list of enumerators.

And the troublesome field in question above is CGNAME.

It doesn't matter if a unique field is on or off, only
that it, as a higher enum/char, appear after all other
shared fields. Otherwise one risks the 'corrupt' error
message from the top without that field or the display
of the wrong column in the top with that unique field.

[ and strictly speaking, the changes under top_nls.c ]
[ were technically not really necessary. however, we ]
[ choose to maintain strict ordering via enum value. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-06-09 20:51:06 +10:00
Jim Warner
41661e03dc top: normalize 2 former SUSE only out-of-memory fields
Now that the conditional OOMEM_ENABLE has been removed
and all users exposed to those 'out of memory' fields,
it's about time we added them to the top man document.

But before doing so, it's long past time that they are
normalized to at last remedy this kind of foolishness:

. excessive width on that oomem score itself (8 vs. 4)
. some potentially confusing names inherited from suse

Reference(s):
. removal of misguided OOMEM_ENABLE
commit 64238730fa

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-04-17 09:12:02 +10:00
Jim Warner
46458ab6b7 top: exploit new linux-4.5 resident memory enhancement
Beginning with linux-4.5, the following new fields are
being added under that /proc/<pid>/status pseudo file:
 . RssAnon - size of resident anonymous memory
 . RssFile - size of resident file mappings
 . RssShmem - size of resident shared memory

This patch just represents the initial library and top
support, sharing a commit message with 2 more patches.

p.s. locked resident memory support was also added but
isn't directly related to the kernel 4.5 enhancements.

Reference(s):
commit 1f8e41d019

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-04-14 21:03:03 +10:00
Jim Warner
3a00c7e499 top: exploit <pids> enhancement for control group name
[ but stay tuned! there is a commit coming soon that ]
[ represents a rather major internal redesign, which ]
[ was prompted by the ps and top adaptation testing. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-10-14 21:49:08 +11:00
Jim Warner
f7fcb33652 top: eliminate an unused error message and its support
This commit just eliminates an error message no longer
needed under that newlib <pids> interface. Plus, a few
enumerators in the header weren't in alphabetic order.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-10-05 21:28:39 +11:00
Jim Warner
64238730fa build, library & top: make OOMEM options unconditional
It was probably always wrong to have a variable length
proc_t structure. This patch takes all remaining oomem
former suse only options and makes them unconditional.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-08-23 21:08:18 +10:00
Jim Warner
f937ff8238 top: eliminated old kernel-2.4 & 2.5 support (man too)
The newlib informal cutoff for kernel support seems to
be around release 2.6. This commit eliminates any such
support for really old 2.4 and 2.5 kernels within top.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-08-23 21:05:07 +10:00
Jim Warner
77dc22b910 top: exploit those new library task/threads provisions
This patch adapts top to exploit the new <proc/pids.h>
interface. And it appears to have reduced top's weight
by a considerable margin. Gone were the sort callbacks
and manipulation of those library flags. Gosh, all top
needs to do now is track some enumerators of interest.

[ whoa, wait just a damn minute. it now appears some ]
[ that weight loss was solely the result of a theft. ]

[ jeeze, we turn our back for just a minute & newlib ]
[ up & steals our pids hashing logic for his history ]
[ needs. oh well, i guess life's just not that fair. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-08-23 21:05:07 +10:00
Jim Warner
cca63f2f66 top: eliminate 'user' from the inspection view headers
Since it's possible that euser name is not being shown
or the horizontal position had been scrolled past that
USER column, then part of those headers will be blank.

So it doesn't make sense to try and show the USER that
is associated with a process at all. Thus, this commit
simply removes the 'user' provision from both headers.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-08-23 21:00:15 +10:00
Jim Warner
9830fdf0ae top: tweak newlib interface, as more experience gained
Now that the dust is settling following an initial API
library effort, it is apparent my naming standards may
not have always been observed. This was a minor crime,
since those standards are unwritten (& not apparent?).

Basically, top has always capitalized the first letter
of global variables in an effort to distinguish global
definitions from local variables later in the program.

So this patch alters the new API variables to conform,
while also explicitly using 'context' for key structs.

Lastly, top now employs the new '#include <proc/name>'
conventions for the new/converted module header files.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-07-01 21:32:16 +10:00
Jim Warner
8ded6c5739 top: exploit the new library API for cpu display needs
This commit is mostly about eliminating code, now that
a library is responsible for the cpu tics maintenance.

The top program will continue to provide numa support,
without involving the library in any of those details.
[ not to mention all the 'dl' and 'stderr' numa crap ]

With this transfer of the cpu tics duty to our library
the provision associated with the CPU_ZEROTICS #define
could not initially be migrated. The commit referenced
below suggests it may have lost its importance. In any
case such logic may yet be incorporated in the future.
But for now, that #define has been completely removed.

Reference(s):
commit ee3ed4b45e

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-06-29 21:31:16 +10:00
Jim Warner
c3fd7473c5 top: exploit the new library API for memory statistics
This commit represents the pioneering attempt at using
the concept of 'chained' library requests in an effort
to reduce function call overhead. It required exposing
no more implementation details than were already shown
through the individual calls, yet is satisfied in one.

It is just such an approach that will prove invaluable
when it comes time to access individual /proc/##/data.
Programs could 'chain' only those 'results' structures
representing their current view independent of all the
fields any such programs might be prepared to display.

Thus the standard 'read', which wouldn't apply to task
level data very well (or efficiently), can now become
a 'read_chain' whereby the former PROC_FILL flags need
can be satisfied & yield the minimum open/close calls.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-06-29 21:29:33 +10:00
Jim Warner
2ba7aa8b7d top: add support exploiting new library LXC containers
Reference(s):
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1424253
https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1424253

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-06-14 15:36:06 +10:00
Jim Warner
e107f5d63b top: miscellaneous accumulated changes to program code
This commit just tweaks top in the following respects:

. for alphabetic integrity, change 'INSP_hdr...' names

. eliminate the -Wsometimes-uninitialized warning that
was found under OSX Yosemite (llvm 6.0/clang-600.0.56)

. update program 'comments' reflecting copyright dates

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-04-07 20:46:15 +10:00
Jim Warner
d310a18fc2 top: exploit new kb_main_available, make Jaromir happy
This patch will trade a former pessimistic calculation
of free physical memory for a more optimistic one that
uses the newly added kb_main_available library export.

But in case one might wish to return to the old former
method, there's a new #define that was made available.

[ the new calculation will affect graphing mode only ]

Reference(s):
http://www.freelists.org/post/procps/systemd-support-to-library,9

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-18 20:49:57 +02:00
Jim Warner
a7741055f1 top: add another translation hint for graphs alignment
This should be the last of this kind of crap. I'll get
to work on some means to no longer burden a translator
with lengths requirements. Ideally each word should be
allowed to stand alone and the minimum/maximum lengths
handled programmatically when our ol' top is executed.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-07 18:43:52 +02:00
Jim Warner
c75586f523 top: eliminated unreferenced macros & an error message
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-07-07 18:43:52 +02:00
Jim Warner
805532ac32 top: fix translation hint to preserve graphs alignment
Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-06-28 23:46:40 +10:00
Jim Warner
f7b84f45c7 top: tweak argument parsing for some locale situations
Boy I hate locale stuff. For code I thought was pretty
robust, Jaromir sure proved that it wasn't. Anyway, me
thinks this commit closes some gaps and will cause top
to behave appropriately under various locale settings.

It does *not* permit top to respond to the ',' and '.'
floating point separator without regard to the locale.
It does, however, enforce proper LC_NUMERIC responses.

Let's look on this commit as an interim solution until
Jaromir can create that proposed 'fp_decode' function.
Who knows, he might even borrow some of our mkfloat().

[ An aside: the coreutils sleep and timeout programs ]
[ claim to permit floating point arguments. However, ]
[ neither one will accept the comma separator should ]
[ the locale be a country that in fact uses a comma. ]

[ In other words, with this commit we are way ahead! ]

Reference(s):
http://www.freelists.org/post/procps/topwatch-floating-point-input
http://www.freelists.org/post/procps/topwatch-floating-point-input,1

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-06-25 13:58:31 +02:00
Jim Warner
41ab7f005e top: with new bar graphs, make 'b' toggle unrestricted
While the 'b' toggle remains window based (vs. global)
it should no longer require that the window be visible
and either the 'x' or 'y' toggles to be on. Previously
those requirements were intended to remind a user that
there must be something for this command to highlight.

With the introduction of graph modes (specifically the
the bar graph) the 'bold/reverse' toggle has important
implications beyond highlighting some columns or rows.

The %Cpu(s) graph and Mem portion of the memory graphs
are designed to offer a visual clue as to the separate
elements comprising them. But that separation could be
lost under some X color schemes or when top is running
without color (in monochrome mode) and the block graph
is selected. But, if the graph is then changed to bars
any separation always becomes visible whenever the 'b'
toggle is turned off. Portions then show in 'reverse'.

So from now on we'll check nothing, we'll just toggle.

[ Besides, with all the code thrown at restricting a ]
[ 'b' toggle use, it might have all been for naught. ]
[ That toggle could still be set/unset using the 'Z' ]
[ command and the color mapping screen. Geez Louise! ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-06-24 20:38:30 +10:00
Jim Warner
318919094d top: rearrange Mem & Swap lines and standardize 'used'
In anticipation of upcoming memory graphing provisions
the abbreviations 'Mem' and 'Swap' are being made into
individual translatable strings in order to be reused.

Additionally, the Mem 'used' amount will now no longer
included the 'buffers' and 'cached' values. Thus, each
Mem category becomes unique. This is the approach used
by tools such as 'htop' or the gnome 'System Monitor'.

Lastly, with that change to the 'used' category it has
been repositioned after 'free' on the Mem & Swap lines
making a comparison between 'total' and 'free' easier.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-06-22 21:39:55 +10:00
Jim Warner
0caa6d6e67 top: miscellaneous accumulated changes to program code
. prevent any input recall overrun if window downsized
. adjust translation notes for true column hdr maximum

Signed-off-by: Jim Warner <james.warner@comcast.net>
2014-05-13 16:39:49 +02:00