top: more useless cosemetic changes (chiefly comments)
All of these changes are self-explanatory, so I'll not provide any more comments thus avoiding further shame. [ everything's perfectly justified and right margins ] [ are filled entirely, but of course it must be luck ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
81db6664c9
commit
e80b352b74
38
top/top.c
38
top/top.c
@ -5311,9 +5311,15 @@ static void keys_xtra (int ch) {
|
|||||||
/*###### Cpu Display Secondary support (summary_show helpers) ##########*/
|
/*###### Cpu Display Secondary support (summary_show helpers) ##########*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cpu *Helper* function to combine and or show the state
|
* note how alphabetical order is maintained within carefully chosen |
|
||||||
* percentages for 1 cpu or 2 adjacent cpus (one single line). */
|
* function names such as: (s)cpu_see, (t)cpu_tics, and (u)cpu_unify |
|
||||||
static inline int cpu_prt (const char *str, int nobuf) {
|
* with each name exactly 1 letter more than the preceeding function |
|
||||||
|
* ( surely, this must make us run much more efficiently. amirite? ) | */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cpu *Helper* function to show the percentages for one or two cpus |
|
||||||
|
* as a single line. We return the number of lines actually printed. | */
|
||||||
|
static inline int cpu_see (const char *str, int nobuf) {
|
||||||
static char row[ROWMINSIZ];
|
static char row[ROWMINSIZ];
|
||||||
static int tog;
|
static int tog;
|
||||||
char *p;
|
char *p;
|
||||||
@ -5331,17 +5337,18 @@ static inline int cpu_prt (const char *str, int nobuf) {
|
|||||||
row[0] = '\0';
|
row[0] = '\0';
|
||||||
tog = 0;
|
tog = 0;
|
||||||
return 1;
|
return 1;
|
||||||
} // end: cpu_prt
|
} // end: cpu_see
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* State display *Helper* function to calc and display the state
|
* State display *Helper* function to calculate plus display (maybe) |
|
||||||
* percentages for a single cpu. In this way, we can support
|
* the percentages for a single cpu. In this way, we'll support the |
|
||||||
* the following environments without the usual code bloat.
|
* following environments without (hopefully) that usual code bloat: |
|
||||||
* 1) single cpu machines
|
* 1) single cpu platforms (no matter the paucity of these types) |
|
||||||
* 2) modest smp boxes with room for each cpu's percentages
|
* 2) modest smp boxes with ample room for each cpu's percentages |
|
||||||
* 3) massive smp guys leaving little or no room for process
|
* 3) massive smp guys leaving little or no room for that process |
|
||||||
* display and thus requiring the cpu summary toggle */
|
* display and thus requiring the '1', '4', or '!' cpu toggles |
|
||||||
|
* ( we return the number of lines printed, as reported by cpu_see ) | */
|
||||||
static int cpu_tics (struct stat_stack *this, const char *pfx, int nobuf) {
|
static int cpu_tics (struct stat_stack *this, const char *pfx, int nobuf) {
|
||||||
// a tailored 'results stack value' extractor macro
|
// a tailored 'results stack value' extractor macro
|
||||||
#define rSv(E) TIC_VAL(E, this)
|
#define rSv(E) TIC_VAL(E, this)
|
||||||
@ -5377,10 +5384,10 @@ static int cpu_tics (struct stat_stack *this, const char *pfx, int nobuf) {
|
|||||||
snprintf(syst, sizeof(syst), gtab[ix].syst, (int)((pct_syst * Graph_adj) + .4), gtab[ix].type);
|
snprintf(syst, sizeof(syst), gtab[ix].syst, (int)((pct_syst * Graph_adj) + .4), gtab[ix].type);
|
||||||
#endif
|
#endif
|
||||||
snprintf(dual, sizeof(dual), "%s%s", user, syst);
|
snprintf(dual, sizeof(dual), "%s%s", user, syst);
|
||||||
return cpu_prt(fmtmk("%s ~3%#5.1f~2/%-#5.1f~3 %3.0f[~1%-*s]~1"
|
return cpu_see(fmtmk("%s ~3%#5.1f~2/%-#5.1f~3 %3.0f[~1%-*s]~1"
|
||||||
, pfx, pct_user, pct_syst, pct_user + pct_syst, Graph_len +4, dual), nobuf);
|
, pfx, pct_user, pct_syst, pct_user + pct_syst, Graph_len +4, dual), nobuf);
|
||||||
} else {
|
} else {
|
||||||
return cpu_prt(fmtmk(Cpu_States_fmts, pfx
|
return cpu_see(fmtmk(Cpu_States_fmts, pfx
|
||||||
, (float)rSv(stat_US) * scale, (float)rSv(stat_SY) * scale
|
, (float)rSv(stat_US) * scale, (float)rSv(stat_SY) * scale
|
||||||
, (float)rSv(stat_NI) * scale, (float)idl_frme * scale
|
, (float)rSv(stat_NI) * scale, (float)idl_frme * scale
|
||||||
, (float)rSv(stat_IO) * scale, (float)rSv(stat_IR) * scale
|
, (float)rSv(stat_IO) * scale, (float)rSv(stat_IR) * scale
|
||||||
@ -5391,8 +5398,9 @@ static int cpu_tics (struct stat_stack *this, const char *pfx, int nobuf) {
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cpu *Helper* function to combine adjacent cpu stats
|
* Cpu *Helper* function to combine additional cpu statistics in our |
|
||||||
* in an effort to reduce total number of processors shown */
|
* efforts to reduce the total number of processors that'll be shown |
|
||||||
|
* ( we return the number of lines printed, as reported by cpu_see ) | */
|
||||||
static int cpu_unify (struct stat_stack *this, int nobuf) {
|
static int cpu_unify (struct stat_stack *this, int nobuf) {
|
||||||
// a tailored 'results stack value' extractor macro
|
// a tailored 'results stack value' extractor macro
|
||||||
#define rSv(E,T) STAT_VAL(E, T, this, Stat_ctx)
|
#define rSv(E,T) STAT_VAL(E, T, this, Stat_ctx)
|
||||||
|
@ -667,7 +667,7 @@ typedef struct WIN_t {
|
|||||||
//atic void keys_window (int ch);
|
//atic void keys_window (int ch);
|
||||||
//atic void keys_xtra (int ch);
|
//atic void keys_xtra (int ch);
|
||||||
/*------ Cpu Display Secondary Support (summary_show helpers) ----------*/
|
/*------ Cpu Display Secondary Support (summary_show helpers) ----------*/
|
||||||
//atic inline int cpu_prt (const char *str, int nobuf);
|
//atic inline int cpu_see (const char *str, int nobuf);
|
||||||
//atic int cpu_tics (struct stat_stack *this, const char *pfx, int nobuf);
|
//atic int cpu_tics (struct stat_stack *this, const char *pfx, int nobuf);
|
||||||
//atic int cpu_unify (struct stat_stack *this, int nobuf);
|
//atic int cpu_unify (struct stat_stack *this, int nobuf);
|
||||||
/*------ Main Screen routines ------------------------------------------*/
|
/*------ Main Screen routines ------------------------------------------*/
|
||||||
|
Loading…
Reference in New Issue
Block a user