2011-03-31 16:45:12 +05:30
|
|
|
|
/* top.h - Header file: show Linux processes */
|
|
|
|
|
/*
|
2022-01-07 11:30:00 +05:30
|
|
|
|
* Copyright (c) 2002-2022, by: Jim Warner <james.warner@comcast.net
|
2011-03-31 16:45:12 +05:30
|
|
|
|
*
|
|
|
|
|
* This file may be used subject to the terms and conditions of the
|
|
|
|
|
* GNU Library General Public License Version 2, or any later version
|
|
|
|
|
* at your option, as published by the Free Software Foundation.
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Library General Public License for more details.
|
|
|
|
|
*/
|
|
|
|
|
/* For contributions to this program, the author wishes to thank:
|
2022-01-07 13:59:23 +05:30
|
|
|
|
* Craig Small, <csmall@dropbear.xyz>
|
2011-03-31 16:45:12 +05:30
|
|
|
|
* Albert D. Cahalan, <albert@users.sf.net>
|
2011-10-12 00:32:59 +05:30
|
|
|
|
* Sami Kerola, <kerolasa@iki.fi>
|
2011-03-31 16:45:12 +05:30
|
|
|
|
*/
|
2002-05-30 09:14:46 +05:30
|
|
|
|
#ifndef _Itop
|
|
|
|
|
#define _Itop
|
2002-02-02 04:17:29 +05:30
|
|
|
|
|
2012-02-11 12:31:01 +05:30
|
|
|
|
/* Defines represented in configure.ac ----------------------------- */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define BOOST_MEMORY /* enable extra precision in memory fields */
|
|
|
|
|
//#define BOOST_PERCNT /* enable extra precision for two % fields */
|
2014-06-29 10:30:00 +05:30
|
|
|
|
//#define ORIG_TOPDEFS /* with no rcfile retain original defaults */
|
2013-01-29 11:30:00 +05:30
|
|
|
|
//#define SIGNALS_LESS /* favor reduced signal load over response */
|
2012-02-11 12:31:01 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* Development/Debugging defines ----------------------------------- */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define ATEOJ_RPTSTD /* report on some miscellany at end-of-job */
|
2022-05-12 10:30:00 +05:30
|
|
|
|
//#define BOT_DEAD_ZAP /* zap Ctrl bottom window when target dies */
|
2022-05-18 10:30:00 +05:30
|
|
|
|
//#define BOT_STRV_OFF /* don't emphasize strv w/ focus if spaces */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define CASEUP_HEXES /* show all those hex values in upper case */
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//#define CASEUP_SUFIX /* show time/mem/cnts suffix in upper case */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define EQUCOLHDRYES /* yes, equalize the column header lengths */
|
2022-01-03 10:30:00 +05:30
|
|
|
|
//#define FOCUS_HARD_Y /* 'F' will avoid topmost task distortions */
|
|
|
|
|
//#define FOCUS_TREE_X /* 'F' resets forest view indentation to 0 */
|
2022-01-15 01:44:14 +05:30
|
|
|
|
//#define FOCUS_VIZOFF /* 'F' doesn't provide the visual clue '|' */
|
2021-09-04 10:30:00 +05:30
|
|
|
|
//#define GETOPTFIX_NO /* do not address getopt_long deficiencies */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define INSP_JUSTNOT /* do not smooth unprintable right margins */
|
top: add a flexible 'Inspect' capability
This commit introduces an extremely powerful, flexible
brand new capability. Now, users can pause the normal
iterative display and inspect the contents of any file
or output from any script, command, or even pipelines.
It's invoked via the 'Y' interactive command which, in
turn, is supported with simple user supplied additions
as new entries in the top personal configuration file.
A separate new 'Inspect' window supports scrolling and
searching, similar to the main top display. Except it
extends existing 'L'/'&' (locate/locate-next) commands
so that an out-of-view match automatically adjusts the
horizontal position bringing such data into view. And
it provides for multiple successive same line matches.
Also, the basic 'more/less' navigation keys are active
in this new 'Inspect' window, to ease user transition.
There are no program changes required when entries are
added to or deleted from the rcfile. And there are no
known limits to the complexity of a script, command or
pipeline, other than the unidirectional nature imposed
by the 'popen' function call which top cannot violate.
Since it's impossible to predict exactly what contents
will be generated, top treats all output as raw binary
data. Any control characters display in '^C' notation
while all other unprintable characters show as '<AB>'.
The biggest problem encountered was with the find/next
capability since that strstr guy was really diminished
given the possibility that numerous 'strings' could be
encountered *within* many of top's raw, binary 'rows'.
Oh, and another problem was in maintaining the perfect
left & right text justification of this commit message
along with all of the commit summaries. Some of those
summaries (like this very one) are of course, slightly
shorter, to make room for the 'man document' addition.
Enjoy!
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-25 10:30:05 +05:30
|
|
|
|
//#define INSP_OFFDEMO /* disable demo screens, issue msg instead */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define INSP_SAVEBUF /* preserve 'Insp_buf' contents via a file */
|
|
|
|
|
//#define INSP_SLIDE_1 /* when scrolling left/right, don't move 8 */
|
2014-07-17 23:43:13 +05:30
|
|
|
|
//#define MEMGRAPH_OLD /* don't use 'available' when graphing Mem */
|
2013-06-28 10:30:00 +05:30
|
|
|
|
//#define OFF_SCROLLBK /* disable tty emulators scrollback buffer */
|
2014-02-20 11:30:00 +05:30
|
|
|
|
//#define OFF_STDERROR /* disable our stderr buffering (redirect) */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define OFF_STDIOLBF /* disable our own stdout 'IOFBF' override */
|
2018-01-08 11:30:00 +05:30
|
|
|
|
//#define OFF_XTRAWIDE /* disable our extra wide multi-byte logic */
|
2021-07-20 10:30:00 +05:30
|
|
|
|
//#define PRETEND0NUMA /* pretend that there ain't any numa nodes */
|
2020-05-24 21:55:01 +05:30
|
|
|
|
//#define PRETEND48CPU /* pretend we're smp with 48 ticsers (sic) */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define PRETENDNOCAP /* pretend terminal missing essential caps */
|
|
|
|
|
//#define QUICK_GRAPHS /* use fast algorithm & accept +2% distort */
|
2011-04-15 04:54:29 +05:30
|
|
|
|
//#define RCFILE_NOERR /* rcfile errs silently default, vs. fatal */
|
2013-02-22 11:30:00 +05:30
|
|
|
|
//#define RECALL_FIXED /* don't reorder saved strings if recalled */
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//#define RMAN_IGNORED /* don't consider auto right margin glitch */
|
top: refactor 'scale_tics' function for better scaling
This patch refactors the 'scale_tics' function to more
closely parallel uptime shown on the first line of the
summary area. The old logic has been preserved through
the header file's new #define SCALE_FORMER provision.
However, the former logic was actually a big disaster.
These are some potential problems with that old logic:
1. With respect to our time fields top no longer deals
solely with cpu time. So, the old limits of '68 weeks'
could possibly be insufficient to reflect those times.
2. Given the widths of top's new time fields, the code
never got beyond scaling to hours. For example, with a
ridiculously large span of 19 years, the scaled result
would then be shown as '167832h'. We never reached the
days ('6993d') or even the weeks ('999w') equivalents.
3. Similarly, with that 'TIME+' field and a large tics
value, results would then appear as 'MMMMMM:SS' rather
than the more meaningful 'HH:MM:SS' or days and hours.
So henceforth we will adopt these scaling conventions:
MMM:SS.hh ... minutes:seconds.hundredths
MMM:SS ...... minutes:seconds
HH,MM ....... hours,minutes
D+H ......... days+hours (with 'd' & 'h' suffixes)
D ........... days (with 'd' suffix)
W+D ......... weeks+days (with 'w' & 'd' suffixes)
W ........... weeks (with 'w' suffix)
Note that, unlike our former scaling logic, that 'MMM'
portion won't be allowed to grow unconditionally. It's
limited (arbitrarily?) to 360 total minutes (6 hours).
Additionally, the 'HH' guy will be limited to 96 hours
(4 days) while that 'D' limit was set at 14 (2 weeks).
Whenever a limit is hit, scaling will advance a level.
Reference(s):
. Feb, 2022 - added 'ELAPSED'
commit 9348d3b0085bd389749cc5619fdde4ec3fae5f11
. Feb, 2022 - added 'STARTED'
commit 7647e96b0a35d473fa9bc644ea6107487b3b0527
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-03 11:30:00 +05:30
|
|
|
|
//#define SCALE_FORMER /* scale_tics() guy shouldn't mimic uptime */
|
|
|
|
|
//#define SCALE_POSTFX /* scale_tics() try without a 'h,d' suffix */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define SCROLLVAR_NO /* disable intra-column horizontal scrolls */
|
|
|
|
|
//#define SCROLLV_BY_1 /* when scrolling left/right do not move 8 */
|
2012-04-11 14:41:12 +05:30
|
|
|
|
//#define STRINGCASENO /* case insenstive compare/locate versions */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define TERMIOS_ONLY /* use native input only (just limp along) */
|
2021-09-19 10:30:00 +05:30
|
|
|
|
//#define THREADED_CPU /* separate background thread for cpu updt */
|
|
|
|
|
//#define THREADED_MEM /* separate background thread for mem updt */
|
|
|
|
|
//#define THREADED_TSK /* separate background thread for tsk updt */
|
2020-05-22 10:30:00 +05:30
|
|
|
|
//#define TOG4_NOFORCE /* no force 2 abreast mode with '4' toggle */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define TOG4_NOTRUNC /* ensure no truncation for 2 abreast mode */
|
|
|
|
|
//#define TOG4_OFF_MEM /* don't show two abreast memory statistic */
|
2021-08-04 10:30:00 +05:30
|
|
|
|
//#define TOG4_OFF_SEP /* don't show two abreast visual separator */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define TREE_NORESET /* sort keys should not force 'V' view off */
|
2014-10-28 10:30:00 +05:30
|
|
|
|
//#define TREE_SCANALL /* rescan array w/ forest view, avoid sort */
|
2018-10-01 10:30:00 +05:30
|
|
|
|
//#define TREE_VALTMRK /* use an indented '+' with collapsed pids */
|
top: parent total cpu includes collapsed children, pgm
Now, when a parent's children have been collapsed, the
cpu used by those unseen tasks will disappear no more.
Instead such tics will be added to the parent's total.
[ if one wished a return to the 'land of lost tics', ]
[ the '#define TREE_VCPUOFF' directive is available. ]
------------------------------------------------------
Note: With collapsible parents now displaying children
cpu usage, it will eventually be noticed the cpu stats
for the summary area and task areas often vary widely.
It's worth a reminder that for top's summary area each
individual cpu and the cpu summary is limited to 100%,
regardless of how many tics a linux kernel may export.
An individual task is limited to 100% times the number
of threads. But, in no case will cpu usage ever exceed
100% times total number of processors. Such limits are
further reduced under 'Solaris' mode ('I' toggle off).
In this mode, a task cpu usage will never exceed 100%.
These limits will now also apply to collapsed parents.
In addition to those influences, results are subjected
to kernel timer sampling anomalies and the distortions
inherent in a small sample size, made worse by smaller
delay intervals. Often there is just 1 or 2 tics for a
few tasks at smaller intervals such as: 1/10th second.
Anyway, should questions on this subject arise, a good
starting point, beyond the reminders above, is the 1st
link listed below. Those other links were derivatives.
Reference(s):
. from the kernel documentation
https://www.kernel.org/doc/Documentation/cpu-load.txt
. as mentioned in the above kernel documentation
https://lkml.org/lkml/2007/2/12/6
. from above, with many more links on the subject
https://www.boblycat.org/~malc/apc/
Signed-off-by: Jim Warner <james.warner@comcast.net>
2018-06-25 10:30:00 +05:30
|
|
|
|
//#define TREE_VCPUOFF /* a collapsed parent excludes child's cpu */
|
2018-06-20 10:30:00 +05:30
|
|
|
|
//#define TREE_VPROMPT /* pid collapse/expand prompt, vs. top row */
|
|
|
|
|
//#define TREE_VWINALL /* pid collapse/expand impacts all windows */
|
2011-04-14 02:38:14 +05:30
|
|
|
|
//#define USE_X_COLHDR /* emphasize header vs. whole col, for 'x' */
|
2021-09-14 10:30:00 +05:30
|
|
|
|
//#define VALIDATE_NLS /* ensure the integrity of four nls tables */
|
2018-01-25 11:30:00 +05:30
|
|
|
|
//#define WIDEN_COLUMN /* base column widths on translated header */
|
2011-04-14 02:38:14 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*###### Notes, etc. ###################################################*/
|
|
|
|
|
|
2011-05-05 15:37:25 +05:30
|
|
|
|
/* For introducing inaugural cgroup support, thanks to:
|
2011-10-28 20:58:37 +05:30
|
|
|
|
Jan Gorig <jgorig@redhat.com> - April, 2011 */
|
2004-07-07 01:35:30 +05:30
|
|
|
|
|
2011-10-12 00:32:59 +05:30
|
|
|
|
/* For the motivation and path to nls support, thanks to:
|
2012-02-07 11:29:59 +05:30
|
|
|
|
Sami Kerola, <kerolasa@iki.fi> - December, 2011 */
|
2011-10-12 00:32:59 +05:30
|
|
|
|
|
|
|
|
|
/* There are still some short strings that may yet be candidates
|
|
|
|
|
for nls support inclusion. They're identified with:
|
2011-10-28 20:58:37 +05:30
|
|
|
|
// nls_maybe */
|
2002-02-02 04:17:29 +05:30
|
|
|
|
|
2013-04-08 12:30:00 +05:30
|
|
|
|
/* For the impetus and NUMA/Node prototype design, thanks to:
|
|
|
|
|
Lance Shelton <LShelton@fusionio.com> - April, 2013 */
|
|
|
|
|
|
2017-10-02 10:30:00 +05:30
|
|
|
|
/* For prompting & helping with top's utf-8 support, thanks to:
|
|
|
|
|
Göran Uddeborg <goeran@uddeborg.se> - September, 2017 */
|
|
|
|
|
|
2012-04-11 14:41:12 +05:30
|
|
|
|
// pretend as if #define _GNU_SOURCE
|
|
|
|
|
char *strcasestr(const char *haystack, const char *needle);
|
2013-03-03 11:30:00 +05:30
|
|
|
|
|
|
|
|
|
#ifdef STRINGCASENO
|
2012-04-11 14:41:12 +05:30
|
|
|
|
#define STRSTR strcasestr
|
|
|
|
|
#define STRCMP strcasecmp
|
2011-03-31 16:45:12 +05:30
|
|
|
|
#else
|
2012-04-11 14:41:12 +05:30
|
|
|
|
#define STRSTR strstr
|
|
|
|
|
#define STRCMP strcmp
|
2011-03-31 16:45:12 +05:30
|
|
|
|
#endif
|
2002-06-19 05:15:30 +05:30
|
|
|
|
|
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/*###### Some Miscellaneous constants ##################################*/
|
2002-06-19 05:15:30 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* The default delay twix updates */
|
2014-06-29 10:30:00 +05:30
|
|
|
|
#ifdef ORIG_TOPDEFS
|
2011-03-31 16:45:12 +05:30
|
|
|
|
#define DEF_DELAY 3.0
|
2014-06-29 10:30:00 +05:30
|
|
|
|
#else
|
|
|
|
|
#define DEF_DELAY 1.5
|
|
|
|
|
#endif
|
2002-06-19 05:15:30 +05:30
|
|
|
|
|
2011-07-14 16:46:02 +05:30
|
|
|
|
/* Length of time a message is displayed and the duration
|
|
|
|
|
of a 'priming' wait during library startup (in microseconds) */
|
2013-01-16 11:30:00 +05:30
|
|
|
|
#define MSG_USLEEP 1250000
|
|
|
|
|
#define LIB_USLEEP 150000
|
2004-07-07 01:35:30 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* Specific process id monitoring support (command line only) */
|
|
|
|
|
#define MONPIDMAX 20
|
2002-06-19 05:15:30 +05:30
|
|
|
|
|
2011-05-26 15:03:32 +05:30
|
|
|
|
/* Output override minimums (the -w switch and/or env vars) */
|
|
|
|
|
#define W_MIN_COL 3
|
|
|
|
|
#define W_MIN_ROW 3
|
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* Miscellaneous buffers with liberal values and some other defines
|
|
|
|
|
-- mostly just to pinpoint source code usage/dependancies */
|
|
|
|
|
#define SCREENMAX 512
|
|
|
|
|
/* the above might seem pretty stingy, until you consider that with every
|
2011-12-29 23:20:32 +05:30
|
|
|
|
field displayed the column header would be approximately 250 bytes
|
|
|
|
|
-- so SCREENMAX provides for all fields plus a 250+ byte command line */
|
2022-04-24 10:30:00 +05:30
|
|
|
|
#define TNYBUFSIZ 16
|
2011-03-31 16:45:12 +05:30
|
|
|
|
#define CAPBUFSIZ 32
|
|
|
|
|
#define CLRBUFSIZ 64
|
2022-03-13 11:30:00 +05:30
|
|
|
|
#define PFLAGSSIZ 128
|
2011-04-14 02:38:14 +05:30
|
|
|
|
#define SMLBUFSIZ 128
|
2011-03-31 16:45:12 +05:30
|
|
|
|
#define MEDBUFSIZ 256
|
2011-04-14 02:38:14 +05:30
|
|
|
|
#define LRGBUFSIZ 512
|
2011-03-31 16:45:12 +05:30
|
|
|
|
#define OURPATHSZ 1024
|
|
|
|
|
#define BIGBUFSIZ 2048
|
2022-05-15 10:30:00 +05:30
|
|
|
|
#define BOTBUFSIZ 16384
|
|
|
|
|
// next is same as library's max buffer size
|
|
|
|
|
#define MAXBUFSIZ (1024*64*2)
|
2012-06-30 10:30:55 +05:30
|
|
|
|
/* in addition to the actual display data, our row might have to accommodate
|
2011-04-14 02:38:14 +05:30
|
|
|
|
many termcap/color transitions - these definitions ensure we have room */
|
2022-01-08 11:30:00 +05:30
|
|
|
|
#define ROWMINSIZ ( SCREENMAX + 8 * (CAPBUFSIZ + CLRBUFSIZ) )
|
2011-04-14 02:38:14 +05:30
|
|
|
|
#define ROWMAXSIZ ( SCREENMAX + 16 * (CAPBUFSIZ + CLRBUFSIZ) )
|
top: add a flexible 'Inspect' capability
This commit introduces an extremely powerful, flexible
brand new capability. Now, users can pause the normal
iterative display and inspect the contents of any file
or output from any script, command, or even pipelines.
It's invoked via the 'Y' interactive command which, in
turn, is supported with simple user supplied additions
as new entries in the top personal configuration file.
A separate new 'Inspect' window supports scrolling and
searching, similar to the main top display. Except it
extends existing 'L'/'&' (locate/locate-next) commands
so that an out-of-view match automatically adjusts the
horizontal position bringing such data into view. And
it provides for multiple successive same line matches.
Also, the basic 'more/less' navigation keys are active
in this new 'Inspect' window, to ease user transition.
There are no program changes required when entries are
added to or deleted from the rcfile. And there are no
known limits to the complexity of a script, command or
pipeline, other than the unidirectional nature imposed
by the 'popen' function call which top cannot violate.
Since it's impossible to predict exactly what contents
will be generated, top treats all output as raw binary
data. Any control characters display in '^C' notation
while all other unprintable characters show as '<AB>'.
The biggest problem encountered was with the find/next
capability since that strstr guy was really diminished
given the possibility that numerous 'strings' could be
encountered *within* many of top's raw, binary 'rows'.
Oh, and another problem was in maintaining the perfect
left & right text justification of this commit message
along with all of the commit summaries. Some of those
summaries (like this very one) are of course, slightly
shorter, to make room for the 'man document' addition.
Enjoy!
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-25 10:30:05 +05:30
|
|
|
|
// minimum size guarantee for dynamically acquired 'readfile' buffer
|
|
|
|
|
#define READMINSZ 2048
|
2013-01-16 11:30:00 +05:30
|
|
|
|
// size of preallocated search string buffers, same as ioline()
|
top: highlight all regular search string(s) when found
With the recent inspect search highlight provisions in
place, the lack of highlighting in task based searches
has grown from being only irritating to a real defect.
Thus, this commit introduces parallel functionality to
those searches initiated within a visible task window.
And just as separate inspect searches are possible for
each selection, per window task searches are provided.
However, it should be noted that there are differences
between task based searches and inspect type searches:
* There is no concept of out-of-view data when dealing
. with task rows -- if the data can't bee seen, it has
. not, in fact, been constructed from a proc_t struct.
* While inspect data is output at the character level,
. up to now all task display data was only potentially
. output and it was always based on a complete string.
* With task search highlighting, rows now containing a
. match must be output in pieces and, therefore, can't
. be optimized away like other rows which haven't been
. been altered. This is because top cannot predict the
. the contents of a search string or, how many matches
. might occur in a given row. Short search strings and
. many matches would raise buffer needs geometrically.
(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-08 11:30:00 +05:30
|
|
|
|
#define FNDBUFSIZ MEDBUFSIZ
|
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
|
2012-09-19 11:31:01 +05:30
|
|
|
|
// space between task fields/columns
|
|
|
|
|
#define COLPADSTR " "
|
|
|
|
|
#define COLPADSIZ ( sizeof(COLPADSTR) - 1 )
|
|
|
|
|
// continuation ch when field/column truncated
|
|
|
|
|
#define COLPLUSCH '+'
|
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
// support for keyboard stuff (cursor motion keystrokes, mostly)
|
|
|
|
|
#define kbd_ESC '\033'
|
|
|
|
|
#define kbd_SPACE ' '
|
2013-03-01 11:30:00 +05:30
|
|
|
|
#define kbd_ENTER '\n'
|
2013-02-15 11:30:00 +05:30
|
|
|
|
#define kbd_UP 129
|
|
|
|
|
#define kbd_DOWN 130
|
|
|
|
|
#define kbd_LEFT 131
|
|
|
|
|
#define kbd_RIGHT 132
|
|
|
|
|
#define kbd_PGUP 133
|
|
|
|
|
#define kbd_PGDN 134
|
|
|
|
|
#define kbd_HOME 135
|
|
|
|
|
#define kbd_END 136
|
|
|
|
|
#define kbd_BKSP 137
|
|
|
|
|
#define kbd_INS 138
|
|
|
|
|
#define kbd_DEL 139
|
2022-05-17 10:30:00 +05:30
|
|
|
|
#define kbd_BTAB 140
|
2022-03-03 11:30:00 +05:30
|
|
|
|
#define kbd_CtrlE '\005'
|
2022-04-30 10:30:00 +05:30
|
|
|
|
#define kbd_CtrlG '\007'
|
2022-05-12 10:30:00 +05:30
|
|
|
|
#define kbd_CtrlI '\011'
|
2022-04-30 10:30:00 +05:30
|
|
|
|
#define kbd_CtrlK '\013'
|
2022-06-02 10:30:00 +05:30
|
|
|
|
#define kbd_CtrlL '\014'
|
2022-05-02 10:30:00 +05:30
|
|
|
|
#define kbd_CtrlN '\016'
|
2022-04-24 10:30:00 +05:30
|
|
|
|
#define kbd_CtrlO '\017'
|
2022-05-12 10:30:00 +05:30
|
|
|
|
#define kbd_CtrlP '\020'
|
2022-04-24 10:30:00 +05:30
|
|
|
|
#define kbd_CtrlR '\022'
|
2022-04-30 10:30:00 +05:30
|
|
|
|
#define kbd_CtrlU '\025'
|
2011-03-31 16:45:12 +05:30
|
|
|
|
|
2012-01-09 22:56:45 +05:30
|
|
|
|
/* Special value in Pseudo_row to force an additional procs refresh
|
|
|
|
|
-- used at startup and for task/thread mode transitions */
|
|
|
|
|
#define PROC_XTRA -1
|
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
|
|
|
|
|
/* ##### Enum's and Typedef's ############################################ */
|
|
|
|
|
|
|
|
|
|
/* Flags for each possible field (and then some) --
|
2016-10-07 11:41:11 +05:30
|
|
|
|
these MUST be kept in sync with the Fieldstab[] array !! */
|
2011-03-31 16:45:12 +05:30
|
|
|
|
enum pflag {
|
2014-02-25 11:30:00 +05:30
|
|
|
|
EU_PID = 0, EU_PPD,
|
|
|
|
|
EU_UED, EU_UEN, EU_URD, EU_URN, EU_USD, EU_USN,
|
|
|
|
|
EU_GID, EU_GRP, EU_PGD, EU_TTY, EU_TPG, EU_SID,
|
|
|
|
|
EU_PRI, EU_NCE, EU_THD,
|
|
|
|
|
EU_CPN, EU_CPU, EU_TME, EU_TM2,
|
|
|
|
|
EU_MEM, EU_VRT, EU_SWP, EU_RES, EU_COD, EU_DAT, EU_SHR,
|
|
|
|
|
EU_FL1, EU_FL2, EU_DRT,
|
|
|
|
|
EU_STA, EU_CMD, EU_WCH, EU_FLG, EU_CGR,
|
|
|
|
|
EU_SGD, EU_SGN, EU_TGD,
|
|
|
|
|
EU_OOA, EU_OOM,
|
|
|
|
|
EU_ENV,
|
|
|
|
|
EU_FV1, EU_FV2,
|
|
|
|
|
EU_USE,
|
|
|
|
|
EU_NS1, EU_NS2, EU_NS3, EU_NS4, EU_NS5, EU_NS6,
|
2016-06-07 10:30:00 +05:30
|
|
|
|
EU_LXC,
|
2016-04-13 10:30:00 +05:30
|
|
|
|
EU_RZA, EU_RZF, EU_RZL, EU_RZS,
|
2016-06-07 10:30:00 +05:30
|
|
|
|
EU_CGN,
|
2017-05-12 10:34:00 +05:30
|
|
|
|
EU_NMA,
|
2018-02-11 15:03:33 +05:30
|
|
|
|
EU_LID,
|
2018-06-22 10:30:00 +05:30
|
|
|
|
EU_EXE,
|
2021-06-16 10:30:00 +05:30
|
|
|
|
EU_RSS, EU_PSS, EU_PZA, EU_PZF, EU_PZS, EU_USS,
|
2021-06-20 10:30:00 +05:30
|
|
|
|
EU_IRB, EU_IRO, EU_IWB, EU_IWO,
|
2021-08-05 10:30:00 +05:30
|
|
|
|
EU_AGI, EU_AGN,
|
2022-03-06 11:30:00 +05:30
|
|
|
|
EU_TM3, EU_TM4, EU_CUU, EU_CUC,
|
2022-05-05 10:30:00 +05:30
|
|
|
|
EU_NS7, EU_NS8,
|
2011-04-14 02:38:14 +05:30
|
|
|
|
#ifdef USE_X_COLHDR
|
|
|
|
|
// not really pflags, used with tbl indexing
|
2014-02-25 11:30:00 +05:30
|
|
|
|
EU_MAXPFLGS
|
2011-04-14 02:38:14 +05:30
|
|
|
|
#else
|
2011-03-31 16:45:12 +05:30
|
|
|
|
// not really pflags, used with tbl indexing & col highlighting
|
2014-02-25 11:30:00 +05:30
|
|
|
|
EU_MAXPFLGS, EU_XON, EU_XOF
|
2011-04-14 02:38:14 +05:30
|
|
|
|
#endif
|
2011-03-31 16:45:12 +05:30
|
|
|
|
};
|
2002-06-19 05:15:30 +05:30
|
|
|
|
|
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-14 11:30:00 +05:30
|
|
|
|
/* The scaling 'target' used with memory fields */
|
|
|
|
|
enum scale_enum {
|
2014-06-18 10:30:00 +05:30
|
|
|
|
SK_Kb, SK_Mb, SK_Gb, SK_Tb, SK_Pb, SK_Eb
|
2011-03-31 16:45:12 +05:30
|
|
|
|
};
|
2002-05-30 09:14:46 +05:30
|
|
|
|
|
2013-06-30 10:30:00 +05:30
|
|
|
|
/* Used to manipulate (and document) the Frames_signal states */
|
2013-01-16 11:30:00 +05:30
|
|
|
|
enum resize_states {
|
2022-05-03 10:30:00 +05:30
|
|
|
|
BREAK_off = 0, BREAK_kbd, BREAK_sig, BREAK_autox, BREAK_screen
|
2013-01-16 11:30:00 +05:30
|
|
|
|
};
|
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* This typedef just ensures consistent 'process flags' handling */
|
top: provide an unlimited capacity for field additions
With each of those references shown below, the maximum
number of fields was increased. However, with a 'char'
based implementation we're nearing the upper limits of
total displayable fields. We currently use 76 of a max
of 86 fields. With extra effort, 94 might be possible.
But 94 is the absolute upper limit of possible fields!
Moreover, the current implementation yields characters
that were unprintable in the rcfile. This could become
an issue with that 'inspect' feature when/if an rcfile
is edited to add entries (as opposed to using 'echo').
So, with this commit the internals of field management
has been completely reimagined. It is now based on the
integer type, not a character. And whereas that former
design used the high order bit to show the 'on' state,
thus yielding an unprintable character, the new design
uses the low order bit for the state. As such, numbers
will be kept small and an even number will be an 'off'
field whereas an odd number will become an 'on' state.
The bottom line is that this new design will afford an
unlimited number of new fields while keeping an rcfile
completely free of that potential unprintable garbage.
And it is embarrassingly easy to extend the maximum of
supportable fields from the currently implemented 100.
Who knows, maybe a future patch will prove this point.
[ unless a subsequent commit proves otherwise, given ]
[ the dramatic differences in rcfile contents, i had ]
[ to abandon the practice of supporting old rcfiles. ]
Reference(s):
. Nov, 2013 - RCF_PLUS_H introduced
commit af4e6533ba5ee04f414bc8774df31ddef38e8880
. Jul, 2016 - RCF_PLUS_J introduced
commit d5c5051fb395e8bebaadb42add79ca99a16afe85
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-13 11:30:00 +05:30
|
|
|
|
typedef int FLG_t;
|
2002-09-13 17:12:44 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* These typedefs attempt to ensure consistent 'ticks' handling */
|
2002-12-05 04:18:30 +05:30
|
|
|
|
typedef unsigned long long TIC_t;
|
|
|
|
|
typedef long long SIC_t;
|
2002-05-30 09:14:46 +05:30
|
|
|
|
|
2002-09-13 17:12:44 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* /////////////////////////////////////////////////////////////// */
|
|
|
|
|
/* Special Section: multiple windows/field groups --------------- */
|
|
|
|
|
/* ( kind of a header within a header: constants, types & macros ) */
|
|
|
|
|
|
|
|
|
|
#define CAPTABMAX 9 /* max entries in each win's caps table */
|
|
|
|
|
#define GROUPSMAX 4 /* the max number of simultaneous windows */
|
|
|
|
|
#define WINNAMSIZ 4 /* size of RCW_t winname buf (incl '\0') */
|
|
|
|
|
#define GRPNAMSIZ WINNAMSIZ+2 /* window's name + number as in: '#:...' */
|
|
|
|
|
|
|
|
|
|
/* The Persistent 'Mode' flags!
|
|
|
|
|
These are preserved in the rc file, as a single integer and the
|
|
|
|
|
letter shown is the corresponding 'command' toggle */
|
|
|
|
|
// 'View_' flags affect the summary (minimum), taken from 'Curwin'
|
|
|
|
|
#define View_CPUSUM 0x008000 // '1' - show combined cpu stats (vs. each)
|
2013-04-08 12:30:00 +05:30
|
|
|
|
#define View_CPUNOD 0x400000 // '2' - show numa node cpu stats ('3' also)
|
2011-03-31 16:45:12 +05:30
|
|
|
|
#define View_LOADAV 0x004000 // 'l' - display load avg and uptime summary
|
|
|
|
|
#define View_STATES 0x002000 // 't' - display task/cpu(s) states summary
|
|
|
|
|
#define View_MEMORY 0x001000 // 'm' - display memory summary
|
|
|
|
|
#define View_NOBOLD 0x000008 // 'B' - disable 'bold' attribute globally
|
|
|
|
|
#define View_SCROLL 0x080000 // 'C' - enable coordinates msg w/ scrolling
|
|
|
|
|
// 'Show_' & 'Qsrt_' flags are for task display in a visible window
|
|
|
|
|
#define Show_COLORS 0x000800 // 'z' - show in color (vs. mono)
|
|
|
|
|
#define Show_HIBOLD 0x000400 // 'b' - rows and/or cols bold (vs. reverse)
|
2011-04-14 02:38:14 +05:30
|
|
|
|
#define Show_HICOLS 0x000200 // 'x' - show sort column emphasized
|
2011-03-31 16:45:12 +05:30
|
|
|
|
#define Show_HIROWS 0x000100 // 'y' - show running tasks highlighted
|
|
|
|
|
#define Show_CMDLIN 0x000080 // 'c' - show cmdline vs. name
|
|
|
|
|
#define Show_CTIMES 0x000040 // 'S' - show times as cumulative
|
|
|
|
|
#define Show_IDLEPS 0x000020 // 'i' - show idle processes (all tasks)
|
|
|
|
|
#define Show_TASKON 0x000010 // '-' - tasks showable when Mode_altscr
|
2011-08-30 17:35:45 +05:30
|
|
|
|
#define Show_FOREST 0x000002 // 'V' - show cmd/cmdlines with ascii art
|
2011-03-31 16:45:12 +05:30
|
|
|
|
#define Qsrt_NORMAL 0x000004 // 'R' - reversed column sort (high to low)
|
2012-09-20 11:31:01 +05:30
|
|
|
|
#define Show_JRSTRS 0x040000 // 'j' - right justify "string" data cols
|
|
|
|
|
#define Show_JRNUMS 0x020000 // 'J' - right justify "numeric" data cols
|
2011-03-31 16:45:12 +05:30
|
|
|
|
// these flag(s) have no command as such - they're for internal use
|
2018-06-20 10:30:00 +05:30
|
|
|
|
#define NOPRINT_xxx 0x010000 // build task rows only (not for display)
|
2012-04-11 14:41:12 +05:30
|
|
|
|
#define EQUWINS_xxx 0x000001 // rebalance all wins & tasks (off i,n,u/U)
|
2011-03-31 16:45:12 +05:30
|
|
|
|
|
|
|
|
|
// Default flags if there's no rcfile to provide user customizations
|
2014-06-29 10:30:00 +05:30
|
|
|
|
#ifdef ORIG_TOPDEFS
|
2011-03-31 16:45:12 +05:30
|
|
|
|
#define DEF_WINFLGS ( View_LOADAV | View_STATES | View_CPUSUM | View_MEMORY \
|
2012-09-20 11:31:01 +05:30
|
|
|
|
| Show_HIBOLD | Show_HIROWS | Show_IDLEPS | Show_TASKON | Show_JRNUMS \
|
|
|
|
|
| Qsrt_NORMAL )
|
2014-06-29 10:30:00 +05:30
|
|
|
|
#define DEF_GRAPHS2 0, 0
|
2017-03-13 14:30:00 +05:30
|
|
|
|
#define DEF_SCALES2 SK_Mb, SK_Kb
|
2014-06-29 10:30:00 +05:30
|
|
|
|
#define ALT_WINFLGS DEF_WINFLGS
|
|
|
|
|
#define ALT_GRAPHS2 0, 0
|
|
|
|
|
#else
|
2017-03-13 16:30:00 +05:30
|
|
|
|
#define DEF_WINFLGS ( View_LOADAV | View_STATES | View_MEMORY | Show_CMDLIN \
|
2014-06-29 10:30:00 +05:30
|
|
|
|
| Show_COLORS | Show_FOREST | Show_HIROWS | Show_IDLEPS | Show_JRNUMS | Show_TASKON \
|
|
|
|
|
| Qsrt_NORMAL )
|
|
|
|
|
#define DEF_GRAPHS2 1, 2
|
|
|
|
|
#define DEF_SCALES2 SK_Gb, SK_Mb
|
|
|
|
|
#define ALT_WINFLGS (DEF_WINFLGS | Show_HIBOLD) & ~Show_FOREST
|
|
|
|
|
#define ALT_GRAPHS2 2, 0
|
|
|
|
|
#endif
|
2011-03-31 16:45:12 +05:30
|
|
|
|
|
|
|
|
|
/* These are used to direct wins_reflag */
|
|
|
|
|
enum reflag_enum {
|
|
|
|
|
Flags_TOG, Flags_SET, Flags_OFF
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* These are used to direct win_warn */
|
|
|
|
|
enum warn_enum {
|
|
|
|
|
Warn_ALT, Warn_VIZ
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* This type helps support both a window AND the rcfile */
|
2002-12-05 04:18:30 +05:30
|
|
|
|
typedef struct RCW_t { // the 'window' portion of an rcfile
|
2014-06-27 10:30:00 +05:30
|
|
|
|
int sortindx, // sort field (represented as procflag)
|
|
|
|
|
winflags, // 'view', 'show' and 'sort' mode flags
|
|
|
|
|
maxtasks, // user requested maximum, 0 equals all
|
|
|
|
|
graph_cpus, // 't' - View_STATES supplementary vals
|
|
|
|
|
graph_mems, // 'm' - View_MEMORY supplememtary vals
|
2020-05-29 10:30:00 +05:30
|
|
|
|
double_up, // '4' - show individual cpus 2 abreast
|
|
|
|
|
combine_cpus, // '!' - keep combining additional cpus
|
2014-06-27 10:30:00 +05:30
|
|
|
|
summclr, // a colors 'number' used for summ info
|
|
|
|
|
msgsclr, // " in msgs/pmts
|
|
|
|
|
headclr, // " in cols head
|
|
|
|
|
taskclr; // " in task rows
|
top: provide an unlimited capacity for field additions
With each of those references shown below, the maximum
number of fields was increased. However, with a 'char'
based implementation we're nearing the upper limits of
total displayable fields. We currently use 76 of a max
of 86 fields. With extra effort, 94 might be possible.
But 94 is the absolute upper limit of possible fields!
Moreover, the current implementation yields characters
that were unprintable in the rcfile. This could become
an issue with that 'inspect' feature when/if an rcfile
is edited to add entries (as opposed to using 'echo').
So, with this commit the internals of field management
has been completely reimagined. It is now based on the
integer type, not a character. And whereas that former
design used the high order bit to show the 'on' state,
thus yielding an unprintable character, the new design
uses the low order bit for the state. As such, numbers
will be kept small and an even number will be an 'off'
field whereas an odd number will become an 'on' state.
The bottom line is that this new design will afford an
unlimited number of new fields while keeping an rcfile
completely free of that potential unprintable garbage.
And it is embarrassingly easy to extend the maximum of
supportable fields from the currently implemented 100.
Who knows, maybe a future patch will prove this point.
[ unless a subsequent commit proves otherwise, given ]
[ the dramatic differences in rcfile contents, i had ]
[ to abandon the practice of supporting old rcfiles. ]
Reference(s):
. Nov, 2013 - RCF_PLUS_H introduced
commit af4e6533ba5ee04f414bc8774df31ddef38e8880
. Jul, 2016 - RCF_PLUS_J introduced
commit d5c5051fb395e8bebaadb42add79ca99a16afe85
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-13 11:30:00 +05:30
|
|
|
|
char winname [WINNAMSIZ]; // name for the window, user changeable
|
|
|
|
|
FLG_t fieldscur [PFLAGSSIZ]; // the fields for display & their order
|
2002-12-05 04:18:30 +05:30
|
|
|
|
} RCW_t;
|
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* This represents the complete rcfile */
|
|
|
|
|
typedef struct RCF_t {
|
top: honor the restrictive, crufty old top rcfile
At one time, new top silently defaulted when an rcfile
was found to be incompatible. This is exactly what
the old top did. However, after some discussion it
was decided top should alert the user and thereby
save the system administrator some headaches.
Now, some are upset over the fatal error, proving you
can't please everybody. But in all fairness, given
the difficulty of customizing old top, any reluctance
to delete an old saved rcfile is understandable.
To ease transition to this new top, old style rcfiles
will now be honored and converted to the new format.
And if not disabled at ./configure time via CFLAGS,
a user will be warned when an old style rcfile is
about to be overwritten using the 'W' command.
Lastly, the config validation logic was enhanced to
help ensure both types of rcfile haven't been edited
manually and possibly made unuseable.
Reported-By: sergio <mailbox@sergio.spb.ru>
Bug-Debian: http://bugs.debian.org/651213
Reported-By: martin f krafft <madduck@debian.org>
Bug-Debian: http://bugs.debian.org/651863
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-01 11:29:59 +05:30
|
|
|
|
char id; // rcfile version id
|
2002-12-05 04:18:30 +05:30
|
|
|
|
int mode_altscr; // 'A' - Alt display mode (multi task windows)
|
|
|
|
|
int mode_irixps; // 'I' - Irix vs. Solaris mode (SMP-only)
|
2011-03-31 16:45:12 +05:30
|
|
|
|
float delay_time; // 'd'/'s' - How long to sleep twixt updates
|
2002-12-05 04:18:30 +05:30
|
|
|
|
int win_index; // Curwin, as index
|
2011-03-31 16:45:12 +05:30
|
|
|
|
RCW_t win [GROUPSMAX]; // a 'WIN_t.rc' for each window
|
2012-09-21 11:31:01 +05:30
|
|
|
|
int fixed_widest; // 'X' - wider non-scalable col addition
|
2012-12-14 11:30:00 +05:30
|
|
|
|
int summ_mscale; // 'E' - scaling of summary memory values
|
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-14 11:30:00 +05:30
|
|
|
|
int task_mscale; // 'e' - scaling of process memory values
|
|
|
|
|
int zero_suppress; // '0' - suppress scaled zeros toggle
|
2022-03-03 11:30:00 +05:30
|
|
|
|
int tics_scaled; // ^E - scale TIME and/or TIME+ columns
|
2002-12-05 04:18:30 +05:30
|
|
|
|
} RCF_t;
|
2002-05-30 09:14:46 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* This structure stores configurable information for each window.
|
|
|
|
|
By expending a little effort in its creation and user requested
|
2012-06-30 10:30:55 +05:30
|
|
|
|
maintenance, the only real additional per frame cost of having
|
2011-03-31 16:45:12 +05:30
|
|
|
|
windows is an extra sort -- but that's just on pointers! */
|
|
|
|
|
typedef struct WIN_t {
|
2011-04-15 04:54:29 +05:30
|
|
|
|
FLG_t pflgsall [PFLAGSSIZ], // all 'active/on' fieldscur, as enum
|
|
|
|
|
procflgs [PFLAGSSIZ]; // fieldscur subset, as enum
|
|
|
|
|
RCW_t rc; // stuff that gets saved in the rcfile
|
|
|
|
|
int winnum, // a window's number (array pos + 1)
|
|
|
|
|
winlines, // current task window's rows (volatile)
|
|
|
|
|
maxpflgs, // number of displayed procflgs ("on" in fieldscur)
|
2011-03-31 16:45:12 +05:30
|
|
|
|
totpflgs, // total of displayable procflgs in pflgsall array
|
|
|
|
|
begpflg, // scrolled beginning pos into pflgsall array
|
|
|
|
|
endpflg, // scrolled ending pos into pflgsall array
|
2015-12-01 10:30:00 +05:30
|
|
|
|
begtask, // scrolled beginning pos into total tasks
|
2018-06-20 10:30:00 +05:30
|
|
|
|
begnext, // new scrolled delta for next frame's begtask
|
2012-06-30 10:30:00 +05:30
|
|
|
|
#ifndef SCROLLVAR_NO
|
|
|
|
|
varcolbeg, // scrolled position within variable width col
|
|
|
|
|
#endif
|
2011-04-15 04:54:29 +05:30
|
|
|
|
varcolsz, // max length of variable width column(s)
|
|
|
|
|
usrseluid, // validated uid for 'u/U' user selection
|
|
|
|
|
usrseltyp, // the basis for matching above uid
|
2013-02-13 11:30:00 +05:30
|
|
|
|
usrselflg, // flag denoting include/exclude matches
|
2011-04-15 04:54:29 +05:30
|
|
|
|
hdrcaplen; // column header xtra caps len, if any
|
2011-03-31 16:45:12 +05:30
|
|
|
|
char capclr_sum [CLRBUFSIZ], // terminfo strings built from
|
|
|
|
|
capclr_msg [CLRBUFSIZ], // RCW_t colors (& rebuilt too),
|
|
|
|
|
capclr_pmt [CLRBUFSIZ], // but NO recurring costs !
|
|
|
|
|
capclr_hdr [CLRBUFSIZ], // note: sum, msg and pmt strs
|
2022-01-14 00:43:13 +05:30
|
|
|
|
capclr_rowhigh [SMLBUFSIZ], // are only used when this
|
2011-04-15 04:54:29 +05:30
|
|
|
|
capclr_rownorm [CLRBUFSIZ], // window is the 'Curwin'!
|
|
|
|
|
cap_bold [CAPBUFSIZ], // support for View_NOBOLD toggle
|
|
|
|
|
grpname [GRPNAMSIZ], // window number:name, printable
|
2011-04-14 02:38:14 +05:30
|
|
|
|
#ifdef USE_X_COLHDR
|
2011-04-15 04:54:29 +05:30
|
|
|
|
columnhdr [ROWMINSIZ], // column headings for procflgs
|
2011-04-14 02:38:14 +05:30
|
|
|
|
#else
|
2011-04-15 04:54:29 +05:30
|
|
|
|
columnhdr [SCREENMAX], // column headings for procflgs
|
2011-04-14 02:38:14 +05:30
|
|
|
|
#endif
|
2011-04-15 04:54:29 +05:30
|
|
|
|
*captab [CAPTABMAX]; // captab needed by show_special()
|
2013-03-03 11:30:00 +05:30
|
|
|
|
struct osel_s *osel_1st; // other selection criteria anchor
|
|
|
|
|
int osel_tot; // total of other selection criteria
|
top: highlight all regular search string(s) when found
With the recent inspect search highlight provisions in
place, the lack of highlighting in task based searches
has grown from being only irritating to a real defect.
Thus, this commit introduces parallel functionality to
those searches initiated within a visible task window.
And just as separate inspect searches are possible for
each selection, per window task searches are provided.
However, it should be noted that there are differences
between task based searches and inspect type searches:
* There is no concept of out-of-view data when dealing
. with task rows -- if the data can't bee seen, it has
. not, in fact, been constructed from a proc_t struct.
* While inspect data is output at the character level,
. up to now all task display data was only potentially
. output and it was always based on a complete string.
* With task search highlighting, rows now containing a
. match must be output in pieces and, therefore, can't
. be optimized away like other rows which haven't been
. been altered. This is because top cannot predict the
. the contents of a search string or, how many matches
. might occur in a given row. Short search strings and
. many matches would raise buffer needs geometrically.
(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-08 11:30:00 +05:30
|
|
|
|
char *findstr; // window's current/active search string
|
|
|
|
|
int findlen; // above's strlen, without call overhead
|
2021-07-24 10:30:00 +05:30
|
|
|
|
int focus_pid; // target pid when 'F' toggle is active
|
|
|
|
|
int focus_beg; // ppt index where 'F' toggle has begun
|
|
|
|
|
int focus_end; // ppt index where 'F' toggle has ended
|
2022-01-03 10:30:00 +05:30
|
|
|
|
#ifdef FOCUS_TREE_X
|
2021-07-28 10:30:00 +05:30
|
|
|
|
int focus_lvl; // the indentation level of parent task
|
|
|
|
|
#endif
|
2015-08-19 10:30:00 +05:30
|
|
|
|
struct pids_stack **ppt; // this window's stacks ptr array
|
2011-03-31 16:45:12 +05:30
|
|
|
|
struct WIN_t *next, // next window in window stack
|
|
|
|
|
*prev; // prior window in window stack
|
|
|
|
|
} WIN_t;
|
2002-05-30 09:14:46 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
// Used to test/manipulate the window flags
|
|
|
|
|
#define CHKw(q,f) (int)((q)->rc.winflags & (f))
|
|
|
|
|
#define TOGw(q,f) (q)->rc.winflags ^= (f)
|
|
|
|
|
#define SETw(q,f) (q)->rc.winflags |= (f)
|
|
|
|
|
#define OFFw(q,f) (q)->rc.winflags &= ~(f)
|
|
|
|
|
#define ALTCHKw (Rc.mode_altscr ? 1 : win_warn(Warn_ALT))
|
|
|
|
|
#define VIZISw(q) (!Rc.mode_altscr || CHKw(q,Show_TASKON))
|
|
|
|
|
#define VIZCHKw(q) (VIZISw(q)) ? 1 : win_warn(Warn_VIZ)
|
|
|
|
|
#define VIZTOGw(q,f) (VIZISw(q)) ? TOGw(q,(f)) : win_warn(Warn_VIZ)
|
2002-02-02 04:17:29 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
// Used to test/manipulte fieldscur values
|
2022-03-21 10:30:00 +05:30
|
|
|
|
#define FLDon 0x01
|
|
|
|
|
#define FLDoff 0x00
|
top: provide an unlimited capacity for field additions
With each of those references shown below, the maximum
number of fields was increased. However, with a 'char'
based implementation we're nearing the upper limits of
total displayable fields. We currently use 76 of a max
of 86 fields. With extra effort, 94 might be possible.
But 94 is the absolute upper limit of possible fields!
Moreover, the current implementation yields characters
that were unprintable in the rcfile. This could become
an issue with that 'inspect' feature when/if an rcfile
is edited to add entries (as opposed to using 'echo').
So, with this commit the internals of field management
has been completely reimagined. It is now based on the
integer type, not a character. And whereas that former
design used the high order bit to show the 'on' state,
thus yielding an unprintable character, the new design
uses the low order bit for the state. As such, numbers
will be kept small and an even number will be an 'off'
field whereas an odd number will become an 'on' state.
The bottom line is that this new design will afford an
unlimited number of new fields while keeping an rcfile
completely free of that potential unprintable garbage.
And it is embarrassingly easy to extend the maximum of
supportable fields from the currently implemented 100.
Who knows, maybe a future patch will prove this point.
[ unless a subsequent commit proves otherwise, given ]
[ the dramatic differences in rcfile contents, i had ]
[ to abandon the practice of supporting old rcfiles. ]
Reference(s):
. Nov, 2013 - RCF_PLUS_H introduced
commit af4e6533ba5ee04f414bc8774df31ddef38e8880
. Jul, 2016 - RCF_PLUS_J introduced
commit d5c5051fb395e8bebaadb42add79ca99a16afe85
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-13 11:30:00 +05:30
|
|
|
|
#define FLDget(q,i) ( (((q)->rc.fieldscur[i]) >> 1) - FLD_OFFSET )
|
2022-03-21 10:30:00 +05:30
|
|
|
|
#define FLDtog(q,i) ( (q)->rc.fieldscur[i] ^= FLDon )
|
|
|
|
|
#define FLDviz(q,i) ( (q)->rc.fieldscur[i] & FLDon )
|
top: provide an unlimited capacity for field additions
With each of those references shown below, the maximum
number of fields was increased. However, with a 'char'
based implementation we're nearing the upper limits of
total displayable fields. We currently use 76 of a max
of 86 fields. With extra effort, 94 might be possible.
But 94 is the absolute upper limit of possible fields!
Moreover, the current implementation yields characters
that were unprintable in the rcfile. This could become
an issue with that 'inspect' feature when/if an rcfile
is edited to add entries (as opposed to using 'echo').
So, with this commit the internals of field management
has been completely reimagined. It is now based on the
integer type, not a character. And whereas that former
design used the high order bit to show the 'on' state,
thus yielding an unprintable character, the new design
uses the low order bit for the state. As such, numbers
will be kept small and an even number will be an 'off'
field whereas an odd number will become an 'on' state.
The bottom line is that this new design will afford an
unlimited number of new fields while keeping an rcfile
completely free of that potential unprintable garbage.
And it is embarrassingly easy to extend the maximum of
supportable fields from the currently implemented 100.
Who knows, maybe a future patch will prove this point.
[ unless a subsequent commit proves otherwise, given ]
[ the dramatic differences in rcfile contents, i had ]
[ to abandon the practice of supporting old rcfiles. ]
Reference(s):
. Nov, 2013 - RCF_PLUS_H introduced
commit af4e6533ba5ee04f414bc8774df31ddef38e8880
. Jul, 2016 - RCF_PLUS_J introduced
commit d5c5051fb395e8bebaadb42add79ca99a16afe85
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-13 11:30:00 +05:30
|
|
|
|
#define ENUviz(w,E) ( NULL != msch((w)->procflgs, E, w->maxpflgs) )
|
|
|
|
|
#define ENUpos(w,E) ( (int)(msch((w)->pflgsall, E, (w)->totpflgs) - (w)->pflgsall) )
|
2022-03-21 10:30:00 +05:30
|
|
|
|
#define ENUcvt(E,x) ( (int)((E + FLD_OFFSET) << 1) | x )
|
2011-08-30 17:35:45 +05:30
|
|
|
|
|
2012-06-30 10:30:00 +05:30
|
|
|
|
// Support for variable width columns (and potentially scrolling too)
|
2012-09-19 11:31:01 +05:30
|
|
|
|
#define VARcol(E) (-1 == Fieldstab[E].width)
|
2012-06-30 10:30:00 +05:30
|
|
|
|
#ifndef SCROLLVAR_NO
|
|
|
|
|
#ifdef USE_X_COLHDR
|
|
|
|
|
#define VARright(w) (1 == w->maxpflgs && VARcol(w->procflgs[0]))
|
|
|
|
|
#else
|
|
|
|
|
#define VARright(w) ((1 == w->maxpflgs && VARcol(w->procflgs[0])) || \
|
2014-02-25 11:30:00 +05:30
|
|
|
|
(3 == w->maxpflgs && EU_XON == w->procflgs[0] && VARcol(w->procflgs[1])))
|
2012-06-30 10:30:00 +05:30
|
|
|
|
#endif
|
|
|
|
|
#define VARleft(w) (w->varcolbeg && VARright(w))
|
2020-12-30 11:30:00 +05:30
|
|
|
|
#ifdef SCROLLV_BY_1
|
|
|
|
|
#define SCROLLAMT 1
|
|
|
|
|
#else
|
2012-06-30 10:30:00 +05:30
|
|
|
|
#define SCROLLAMT 8
|
2020-12-30 11:30:00 +05:30
|
|
|
|
#endif
|
2012-06-30 10:30:00 +05:30
|
|
|
|
#endif
|
2002-05-30 09:14:46 +05:30
|
|
|
|
|
2018-06-21 10:30:00 +05:30
|
|
|
|
// Support for a proper (visible) row #1 whenever Curwin changes
|
2018-09-18 10:30:00 +05:30
|
|
|
|
// ( or a key which might affect vertical scrolling was struck )
|
2021-06-15 10:30:00 +05:30
|
|
|
|
#define mkVIZyes Curwin->begnext != 0
|
|
|
|
|
#define mkVIZrow1 { Curwin->begnext = +1; Curwin->begtask -= 1; }
|
|
|
|
|
#define mkVIZrowX(n) { Curwin->begnext = (n); }
|
2018-06-21 10:30:00 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* Special Section: end ------------------------------------------ */
|
|
|
|
|
/* /////////////////////////////////////////////////////////////// */
|
2002-06-19 05:15:30 +05:30
|
|
|
|
|
2002-05-30 09:14:46 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/*###### Some Miscellaneous Macro definitions ##########################*/
|
2002-05-30 09:14:46 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* Yield table size as 'int' */
|
|
|
|
|
#define MAXTBL(t) (int)(sizeof(t) / sizeof(t[0]))
|
2002-05-30 09:14:46 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* A null-terminating strncpy, assuming strlcpy is not available.
|
|
|
|
|
( and assuming callers don't need the string length returned ) */
|
2022-02-14 11:30:00 +05:30
|
|
|
|
#define STRLCPY(dst,src) { memccpy(dst, src, '\0', sizeof(dst)); dst[sizeof(dst) - 1] = '\0'; }
|
2002-06-19 05:15:30 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* Used to clear all or part of our Pseudo_screen */
|
2011-04-14 02:38:14 +05:30
|
|
|
|
#define PSU_CLREOS(y) memset(&Pseudo_screen[ROWMAXSIZ*y], '\0', Pseudo_size-(ROWMAXSIZ*y))
|
2002-12-05 04:18:30 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/*
|
top: highlight all regular search string(s) when found
With the recent inspect search highlight provisions in
place, the lack of highlighting in task based searches
has grown from being only irritating to a real defect.
Thus, this commit introduces parallel functionality to
those searches initiated within a visible task window.
And just as separate inspect searches are possible for
each selection, per window task searches are provided.
However, it should be noted that there are differences
between task based searches and inspect type searches:
* There is no concept of out-of-view data when dealing
. with task rows -- if the data can't bee seen, it has
. not, in fact, been constructed from a proc_t struct.
* While inspect data is output at the character level,
. up to now all task display data was only potentially
. output and it was always based on a complete string.
* With task search highlighting, rows now containing a
. match must be output in pieces and, therefore, can't
. be optimized away like other rows which haven't been
. been altered. This is because top cannot predict the
. the contents of a search string or, how many matches
. might occur in a given row. Short search strings and
. many matches would raise buffer needs geometrically.
(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-08 11:30:00 +05:30
|
|
|
|
* The following three macros are used to 'inline' those portions of the
|
|
|
|
|
* display process involved in formatting, while protecting against any
|
2011-03-31 16:45:12 +05:30
|
|
|
|
* potential embedded 'millesecond delay' escape sequences.
|
|
|
|
|
*/
|
|
|
|
|
/** PUTT - Put to Tty (used in many places)
|
|
|
|
|
. for temporary, possibly interactive, 'replacement' output
|
|
|
|
|
. may contain ANY valid terminfo escape sequences
|
|
|
|
|
. need NOT represent an entire screen row */
|
|
|
|
|
#define PUTT(fmt,arg...) do { \
|
2011-04-14 02:38:14 +05:30
|
|
|
|
char _str[ROWMAXSIZ]; \
|
2011-03-31 16:45:12 +05:30
|
|
|
|
snprintf(_str, sizeof(_str), fmt, ## arg); \
|
|
|
|
|
putp(_str); \
|
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
/** PUFF - Put for Frame (used in only 3 places)
|
|
|
|
|
. for more permanent frame-oriented 'update' output
|
|
|
|
|
. may NOT contain cursor motion terminfo escapes
|
|
|
|
|
. assumed to represent a complete screen ROW
|
|
|
|
|
. subject to optimization, thus MAY be discarded */
|
|
|
|
|
#define PUFF(fmt,arg...) do { \
|
2018-06-02 10:30:00 +05:30
|
|
|
|
char _str[ROWMAXSIZ]; \
|
1970-01-01 05:30:00 +05:30
|
|
|
|
const int _len = snprintf(_str, sizeof(_str), fmt, ## arg); \
|
2011-06-01 17:28:06 +05:30
|
|
|
|
if (Batch) { \
|
2018-06-02 10:30:00 +05:30
|
|
|
|
char *_eol = _str + (_len < 0 ? 0 : (size_t)_len >= sizeof(_str) ? sizeof(_str)-1 : (size_t)_len); \
|
2022-01-08 11:30:00 +05:30
|
|
|
|
while (_eol > _str && _eol[-1] == ' ') _eol--; \
|
|
|
|
|
*_eol = '\0'; putp(_str); } \
|
1970-01-01 05:30:00 +05:30
|
|
|
|
else if (Pseudo_row >= 0 && Pseudo_row < Screen_rows) { \
|
2018-06-02 10:30:00 +05:30
|
|
|
|
char *_ptr = &Pseudo_screen[Pseudo_row++ * ROWMAXSIZ]; \
|
2011-03-31 16:45:12 +05:30
|
|
|
|
if (!strcmp(_ptr, _str)) putp("\n"); \
|
|
|
|
|
else { \
|
|
|
|
|
strcpy(_ptr, _str); \
|
|
|
|
|
putp(_ptr); } } \
|
|
|
|
|
} while (0)
|
|
|
|
|
|
top: highlight all regular search string(s) when found
With the recent inspect search highlight provisions in
place, the lack of highlighting in task based searches
has grown from being only irritating to a real defect.
Thus, this commit introduces parallel functionality to
those searches initiated within a visible task window.
And just as separate inspect searches are possible for
each selection, per window task searches are provided.
However, it should be noted that there are differences
between task based searches and inspect type searches:
* There is no concept of out-of-view data when dealing
. with task rows -- if the data can't bee seen, it has
. not, in fact, been constructed from a proc_t struct.
* While inspect data is output at the character level,
. up to now all task display data was only potentially
. output and it was always based on a complete string.
* With task search highlighting, rows now containing a
. match must be output in pieces and, therefore, can't
. be optimized away like other rows which haven't been
. been altered. This is because top cannot predict the
. the contents of a search string or, how many matches
. might occur in a given row. Short search strings and
. many matches would raise buffer needs geometrically.
(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-08 11:30:00 +05:30
|
|
|
|
/** POOF - Pulled Out of Frame (used in only 1 place)
|
|
|
|
|
. for output that is/was sent directly to the terminal
|
|
|
|
|
but would otherwise have been counted as a Pseudo_row */
|
|
|
|
|
#define POOF(str,cap) do { \
|
|
|
|
|
putp(str); putp(cap); \
|
2012-12-30 11:30:00 +05:30
|
|
|
|
Pseudo_screen[Pseudo_row * ROWMAXSIZ] = '\0'; \
|
top: highlight all regular search string(s) when found
With the recent inspect search highlight provisions in
place, the lack of highlighting in task based searches
has grown from being only irritating to a real defect.
Thus, this commit introduces parallel functionality to
those searches initiated within a visible task window.
And just as separate inspect searches are possible for
each selection, per window task searches are provided.
However, it should be noted that there are differences
between task based searches and inspect type searches:
* There is no concept of out-of-view data when dealing
. with task rows -- if the data can't bee seen, it has
. not, in fact, been constructed from a proc_t struct.
* While inspect data is output at the character level,
. up to now all task display data was only potentially
. output and it was always based on a complete string.
* With task search highlighting, rows now containing a
. match must be output in pieces and, therefore, can't
. be optimized away like other rows which haven't been
. been altered. This is because top cannot predict the
. the contents of a search string or, how many matches
. might occur in a given row. Short search strings and
. many matches would raise buffer needs geometrically.
(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-08 11:30:00 +05:30
|
|
|
|
if (Pseudo_row + 1 < Screen_rows) ++Pseudo_row; \
|
|
|
|
|
} while (0)
|
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* Orderly end, with any sort of message - see fmtmk */
|
|
|
|
|
#define debug_END(s) { \
|
2013-01-11 11:30:00 +05:30
|
|
|
|
void error_exit (const char *); \
|
2011-03-31 16:45:12 +05:30
|
|
|
|
fputs(Cap_clr_scr, stdout); \
|
|
|
|
|
error_exit(s); \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* A poor man's breakpoint, if he's too lazy to learn gdb */
|
|
|
|
|
#define its_YOUR_fault { *((char *)0) = '!'; }
|
|
|
|
|
|
|
|
|
|
|
2011-10-12 00:32:59 +05:30
|
|
|
|
/*###### Some Display Support *Data* ###################################*/
|
|
|
|
|
/* ( see module top_nls.c for the nls translatable data ) */
|
2011-03-31 16:45:12 +05:30
|
|
|
|
|
|
|
|
|
/* Configuration files support */
|
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-17 11:30:00 +05:30
|
|
|
|
#define SYS_RCRESTRICT "/etc/toprc"
|
|
|
|
|
#define SYS_RCDEFAULTS "/etc/topdefaultrc"
|
2011-03-31 16:45:12 +05:30
|
|
|
|
#define RCF_EYECATCHER "Config File (Linux processes with windows)\n"
|
2022-03-13 11:30:00 +05:30
|
|
|
|
#define RCF_PLUS_H "\\]^_`abcdefghij"
|
|
|
|
|
#define RCF_PLUS_J "klmnopqrstuvwxyz"
|
|
|
|
|
// this next guy must never, ever change
|
2022-03-17 10:30:00 +05:30
|
|
|
|
// ( transitioned from 'char' to 'int' )
|
2022-03-13 11:30:00 +05:30
|
|
|
|
#define RCF_XFORMED_ID 'k'
|
|
|
|
|
// this next guy is incremented when columns change
|
|
|
|
|
// ( to prevent older top versions from accessing )
|
2021-06-20 10:30:00 +05:30
|
|
|
|
#define RCF_VERSION_ID 'k'
|
2011-03-31 16:45:12 +05:30
|
|
|
|
|
top: provide an unlimited capacity for field additions
With each of those references shown below, the maximum
number of fields was increased. However, with a 'char'
based implementation we're nearing the upper limits of
total displayable fields. We currently use 76 of a max
of 86 fields. With extra effort, 94 might be possible.
But 94 is the absolute upper limit of possible fields!
Moreover, the current implementation yields characters
that were unprintable in the rcfile. This could become
an issue with that 'inspect' feature when/if an rcfile
is edited to add entries (as opposed to using 'echo').
So, with this commit the internals of field management
has been completely reimagined. It is now based on the
integer type, not a character. And whereas that former
design used the high order bit to show the 'on' state,
thus yielding an unprintable character, the new design
uses the low order bit for the state. As such, numbers
will be kept small and an even number will be an 'off'
field whereas an odd number will become an 'on' state.
The bottom line is that this new design will afford an
unlimited number of new fields while keeping an rcfile
completely free of that potential unprintable garbage.
And it is embarrassingly easy to extend the maximum of
supportable fields from the currently implemented 100.
Who knows, maybe a future patch will prove this point.
[ unless a subsequent commit proves otherwise, given ]
[ the dramatic differences in rcfile contents, i had ]
[ to abandon the practice of supporting old rcfiles. ]
Reference(s):
. Nov, 2013 - RCF_PLUS_H introduced
commit af4e6533ba5ee04f414bc8774df31ddef38e8880
. Jul, 2016 - RCF_PLUS_J introduced
commit d5c5051fb395e8bebaadb42add79ca99a16afe85
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-13 11:30:00 +05:30
|
|
|
|
#define FLD_OFFSET ( (int)'%' )
|
|
|
|
|
#define FLD_ROWMAX 20
|
|
|
|
|
|
|
|
|
|
/* The default fields displayed and their order,
|
|
|
|
|
if nothing is specified by the loser, oops user. */
|
2022-03-13 11:30:00 +05:30
|
|
|
|
#ifdef ORIG_TOPDEFS
|
|
|
|
|
#define DEF_FORMER "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>&')*+,-./012568<>?ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H RCF_PLUS_J
|
|
|
|
|
#else
|
|
|
|
|
#define DEF_FORMER "<22>&K<><4B><EFBFBD><EFBFBD><EFBFBD>@<40><><EFBFBD>56<35>F<EFBFBD>')*+,-./0128<>?ABCGHIJLMNOPQRSTUVWXYZ[" RCF_PLUS_H RCF_PLUS_J
|
|
|
|
|
#endif
|
|
|
|
|
/* Pre-configured windows/field groups */
|
|
|
|
|
#define JOB_FORMER "<22><><EFBFBD><EFBFBD><EFBFBD>(<28><>Ļ<EFBFBD>@<<3C><>)*+,-./012568>?ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H RCF_PLUS_J
|
|
|
|
|
#define MEM_FORMER "<22><><EFBFBD><<3C><><EFBFBD><EFBFBD><EFBFBD>MBN<42>D34<33><34>&'()*+,-./0125689FGHIJKLOPQRSTUVWXYZ[" RCF_PLUS_H RCF_PLUS_J
|
|
|
|
|
#define USR_FORMER "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)+,-./1234568;<=>?@ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H RCF_PLUS_J
|
|
|
|
|
// old top fields ( 'a'-'z' ) in positions 0-25
|
|
|
|
|
// other suse old top fields ( '{|' ) in positions 26-27
|
|
|
|
|
#define CVT_FORMER "%&*'(-0346789:;<=>?@ACDEFGML)+,./125BHIJKNOPQRSTUVWXYZ[" RCF_PLUS_H RCF_PLUS_J
|
2022-03-14 10:30:00 +05:30
|
|
|
|
#define CVT_FLDMAX 28
|
2022-03-13 11:30:00 +05:30
|
|
|
|
|
|
|
|
|
#ifdef ORIG_TOPDEFS
|
|
|
|
|
#define DEF_FIELDS { \
|
top: provide an unlimited capacity for field additions
With each of those references shown below, the maximum
number of fields was increased. However, with a 'char'
based implementation we're nearing the upper limits of
total displayable fields. We currently use 76 of a max
of 86 fields. With extra effort, 94 might be possible.
But 94 is the absolute upper limit of possible fields!
Moreover, the current implementation yields characters
that were unprintable in the rcfile. This could become
an issue with that 'inspect' feature when/if an rcfile
is edited to add entries (as opposed to using 'echo').
So, with this commit the internals of field management
has been completely reimagined. It is now based on the
integer type, not a character. And whereas that former
design used the high order bit to show the 'on' state,
thus yielding an unprintable character, the new design
uses the low order bit for the state. As such, numbers
will be kept small and an even number will be an 'off'
field whereas an odd number will become an 'on' state.
The bottom line is that this new design will afford an
unlimited number of new fields while keeping an rcfile
completely free of that potential unprintable garbage.
And it is embarrassingly easy to extend the maximum of
supportable fields from the currently implemented 100.
Who knows, maybe a future patch will prove this point.
[ unless a subsequent commit proves otherwise, given ]
[ the dramatic differences in rcfile contents, i had ]
[ to abandon the practice of supporting old rcfiles. ]
Reference(s):
. Nov, 2013 - RCF_PLUS_H introduced
commit af4e6533ba5ee04f414bc8774df31ddef38e8880
. Jul, 2016 - RCF_PLUS_J introduced
commit d5c5051fb395e8bebaadb42add79ca99a16afe85
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-13 11:30:00 +05:30
|
|
|
|
75, 81, 103, 105, 119, 123, 129, 137, 111, 117, 115, 139, 76, 78, 82, 84, 86, 88, 90, 92, \
|
|
|
|
|
94, 96, 98, 100, 106, 108, 112, 120, 124, 126, 130, 132, 134, 140, 142, 144, 146, 148, 150, 152, \
|
|
|
|
|
154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, \
|
|
|
|
|
194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, \
|
2022-03-13 11:30:00 +05:30
|
|
|
|
234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272 }
|
2014-06-29 10:30:00 +05:30
|
|
|
|
#else
|
top: provide an unlimited capacity for field additions
With each of those references shown below, the maximum
number of fields was increased. However, with a 'char'
based implementation we're nearing the upper limits of
total displayable fields. We currently use 76 of a max
of 86 fields. With extra effort, 94 might be possible.
But 94 is the absolute upper limit of possible fields!
Moreover, the current implementation yields characters
that were unprintable in the rcfile. This could become
an issue with that 'inspect' feature when/if an rcfile
is edited to add entries (as opposed to using 'echo').
So, with this commit the internals of field management
has been completely reimagined. It is now based on the
integer type, not a character. And whereas that former
design used the high order bit to show the 'on' state,
thus yielding an unprintable character, the new design
uses the low order bit for the state. As such, numbers
will be kept small and an even number will be an 'off'
field whereas an odd number will become an 'on' state.
The bottom line is that this new design will afford an
unlimited number of new fields while keeping an rcfile
completely free of that potential unprintable garbage.
And it is embarrassingly easy to extend the maximum of
supportable fields from the currently implemented 100.
Who knows, maybe a future patch will prove this point.
[ unless a subsequent commit proves otherwise, given ]
[ the dramatic differences in rcfile contents, i had ]
[ to abandon the practice of supporting old rcfiles. ]
Reference(s):
. Nov, 2013 - RCF_PLUS_H introduced
commit af4e6533ba5ee04f414bc8774df31ddef38e8880
. Jul, 2016 - RCF_PLUS_J introduced
commit d5c5051fb395e8bebaadb42add79ca99a16afe85
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-13 11:30:00 +05:30
|
|
|
|
#define DEF_FIELDS { \
|
|
|
|
|
75, 76, 150, 81, 103, 105, 119, 123, 128, 111, 117, 115, 106, 108, 137, 140, 139, 78, 82, 84, \
|
|
|
|
|
86, 88, 90, 92, 94, 96, 98, 100, 112, 120, 124, 126, 130, 132, 134, 142, 144, 146, 148, 152, \
|
|
|
|
|
154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, \
|
|
|
|
|
194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, \
|
2022-03-13 11:30:00 +05:30
|
|
|
|
234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272 }
|
2014-06-29 10:30:00 +05:30
|
|
|
|
#endif
|
top: provide an unlimited capacity for field additions
With each of those references shown below, the maximum
number of fields was increased. However, with a 'char'
based implementation we're nearing the upper limits of
total displayable fields. We currently use 76 of a max
of 86 fields. With extra effort, 94 might be possible.
But 94 is the absolute upper limit of possible fields!
Moreover, the current implementation yields characters
that were unprintable in the rcfile. This could become
an issue with that 'inspect' feature when/if an rcfile
is edited to add entries (as opposed to using 'echo').
So, with this commit the internals of field management
has been completely reimagined. It is now based on the
integer type, not a character. And whereas that former
design used the high order bit to show the 'on' state,
thus yielding an unprintable character, the new design
uses the low order bit for the state. As such, numbers
will be kept small and an even number will be an 'off'
field whereas an odd number will become an 'on' state.
The bottom line is that this new design will afford an
unlimited number of new fields while keeping an rcfile
completely free of that potential unprintable garbage.
And it is embarrassingly easy to extend the maximum of
supportable fields from the currently implemented 100.
Who knows, maybe a future patch will prove this point.
[ unless a subsequent commit proves otherwise, given ]
[ the dramatic differences in rcfile contents, i had ]
[ to abandon the practice of supporting old rcfiles. ]
Reference(s):
. Nov, 2013 - RCF_PLUS_H introduced
commit af4e6533ba5ee04f414bc8774df31ddef38e8880
. Jul, 2016 - RCF_PLUS_J introduced
commit d5c5051fb395e8bebaadb42add79ca99a16afe85
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-13 11:30:00 +05:30
|
|
|
|
#define JOB_FIELDS { \
|
|
|
|
|
75, 77, 115, 111, 117, 80, 103, 105, 137, 119, 123, 128, 120, 79, 139, 82, 84, 86, 88, 90, \
|
|
|
|
|
92, 94, 96, 98, 100, 106, 108, 112, 124, 126, 130, 132, 134, 140, 142, 144, 146, 148, 150, 152, \
|
|
|
|
|
154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, \
|
|
|
|
|
194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, \
|
2022-03-13 11:30:00 +05:30
|
|
|
|
234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272 }
|
top: provide an unlimited capacity for field additions
With each of those references shown below, the maximum
number of fields was increased. However, with a 'char'
based implementation we're nearing the upper limits of
total displayable fields. We currently use 76 of a max
of 86 fields. With extra effort, 94 might be possible.
But 94 is the absolute upper limit of possible fields!
Moreover, the current implementation yields characters
that were unprintable in the rcfile. This could become
an issue with that 'inspect' feature when/if an rcfile
is edited to add entries (as opposed to using 'echo').
So, with this commit the internals of field management
has been completely reimagined. It is now based on the
integer type, not a character. And whereas that former
design used the high order bit to show the 'on' state,
thus yielding an unprintable character, the new design
uses the low order bit for the state. As such, numbers
will be kept small and an even number will be an 'off'
field whereas an odd number will become an 'on' state.
The bottom line is that this new design will afford an
unlimited number of new fields while keeping an rcfile
completely free of that potential unprintable garbage.
And it is embarrassingly easy to extend the maximum of
supportable fields from the currently implemented 100.
Who knows, maybe a future patch will prove this point.
[ unless a subsequent commit proves otherwise, given ]
[ the dramatic differences in rcfile contents, i had ]
[ to abandon the practice of supporting old rcfiles. ]
Reference(s):
. Nov, 2013 - RCF_PLUS_H introduced
commit af4e6533ba5ee04f414bc8774df31ddef38e8880
. Jul, 2016 - RCF_PLUS_J introduced
commit d5c5051fb395e8bebaadb42add79ca99a16afe85
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-13 11:30:00 +05:30
|
|
|
|
#define MEM_FIELDS { \
|
|
|
|
|
75, 117, 119, 120, 123, 125, 127, 129, 131, 154, 132, 156, 135, 136, 102, 104, 111, 139, 76, 78, \
|
|
|
|
|
80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 106, 108, 112, 114, 140, 142, 144, 146, 148, \
|
|
|
|
|
150, 152, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, \
|
|
|
|
|
194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, \
|
2022-03-13 11:30:00 +05:30
|
|
|
|
234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272 }
|
top: provide an unlimited capacity for field additions
With each of those references shown below, the maximum
number of fields was increased. However, with a 'char'
based implementation we're nearing the upper limits of
total displayable fields. We currently use 76 of a max
of 86 fields. With extra effort, 94 might be possible.
But 94 is the absolute upper limit of possible fields!
Moreover, the current implementation yields characters
that were unprintable in the rcfile. This could become
an issue with that 'inspect' feature when/if an rcfile
is edited to add entries (as opposed to using 'echo').
So, with this commit the internals of field management
has been completely reimagined. It is now based on the
integer type, not a character. And whereas that former
design used the high order bit to show the 'on' state,
thus yielding an unprintable character, the new design
uses the low order bit for the state. As such, numbers
will be kept small and an even number will be an 'off'
field whereas an odd number will become an 'on' state.
The bottom line is that this new design will afford an
unlimited number of new fields while keeping an rcfile
completely free of that potential unprintable garbage.
And it is embarrassingly easy to extend the maximum of
supportable fields from the currently implemented 100.
Who knows, maybe a future patch will prove this point.
[ unless a subsequent commit proves otherwise, given ]
[ the dramatic differences in rcfile contents, i had ]
[ to abandon the practice of supporting old rcfiles. ]
Reference(s):
. Nov, 2013 - RCF_PLUS_H introduced
commit af4e6533ba5ee04f414bc8774df31ddef38e8880
. Jul, 2016 - RCF_PLUS_J introduced
commit d5c5051fb395e8bebaadb42add79ca99a16afe85
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-13 11:30:00 +05:30
|
|
|
|
#define USR_FIELDS { \
|
|
|
|
|
75, 77, 79, 81, 85, 97, 115, 111, 117, 137, 139, 82, 86, 88, 90, 92, 94, 98, 100, 102, \
|
|
|
|
|
104, 106, 108, 112, 118, 120, 122, 124, 126, 128, 130, 132, 134, 140, 142, 144, 146, 148, 150, 152, \
|
|
|
|
|
154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, \
|
|
|
|
|
194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, \
|
2022-03-13 11:30:00 +05:30
|
|
|
|
234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272 }
|
2011-03-31 16:45:12 +05:30
|
|
|
|
|
|
|
|
|
/* The default values for the local config file */
|
2002-12-05 04:18:30 +05:30
|
|
|
|
#define DEF_RCFILE { \
|
top: honor the restrictive, crufty old top rcfile
At one time, new top silently defaulted when an rcfile
was found to be incompatible. This is exactly what
the old top did. However, after some discussion it
was decided top should alert the user and thereby
save the system administrator some headaches.
Now, some are upset over the fatal error, proving you
can't please everybody. But in all fairness, given
the difficulty of customizing old top, any reluctance
to delete an old saved rcfile is understandable.
To ease transition to this new top, old style rcfiles
will now be honored and converted to the new format.
And if not disabled at ./configure time via CFLAGS,
a user will be warned when an old style rcfile is
about to be overwritten using the 'W' command.
Lastly, the config validation logic was enhanced to
help ensure both types of rcfile haven't been edited
manually and possibly made unuseable.
Reported-By: sergio <mailbox@sergio.spb.ru>
Bug-Debian: http://bugs.debian.org/651213
Reported-By: martin f krafft <madduck@debian.org>
Bug-Debian: http://bugs.debian.org/651863
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-03-01 11:29:59 +05:30
|
|
|
|
RCF_VERSION_ID, 0, 1, DEF_DELAY, 0, { \
|
2020-05-29 10:30:00 +05:30
|
|
|
|
{ EU_CPU, DEF_WINFLGS, 0, DEF_GRAPHS2, 1, 0, \
|
2002-12-05 04:18:30 +05:30
|
|
|
|
COLOR_RED, COLOR_RED, COLOR_YELLOW, COLOR_RED, \
|
|
|
|
|
"Def", DEF_FIELDS }, \
|
2020-05-29 10:30:00 +05:30
|
|
|
|
{ EU_PID, ALT_WINFLGS, 0, ALT_GRAPHS2, 0, 0, \
|
2002-12-05 04:18:30 +05:30
|
|
|
|
COLOR_CYAN, COLOR_CYAN, COLOR_WHITE, COLOR_CYAN, \
|
|
|
|
|
"Job", JOB_FIELDS }, \
|
2020-05-29 10:30:00 +05:30
|
|
|
|
{ EU_MEM, ALT_WINFLGS, 0, ALT_GRAPHS2, 0, 0, \
|
2002-12-05 04:18:30 +05:30
|
|
|
|
COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLUE, COLOR_MAGENTA, \
|
|
|
|
|
"Mem", MEM_FIELDS }, \
|
2020-05-29 10:30:00 +05:30
|
|
|
|
{ EU_UEN, ALT_WINFLGS, 0, ALT_GRAPHS2, 0, 0, \
|
2002-12-05 04:18:30 +05:30
|
|
|
|
COLOR_YELLOW, COLOR_YELLOW, COLOR_GREEN, COLOR_YELLOW, \
|
|
|
|
|
"Usr", USR_FIELDS } \
|
2022-03-03 11:30:00 +05:30
|
|
|
|
}, 0, DEF_SCALES2, 0, 0 }
|
2002-12-05 04:18:30 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/* Summary Lines specially formatted string(s) --
|
|
|
|
|
see 'show_special' for syntax details + other cautions. */
|
2002-06-19 05:15:30 +05:30
|
|
|
|
#define LOADAV_line "%s -%s\n"
|
2011-10-28 21:00:40 +05:30
|
|
|
|
#define LOADAV_line_alt "%s~6 -%s\n"
|
2002-06-19 05:15:30 +05:30
|
|
|
|
|
2002-11-29 21:31:04 +05:30
|
|
|
|
/*###### For Piece of mind #############################################*/
|
2002-11-29 04:39:48 +05:30
|
|
|
|
|
|
|
|
|
/* just sanity check(s)... */
|
2013-02-22 11:30:00 +05:30
|
|
|
|
#if defined(RECALL_FIXED) && defined(TERMIOS_ONLY)
|
|
|
|
|
# error 'RECALL_FIXED' conflicts with 'TERMIOS_ONLY'
|
|
|
|
|
#endif
|
2011-05-26 15:03:32 +05:30
|
|
|
|
#if (LRGBUFSIZ < SCREENMAX)
|
|
|
|
|
# error 'LRGBUFSIZ' must NOT be less than 'SCREENMAX'
|
|
|
|
|
#endif
|
2013-02-15 11:30:00 +05:30
|
|
|
|
#if defined(TERMIOS_ONLY)
|
|
|
|
|
# warning 'TERMIOS_ONLY' disables input recall and makes man doc incorrect
|
|
|
|
|
#endif
|
2014-07-17 23:43:13 +05:30
|
|
|
|
#if defined(MEMGRAPH_OLD)
|
|
|
|
|
# warning 'MEMGRAPH_OLD' will make the man document Section 2c. misleading
|
|
|
|
|
#endif
|
top: refactor 'scale_tics' function for better scaling
This patch refactors the 'scale_tics' function to more
closely parallel uptime shown on the first line of the
summary area. The old logic has been preserved through
the header file's new #define SCALE_FORMER provision.
However, the former logic was actually a big disaster.
These are some potential problems with that old logic:
1. With respect to our time fields top no longer deals
solely with cpu time. So, the old limits of '68 weeks'
could possibly be insufficient to reflect those times.
2. Given the widths of top's new time fields, the code
never got beyond scaling to hours. For example, with a
ridiculously large span of 19 years, the scaled result
would then be shown as '167832h'. We never reached the
days ('6993d') or even the weeks ('999w') equivalents.
3. Similarly, with that 'TIME+' field and a large tics
value, results would then appear as 'MMMMMM:SS' rather
than the more meaningful 'HH:MM:SS' or days and hours.
So henceforth we will adopt these scaling conventions:
MMM:SS.hh ... minutes:seconds.hundredths
MMM:SS ...... minutes:seconds
HH,MM ....... hours,minutes
D+H ......... days+hours (with 'd' & 'h' suffixes)
D ........... days (with 'd' suffix)
W+D ......... weeks+days (with 'w' & 'd' suffixes)
W ........... weeks (with 'w' suffix)
Note that, unlike our former scaling logic, that 'MMM'
portion won't be allowed to grow unconditionally. It's
limited (arbitrarily?) to 360 total minutes (6 hours).
Additionally, the 'HH' guy will be limited to 96 hours
(4 days) while that 'D' limit was set at 14 (2 weeks).
Whenever a limit is hit, scaling will advance a level.
Reference(s):
. Feb, 2022 - added 'ELAPSED'
commit 9348d3b0085bd389749cc5619fdde4ec3fae5f11
. Feb, 2022 - added 'STARTED'
commit 7647e96b0a35d473fa9bc644ea6107487b3b0527
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-03 11:30:00 +05:30
|
|
|
|
#if defined(SCALE_FORMER) && defined(SCALE_POSTFX)
|
|
|
|
|
# warning 'SCALE_POSTFX' is ignored when 'SCALE_FORMER' is active
|
|
|
|
|
#endif
|
2022-03-12 11:30:00 +05:30
|
|
|
|
#if defined(USE_X_COLHDR)
|
|
|
|
|
# warning 'USE_X_COLHDR' makes parts of man page misleading (4e, 5d & 5e)
|
|
|
|
|
#endif
|
2002-11-29 04:39:48 +05:30
|
|
|
|
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/*###### Some Prototypes (ha!) #########################################*/
|
|
|
|
|
|
2012-02-11 13:32:02 +05:30
|
|
|
|
/* These 'prototypes' are here exclusively for documentation purposes. */
|
|
|
|
|
/* ( see the find_string function for the one true required protoype ) */
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/*------ Tiny useful routine(s) ----------------------------------------*/
|
|
|
|
|
//atic const char *fmtmk (const char *fmts, ...);
|
top: provide an unlimited capacity for field additions
With each of those references shown below, the maximum
number of fields was increased. However, with a 'char'
based implementation we're nearing the upper limits of
total displayable fields. We currently use 76 of a max
of 86 fields. With extra effort, 94 might be possible.
But 94 is the absolute upper limit of possible fields!
Moreover, the current implementation yields characters
that were unprintable in the rcfile. This could become
an issue with that 'inspect' feature when/if an rcfile
is edited to add entries (as opposed to using 'echo').
So, with this commit the internals of field management
has been completely reimagined. It is now based on the
integer type, not a character. And whereas that former
design used the high order bit to show the 'on' state,
thus yielding an unprintable character, the new design
uses the low order bit for the state. As such, numbers
will be kept small and an even number will be an 'off'
field whereas an odd number will become an 'on' state.
The bottom line is that this new design will afford an
unlimited number of new fields while keeping an rcfile
completely free of that potential unprintable garbage.
And it is embarrassingly easy to extend the maximum of
supportable fields from the currently implemented 100.
Who knows, maybe a future patch will prove this point.
[ unless a subsequent commit proves otherwise, given ]
[ the dramatic differences in rcfile contents, i had ]
[ to abandon the practice of supporting old rcfiles. ]
Reference(s):
. Nov, 2013 - RCF_PLUS_H introduced
commit af4e6533ba5ee04f414bc8774df31ddef38e8880
. Jul, 2016 - RCF_PLUS_J introduced
commit d5c5051fb395e8bebaadb42add79ca99a16afe85
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-13 11:30:00 +05:30
|
|
|
|
//atic inline int mlen (const int *mem);
|
|
|
|
|
//atic inline int *msch (const int *mem, int obj, int max);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic inline char *scat (char *dst, const char *src);
|
|
|
|
|
//atic const char *tg2 (int x, int y);
|
|
|
|
|
/*------ Exit/Interrput routines ---------------------------------------*/
|
2012-12-12 11:30:00 +05:30
|
|
|
|
//atic void at_eoj (void);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic void bye_bye (const char *str);
|
|
|
|
|
//atic void error_exit (const char *str);
|
2011-09-12 17:48:23 +05:30
|
|
|
|
//atic void sig_abexit (int sig);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic void sig_endpgm (int dont_care_sig);
|
|
|
|
|
//atic void sig_paused (int dont_care_sig);
|
|
|
|
|
//atic void sig_resize (int dont_care_sig);
|
top: refactored for correct multi-byte string handling
When this project first began implementing translation
support nearly 6 years ago, we overcame many 'gettext'
obstacles and limitations. And, of course, there were
not any actual translations at the time so our testing
was quite limited plus, in many cases, only simulated.
None of that, however, can justify or excuse the total
lack of attention to top's approach to NLS, especially
since some actual translations have existed for years.
When the issue referenced below was raised, I suffered
immediate feelings of anxiety, doubt and pending doom.
This was mostly because top strives to avoid line wrap
at all costs and that did not bode well for multi-byte
translated strings, using several bytes per character.
I was also concerned over possible performance impact,
assuming it was even possible to properly handle utf8.
But, after wrestling with the problem for several days
those initial feelings have now been replaced by guilt
over any trouble I initially caused those translators.
One can only imagine how frustrating it must have been
after the translation effort to then see top display a
misaligned column header and fields management page or
truncated screens like those of help or color mapping.
------------------------------------------------------
Ok, with that off my chest let's review these changes,
now that top properly handles UTF8 multi-byte strings.
. Performance - virtually all of this newly added cost
for multi-byte support is incurred during interactions
with the user. So, performance is not really an issue.
The one occasion when performance is impacted is found
during 'summary_show()' processing, due to an addition
of one new call to 'utf8_delta()' in 'show_special()'.
. Extra Wide Characters - I have not yet and may never
figure out a way to support languages like zh_CN where
the characters can be wider than most other languages.
. Translated User Name - at some future point we could
implement translation of user names. But as the author
of the issue acknowledged such names are non-standard.
Thus task display still incurs no new multi-byte costs
beyond those already incurred in that escape.c module.
For raising the issue I extend my sincerest thanks to:
Göran Uddeborg
Reference(s):
https://gitlab.com/procps-ng/procps/issues/68
Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-09-28 10:52:22 +05:30
|
|
|
|
/*------ Special UTF-8 Multi-Byte support ------------------------------*/
|
|
|
|
|
/*atic char UTF8_tab[] = { ... } */
|
2018-01-08 11:30:00 +05:30
|
|
|
|
//atic inline int utf8_cols (const unsigned char *p, int n);
|
top: refactored for correct multi-byte string handling
When this project first began implementing translation
support nearly 6 years ago, we overcame many 'gettext'
obstacles and limitations. And, of course, there were
not any actual translations at the time so our testing
was quite limited plus, in many cases, only simulated.
None of that, however, can justify or excuse the total
lack of attention to top's approach to NLS, especially
since some actual translations have existed for years.
When the issue referenced below was raised, I suffered
immediate feelings of anxiety, doubt and pending doom.
This was mostly because top strives to avoid line wrap
at all costs and that did not bode well for multi-byte
translated strings, using several bytes per character.
I was also concerned over possible performance impact,
assuming it was even possible to properly handle utf8.
But, after wrestling with the problem for several days
those initial feelings have now been replaced by guilt
over any trouble I initially caused those translators.
One can only imagine how frustrating it must have been
after the translation effort to then see top display a
misaligned column header and fields management page or
truncated screens like those of help or color mapping.
------------------------------------------------------
Ok, with that off my chest let's review these changes,
now that top properly handles UTF8 multi-byte strings.
. Performance - virtually all of this newly added cost
for multi-byte support is incurred during interactions
with the user. So, performance is not really an issue.
The one occasion when performance is impacted is found
during 'summary_show()' processing, due to an addition
of one new call to 'utf8_delta()' in 'show_special()'.
. Extra Wide Characters - I have not yet and may never
figure out a way to support languages like zh_CN where
the characters can be wider than most other languages.
. Translated User Name - at some future point we could
implement translation of user names. But as the author
of the issue acknowledged such names are non-standard.
Thus task display still incurs no new multi-byte costs
beyond those already incurred in that escape.c module.
For raising the issue I extend my sincerest thanks to:
Göran Uddeborg
Reference(s):
https://gitlab.com/procps-ng/procps/issues/68
Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-09-28 10:52:22 +05:30
|
|
|
|
//atic int utf8_delta (const char *str);
|
|
|
|
|
//atic int utf8_embody (const char *str, int width);
|
|
|
|
|
//atic const char *utf8_justify (const char *str, int width, int justr);
|
top: extend multi-byte support to 'Inspection' feature
The previous commit implemented multi-byte support for
the basic top user interaction and display provisions.
This commit completes multi-byte support by addressing
that 'Inspect Other Output' feature (the 'Y' command).
Few people probably exploit this very powerful feature
which allows the perusing of any file or piped output.
And even if nobody uses 'Y', someone will stumble over
it on the help screen and try it out. Assuming top was
not built with INSP_OFFDEMO defined, they'll end up on
the screen our translators have faithfully translated.
Without this patch, such a screen would display with a
bunch of 'unprintable' characters which will then show
in the standard (less-like) way as: '^A', '<C3>', etc.
In other words, those poor screens will be a big mess!
[ this program can even display an executable binary ]
[ while at that same time supporting Find/Find Next. ]
[ imagine, a file with no guarantee of real strings! ]
[ just try a Find using less with such binary files. ]
With this commit, the translated 'Y' demo screens will
now be properly shown, providing no invalid multi-byte
characters have been detected. Should that be the case
then they'll be displayed in that less-like way above.
And, if users go on to fully exploit this 'Y' command,
there is a good chance that a file or pipe might yield
output in a utf-8 multi-byte form. Should that be true
such output will thus be handled appropriately by top.
[ in many respects, this change was more challenging ]
[ than the basic support within the previous commit. ]
[ story of my life: least used = most effort needed. ]
Many thanks to our procps-ng translators which enabled
a proper test of these changed 'Y' command provisions:
. Vietnamese: Trần Ngọc Quân
. Polish: Jakub Bogusz
. German: Mario Blättermann
. French: Frédéric Marchal, Stéphane Aulery
[ and my sincerest apologies too, for my negligence! ]
Reference(s):
https://gitlab.com/procps-ng/procps/issues/68
Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-09-28 11:03:33 +05:30
|
|
|
|
//atic int utf8_proper_col (const char *str, int col, int tophysical);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/*------ Misc Color/Display support ------------------------------------*/
|
|
|
|
|
//atic void capsmk (WIN_t *q);
|
|
|
|
|
//atic void show_msg (const char *str);
|
|
|
|
|
//atic int show_pmt (const char *str);
|
2018-06-20 10:30:00 +05:30
|
|
|
|
//atic void show_scroll (void);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic void show_special (int interact, const char *glob);
|
top: add a flexible 'Inspect' capability
This commit introduces an extremely powerful, flexible
brand new capability. Now, users can pause the normal
iterative display and inspect the contents of any file
or output from any script, command, or even pipelines.
It's invoked via the 'Y' interactive command which, in
turn, is supported with simple user supplied additions
as new entries in the top personal configuration file.
A separate new 'Inspect' window supports scrolling and
searching, similar to the main top display. Except it
extends existing 'L'/'&' (locate/locate-next) commands
so that an out-of-view match automatically adjusts the
horizontal position bringing such data into view. And
it provides for multiple successive same line matches.
Also, the basic 'more/less' navigation keys are active
in this new 'Inspect' window, to ease user transition.
There are no program changes required when entries are
added to or deleted from the rcfile. And there are no
known limits to the complexity of a script, command or
pipeline, other than the unidirectional nature imposed
by the 'popen' function call which top cannot violate.
Since it's impossible to predict exactly what contents
will be generated, top treats all output as raw binary
data. Any control characters display in '^C' notation
while all other unprintable characters show as '<AB>'.
The biggest problem encountered was with the find/next
capability since that strstr guy was really diminished
given the possibility that numerous 'strings' could be
encountered *within* many of top's raw, binary 'rows'.
Oh, and another problem was in maintaining the perfect
left & right text justification of this commit message
along with all of the commit summaries. Some of those
summaries (like this very one) are of course, slightly
shorter, to make room for the 'man document' addition.
Enjoy!
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-25 10:30:05 +05:30
|
|
|
|
/*------ Low Level Memory/Keyboard/File I/O support --------------------*/
|
2011-12-20 19:53:37 +05:30
|
|
|
|
//atic void *alloc_c (size_t num);
|
|
|
|
|
//atic void *alloc_r (void *ptr, size_t num);
|
2013-02-11 11:30:00 +05:30
|
|
|
|
//atic char *alloc_s (const char *str);
|
2013-01-16 11:30:00 +05:30
|
|
|
|
//atic inline int ioa (struct timespec *ts);
|
2013-01-16 11:30:00 +05:30
|
|
|
|
//atic int ioch (int ech, char *buf, unsigned cnt);
|
2013-02-15 11:30:00 +05:30
|
|
|
|
//atic int iokey (int action);
|
2013-01-16 11:30:00 +05:30
|
|
|
|
//atic char *ioline (const char *prompt);
|
2014-06-28 10:30:00 +05:30
|
|
|
|
//atic int mkfloat (const char *str, float *num, int whole);
|
2012-11-28 11:30:00 +05:30
|
|
|
|
//atic int readfile (FILE *fp, char **baddr, size_t *bsize, size_t *bread);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/*------ Small Utility routines ----------------------------------------*/
|
|
|
|
|
//atic float get_float (const char *prompt);
|
|
|
|
|
//atic int get_int (const char *prompt);
|
2016-05-06 10:30:00 +05:30
|
|
|
|
//atic inline const char *hex_make (long num, int noz);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic const char *user_certify (WIN_t *q, const char *str, char typ);
|
2012-09-19 11:31:01 +05:30
|
|
|
|
/*------ Basic Formatting support --------------------------------------*/
|
|
|
|
|
//atic inline const char *justify_pad (const char *str, int width, int justr);
|
2012-10-06 01:45:15 +05:30
|
|
|
|
//atic inline const char *make_chr (const char ch, int width, int justr);
|
2016-04-15 10:30:00 +05:30
|
|
|
|
//atic inline const char *make_num (long num, int width, int justr, int col, int noz);
|
2012-10-06 01:45:15 +05:30
|
|
|
|
//atic inline const char *make_str (const char *str, int width, int justr, int col);
|
2017-09-30 10:52:22 +05:30
|
|
|
|
//atic inline const char *make_str_utf8 (const char *str, int width, int justr, int col);
|
2021-03-08 17:38:21 +05:30
|
|
|
|
//atic const char *scale_mem (int target, float num, int width, int justr);
|
|
|
|
|
//atic const char *scale_num (float num, int width, int justr);
|
2022-02-25 11:30:00 +05:30
|
|
|
|
//atic const char *scale_pcnt (float num, int width, int justr, int xtra);
|
top: refactor 'scale_tics' function for better scaling
This patch refactors the 'scale_tics' function to more
closely parallel uptime shown on the first line of the
summary area. The old logic has been preserved through
the header file's new #define SCALE_FORMER provision.
However, the former logic was actually a big disaster.
These are some potential problems with that old logic:
1. With respect to our time fields top no longer deals
solely with cpu time. So, the old limits of '68 weeks'
could possibly be insufficient to reflect those times.
2. Given the widths of top's new time fields, the code
never got beyond scaling to hours. For example, with a
ridiculously large span of 19 years, the scaled result
would then be shown as '167832h'. We never reached the
days ('6993d') or even the weeks ('999w') equivalents.
3. Similarly, with that 'TIME+' field and a large tics
value, results would then appear as 'MMMMMM:SS' rather
than the more meaningful 'HH:MM:SS' or days and hours.
So henceforth we will adopt these scaling conventions:
MMM:SS.hh ... minutes:seconds.hundredths
MMM:SS ...... minutes:seconds
HH,MM ....... hours,minutes
D+H ......... days+hours (with 'd' & 'h' suffixes)
D ........... days (with 'd' suffix)
W+D ......... weeks+days (with 'w' & 'd' suffixes)
W ........... weeks (with 'w' suffix)
Note that, unlike our former scaling logic, that 'MMM'
portion won't be allowed to grow unconditionally. It's
limited (arbitrarily?) to 360 total minutes (6 hours).
Additionally, the 'HH' guy will be limited to 96 hours
(4 days) while that 'D' limit was set at 14 (2 weeks).
Whenever a limit is hit, scaling will advance a level.
Reference(s):
. Feb, 2022 - added 'ELAPSED'
commit 9348d3b0085bd389749cc5619fdde4ec3fae5f11
. Feb, 2022 - added 'STARTED'
commit 7647e96b0a35d473fa9bc644ea6107487b3b0527
Signed-off-by: Jim Warner <james.warner@comcast.net>
2022-03-03 11:30:00 +05:30
|
|
|
|
//atic const char *scale_tics (TIC_t tics, int width, int justr, int target);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/*------ Fields Management support -------------------------------------*/
|
2016-10-07 11:41:11 +05:30
|
|
|
|
/*atic struct Fieldstab[] = { ... } */
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic void adj_geometry (void);
|
2012-02-09 09:52:22 +05:30
|
|
|
|
//atic void build_headers (void);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic void calibrate_fields (void);
|
2011-05-26 15:03:32 +05:30
|
|
|
|
//atic void display_fields (int focus, int extend);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic void fields_utility (void);
|
2012-10-03 23:43:13 +05:30
|
|
|
|
//atic inline void widths_resize (void);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic void zap_fieldstab (void);
|
2021-09-18 10:30:00 +05:30
|
|
|
|
/*------ Library Interface (as separate threads) -----------------------*/
|
2021-09-18 10:30:00 +05:30
|
|
|
|
//atic void *cpus_refresh (void *unused);
|
|
|
|
|
//atic void *memory_refresh (void *unused);
|
|
|
|
|
//atic void *tasks_refresh (void *unused);
|
top: add a flexible 'Inspect' capability
This commit introduces an extremely powerful, flexible
brand new capability. Now, users can pause the normal
iterative display and inspect the contents of any file
or output from any script, command, or even pipelines.
It's invoked via the 'Y' interactive command which, in
turn, is supported with simple user supplied additions
as new entries in the top personal configuration file.
A separate new 'Inspect' window supports scrolling and
searching, similar to the main top display. Except it
extends existing 'L'/'&' (locate/locate-next) commands
so that an out-of-view match automatically adjusts the
horizontal position bringing such data into view. And
it provides for multiple successive same line matches.
Also, the basic 'more/less' navigation keys are active
in this new 'Inspect' window, to ease user transition.
There are no program changes required when entries are
added to or deleted from the rcfile. And there are no
known limits to the complexity of a script, command or
pipeline, other than the unidirectional nature imposed
by the 'popen' function call which top cannot violate.
Since it's impossible to predict exactly what contents
will be generated, top treats all output as raw binary
data. Any control characters display in '^C' notation
while all other unprintable characters show as '<AB>'.
The biggest problem encountered was with the find/next
capability since that strstr guy was really diminished
given the possibility that numerous 'strings' could be
encountered *within* many of top's raw, binary 'rows'.
Oh, and another problem was in maintaining the perfect
left & right text justification of this commit message
along with all of the commit summaries. Some of those
summaries (like this very one) are of course, slightly
shorter, to make room for the 'man document' addition.
Enjoy!
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-25 10:30:05 +05:30
|
|
|
|
/*------ Inspect Other Output ------------------------------------------*/
|
|
|
|
|
//atic void insp_cnt_nl (void);
|
|
|
|
|
#ifndef INSP_OFFDEMO
|
|
|
|
|
//atic void insp_do_demo (char *fmts, int pid);
|
|
|
|
|
#endif
|
|
|
|
|
//atic void insp_do_file (char *fmts, int pid);
|
|
|
|
|
//atic void insp_do_pipe (char *fmts, int pid);
|
2012-12-03 11:30:00 +05:30
|
|
|
|
//atic inline int insp_find_ofs (int col, int row);
|
|
|
|
|
//atic void insp_find_str (int ch, int *col, int *row);
|
top: extend multi-byte support to 'Inspection' feature
The previous commit implemented multi-byte support for
the basic top user interaction and display provisions.
This commit completes multi-byte support by addressing
that 'Inspect Other Output' feature (the 'Y' command).
Few people probably exploit this very powerful feature
which allows the perusing of any file or piped output.
And even if nobody uses 'Y', someone will stumble over
it on the help screen and try it out. Assuming top was
not built with INSP_OFFDEMO defined, they'll end up on
the screen our translators have faithfully translated.
Without this patch, such a screen would display with a
bunch of 'unprintable' characters which will then show
in the standard (less-like) way as: '^A', '<C3>', etc.
In other words, those poor screens will be a big mess!
[ this program can even display an executable binary ]
[ while at that same time supporting Find/Find Next. ]
[ imagine, a file with no guarantee of real strings! ]
[ just try a Find using less with such binary files. ]
With this commit, the translated 'Y' demo screens will
now be properly shown, providing no invalid multi-byte
characters have been detected. Should that be the case
then they'll be displayed in that less-like way above.
And, if users go on to fully exploit this 'Y' command,
there is a good chance that a file or pipe might yield
output in a utf-8 multi-byte form. Should that be true
such output will thus be handled appropriately by top.
[ in many respects, this change was more challenging ]
[ than the basic support within the previous commit. ]
[ story of my life: least used = most effort needed. ]
Many thanks to our procps-ng translators which enabled
a proper test of these changed 'Y' command provisions:
. Vietnamese: Trần Ngọc Quân
. Polish: Jakub Bogusz
. German: Mario Blättermann
. French: Frédéric Marchal, Stéphane Aulery
[ and my sincerest apologies too, for my negligence! ]
Reference(s):
https://gitlab.com/procps-ng/procps/issues/68
Signed-off-by: Jim Warner <james.warner@comcast.net>
2017-09-28 11:03:33 +05:30
|
|
|
|
//atic void insp_mkrow_raw (int col, int row);
|
|
|
|
|
//atic void insp_mkrow_utf8 (int col, int row);
|
2012-12-03 11:30:00 +05:30
|
|
|
|
//atic void insp_show_pgs (int col, int row, int max);
|
2018-07-04 10:30:00 +05:30
|
|
|
|
//atic int insp_view_choice (struct pids_stack *p);
|
top: add a flexible 'Inspect' capability
This commit introduces an extremely powerful, flexible
brand new capability. Now, users can pause the normal
iterative display and inspect the contents of any file
or output from any script, command, or even pipelines.
It's invoked via the 'Y' interactive command which, in
turn, is supported with simple user supplied additions
as new entries in the top personal configuration file.
A separate new 'Inspect' window supports scrolling and
searching, similar to the main top display. Except it
extends existing 'L'/'&' (locate/locate-next) commands
so that an out-of-view match automatically adjusts the
horizontal position bringing such data into view. And
it provides for multiple successive same line matches.
Also, the basic 'more/less' navigation keys are active
in this new 'Inspect' window, to ease user transition.
There are no program changes required when entries are
added to or deleted from the rcfile. And there are no
known limits to the complexity of a script, command or
pipeline, other than the unidirectional nature imposed
by the 'popen' function call which top cannot violate.
Since it's impossible to predict exactly what contents
will be generated, top treats all output as raw binary
data. Any control characters display in '^C' notation
while all other unprintable characters show as '<AB>'.
The biggest problem encountered was with the find/next
capability since that strstr guy was really diminished
given the possibility that numerous 'strings' could be
encountered *within* many of top's raw, binary 'rows'.
Oh, and another problem was in maintaining the perfect
left & right text justification of this commit message
along with all of the commit summaries. Some of those
summaries (like this very one) are of course, slightly
shorter, to make room for the 'man document' addition.
Enjoy!
Signed-off-by: Jim Warner <james.warner@comcast.net>
2012-11-25 10:30:05 +05:30
|
|
|
|
//atic void inspection_utility (int pid);
|
2018-06-20 10:30:00 +05:30
|
|
|
|
/*------ Other Filtering ------------------------------------------------*/
|
2018-06-20 10:30:00 +05:30
|
|
|
|
//atic const char *osel_add (WIN_t *q, int ch, char *glob, int push);
|
2018-06-20 10:30:00 +05:30
|
|
|
|
//atic void osel_clear (WIN_t *q);
|
|
|
|
|
//atic inline int osel_matched (const WIN_t *q, FLG_t enu, const char *str);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/*------ Startup routines ----------------------------------------------*/
|
|
|
|
|
//atic void before (char *me);
|
2022-03-13 11:30:00 +05:30
|
|
|
|
//atic int cfg_xform (WIN_t *q, char *flds, const char *defs);
|
2018-06-20 10:30:00 +05:30
|
|
|
|
//atic int config_insp (FILE *fp, char *buf, size_t size);
|
2018-06-20 10:30:00 +05:30
|
|
|
|
//atic int config_osel (FILE *fp, char *buf, size_t size);
|
2018-06-20 10:30:00 +05:30
|
|
|
|
//atic const char *configs_file (FILE *fp, const char *name, float *delay);
|
2018-06-02 10:30:00 +05:30
|
|
|
|
//atic int configs_path (const char *const fmts, ...);
|
|
|
|
|
//atic void configs_reads (void);
|
2021-09-04 10:30:00 +05:30
|
|
|
|
//atic void parse_args (int argc, char **argv);
|
2022-04-09 10:30:00 +05:30
|
|
|
|
//atic void signals_set (void);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic void whack_terminal (void);
|
|
|
|
|
/*------ Windows/Field Groups support ----------------------------------*/
|
|
|
|
|
//atic void win_names (WIN_t *q, const char *name);
|
2013-02-27 11:30:00 +05:30
|
|
|
|
//atic void win_reset (WIN_t *q);
|
2013-01-11 11:30:00 +05:30
|
|
|
|
//atic WIN_t *win_select (int ch);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic int win_warn (int what);
|
2012-02-07 22:41:11 +05:30
|
|
|
|
//atic void wins_clrhlp (WIN_t *q, int save);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic void wins_colors (void);
|
|
|
|
|
//atic void wins_reflag (int what, int flg);
|
|
|
|
|
//atic void wins_stage_1 (void);
|
|
|
|
|
//atic void wins_stage_2 (void);
|
2021-07-27 10:30:00 +05:30
|
|
|
|
//atic inline int wins_usrselect (const WIN_t *q, int idx);
|
2018-06-20 10:30:00 +05:30
|
|
|
|
/*------ Forest View support -------------------------------------------*/
|
2022-02-12 11:30:00 +05:30
|
|
|
|
//atic void forest_adds (const int self, int level);
|
2018-06-20 10:30:00 +05:30
|
|
|
|
//atic void forest_begin (WIN_t *q);
|
2021-07-24 10:30:00 +05:30
|
|
|
|
//atic void forest_config (WIN_t *q);
|
2021-07-27 10:30:00 +05:30
|
|
|
|
//atic inline const char *forest_display (const WIN_t *q, int idx);
|
2022-05-12 10:30:00 +05:30
|
|
|
|
/*------ Special Separate Bottom Window support ------------------------*/
|
2022-05-12 10:30:00 +05:30
|
|
|
|
//atic void bot_do (const char *str, int focus);
|
2022-05-15 10:30:00 +05:30
|
|
|
|
//atic int bot_focus_str (const char *hdr, const char *str);
|
|
|
|
|
//atic int bot_focus_strv (const char *hdr, const char **strv);
|
2022-05-25 10:30:00 +05:30
|
|
|
|
//atic void *bot_item_hlp (struct pids_stack *p);
|
2022-05-12 10:30:00 +05:30
|
|
|
|
//atic void bot_item_show (void);
|
2022-05-27 10:30:00 +05:30
|
|
|
|
//atic void bot_item_toggle (int what, const char *head, char sep);
|
2013-03-03 11:30:00 +05:30
|
|
|
|
/*------ Interactive Input Tertiary support ----------------------------*/
|
top: highlight all regular search string(s) when found
With the recent inspect search highlight provisions in
place, the lack of highlighting in task based searches
has grown from being only irritating to a real defect.
Thus, this commit introduces parallel functionality to
those searches initiated within a visible task window.
And just as separate inspect searches are possible for
each selection, per window task searches are provided.
However, it should be noted that there are differences
between task based searches and inspect type searches:
* There is no concept of out-of-view data when dealing
. with task rows -- if the data can't bee seen, it has
. not, in fact, been constructed from a proc_t struct.
* While inspect data is output at the character level,
. up to now all task display data was only potentially
. output and it was always based on a complete string.
* With task search highlighting, rows now containing a
. match must be output in pieces and, therefore, can't
. be optimized away like other rows which haven't been
. been altered. This is because top cannot predict the
. the contents of a search string or, how many matches
. might occur in a given row. Short search strings and
. many matches would raise buffer needs geometrically.
(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-08 11:30:00 +05:30
|
|
|
|
//atic inline int find_ofs (const WIN_t *q, const char *buf);
|
2011-12-17 01:34:38 +05:30
|
|
|
|
//atic void find_string (int ch);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic void help_view (void);
|
2018-06-20 10:30:00 +05:30
|
|
|
|
//atic void other_filters (int ch);
|
2013-03-03 11:30:00 +05:30
|
|
|
|
//atic void write_rcfile (void);
|
|
|
|
|
/*------ Interactive Input Secondary support (do_key helpers) ----------*/
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic void keys_global (int ch);
|
|
|
|
|
//atic void keys_summary (int ch);
|
|
|
|
|
//atic void keys_task (int ch);
|
|
|
|
|
//atic void keys_window (int ch);
|
|
|
|
|
//atic void keys_xtra (int ch);
|
2022-01-03 10:30:00 +05:30
|
|
|
|
/*------ Tertiary summary display support (summary_show helpers) -------*/
|
2021-08-04 10:30:00 +05:30
|
|
|
|
//atic inline int sum_see (const char *str, int nobuf);
|
|
|
|
|
//atic int sum_tics (struct stat_stack *this, const char *pfx, int nobuf);
|
|
|
|
|
//atic int sum_unify (struct stat_stack *this, int nobuf);
|
2022-01-03 10:30:00 +05:30
|
|
|
|
/*------ Secondary summary display support (summary_show helpers) ------*/
|
|
|
|
|
//atic void do_cpus (void);
|
|
|
|
|
//atic void do_memory (void);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/*------ Main Screen routines ------------------------------------------*/
|
|
|
|
|
//atic void do_key (int ch);
|
2011-08-30 17:35:45 +05:30
|
|
|
|
//atic void summary_show (void);
|
2021-07-27 10:30:00 +05:30
|
|
|
|
//atic const char *task_show (const WIN_t *q, int idx);
|
2018-06-20 10:30:00 +05:30
|
|
|
|
//atic void window_hlp (void);
|
2011-08-30 17:35:45 +05:30
|
|
|
|
//atic int window_show (WIN_t *q, int wmax);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
/*------ Entry point plus two ------------------------------------------*/
|
2012-02-07 22:41:11 +05:30
|
|
|
|
//atic void frame_hlp (int wix, int max);
|
2011-03-31 16:45:12 +05:30
|
|
|
|
//atic void frame_make (void);
|
2021-09-04 10:30:00 +05:30
|
|
|
|
// int main (int argc, char *argv[]);
|
2002-05-30 09:14:46 +05:30
|
|
|
|
|
|
|
|
|
#endif /* _Itop */
|
2011-03-31 16:45:12 +05:30
|
|
|
|
|