top: refactor graph support of cpu/mem summary display <=== port of newlib 2d5b51d1

______________________________ original newlib message

The logic (illogic?) in the sum_tics() and do_memory()
functions has grown to become almost unfathomable over
time. Additionally, though perhaps not apparent in the
code, many steps are duplicated within those routines.

So, this patch refactors all the summary graph support
to consolidate duplicated code and (hopefully) make it
more understandable with an eye to future maintenance.

[ additionally, that show_special guy's workload has ]
[ been reduced by eliminating any special directives ]
[ previously embedded in some cpu graphs even though ]
[ a cpu may have been idle during the last interval. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2022-09-12 00:00:00 -05:00
committed by Craig Small
parent f1862cde1c
commit 737e6f5b59
2 changed files with 83 additions and 68 deletions

View File

@@ -55,7 +55,6 @@
//#define PRETEND2_5_X /* pretend we're linux 2.5.x (for IO-wait) */
//#define PRETEND48CPU /* pretend we're smp with 48 ticsers (sic) */
//#define PRETENDNOCAP /* pretend terminal missing essential caps */
//#define QUICK_GRAPHS /* use fast algorithm & accept +2% distort */
//#define RCFILE_NOERR /* rcfile errs silently default, vs. fatal */
//#define RECALL_FIXED /* don't reorder saved strings if recalled */
//#define RMAN_IGNORED /* don't consider auto right margin glitch */
@@ -847,6 +846,7 @@ typedef struct WIN_t {
//atic void keys_window (int ch);
//atic void keys_xtra (int ch);
/*------ Tertiary summary display support (summary_show helpers) -------*/
//atic struct rx_st *sum_rx (long total, long part1, long part2, int style);
//atic inline int sum_see (const char *str, int nobuf);
//atic int sum_tics (CPU_t *cpu, const char *pfx, int nobuf);
//atic int sum_unify (CPU_t *cpu, int nobuf);