From 852f486cd9f8200920725f697ba166ca7a7f6b77 Mon Sep 17 00:00:00 2001 From: albert <> Date: Wed, 27 Nov 2002 09:13:42 +0000 Subject: [PATCH] topz-SomeMore.patch --- top.c | 17 ++++++++--------- top.h | 18 +++++++++--------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/top.c b/top.c index 91d23d23..b6ca3810 100644 --- a/top.c +++ b/top.c @@ -1261,8 +1261,7 @@ static void whack_terminal (void) #define L_CMDLINE L_stat | PROC_FILLARG #define L_EUSER L_status | PROC_FILLUSR #define L_GROUP L_status | PROC_FILLGRP - // from either 'stat' or 'status' (preferred), via bits not otherwise used -#define L_EITHER ~(L_stat|L_statm|L_status|L_CMDLINE|L_EUSER|L_GROUP) +#define L_EITHER PROC_SPARE_1 #define L_NONE 0 // for reframewins and summary_show 1st pass #define L_DEFAULT PROC_FILLSTAT @@ -2173,11 +2172,11 @@ static void summaryhlp (CPUS_t *restrict const cpu, const char *restrict const p STIC_t u_frme, s_frme, n_frme, i_frme, w_frme, tot_frme, tz; float scale; - u_frme = TRIMz(cpu->u - cpu->u_sav); - s_frme = TRIMz(cpu->s - cpu->s_sav); - n_frme = TRIMz(cpu->n - cpu->n_sav); + u_frme = cpu->u - cpu->u_sav; + s_frme = cpu->s - cpu->s_sav; + n_frme = cpu->n - cpu->n_sav; i_frme = TRIMz(cpu->i - cpu->i_sav); - w_frme = TRIMz(cpu->w - cpu->w_sav); + w_frme = cpu->w - cpu->w_sav; tot_frme = u_frme + s_frme + n_frme + i_frme + w_frme; if (1 > tot_frme) tot_frme = 1; scale = 100.0 / (float)tot_frme; @@ -2305,9 +2304,9 @@ static void task_show (const WIN_t *restrict q, const proc_t *restrict p) for (x = 0; x < q->maxpflgs; x++) { char cbuf[ROWBUFSIZ], _z[ROWBUFSIZ]; - PFLG_t i = q->procflags[x]; // support for our field/column - const char *restrict const f = Fieldstab[i].fmts; // macro AND sometimes the fmt - unsigned s = Fieldstab[i].scale; // string must be altered ! + PFLG_t i = q->procflags[x]; // support for our make column + const char *restrict const f = Fieldstab[i].fmts; // macro AND sometimes + unsigned s = Fieldstab[i].scale; // fmt string must be altered ! unsigned w = Fieldstab[i].width; switch (i) { diff --git a/top.h b/top.h index 97ffbdba..3c48b4f8 100644 --- a/top.h +++ b/top.h @@ -128,7 +128,7 @@ } while (0) #define PUFF(fmt,arg...) do { \ char _str[ROWBUFSIZ]; \ - char *_ptr = &Pseudo_scrn[Pseudo_row * Pseudo_cols]; \ + char *_ptr = &Pseudo_scrn[Pseudo_row++ * Pseudo_cols]; \ int _len = 1 + snprintf(_str, sizeof(_str), fmt, ## arg); \ if (Batch) putp(_str); \ else { \ @@ -137,7 +137,7 @@ else { \ memcpy(_ptr, _str, _len); \ putp(_ptr); \ - } } Pseudo_row++; \ + } } \ } while (0) /*------ Special Macros (debug and/or informative) ---------------------*/ @@ -243,7 +243,7 @@ enum pflag { #define Show_CTIMES 0x0040 /* 'S' - show times as cumulative */ #define Show_IDLEPS 0x0020 /* 'i' - show idle processes (all tasks) */ #define Qsrt_NORMAL 0x0010 /* 'R' - reversed column sort (high to low) */ - /* these flag(s) have no command as such - they're for internal use */ + // these flag(s) have no command as such - they're for internal use #define VISIBLE_tsk 0x0008 /* tasks are showable when in 'Mode_altscr' */ #define NEWFRAM_cwo 0x0004 /* new frame (if anyone cares) - in Curwin */ #define EQUWINS_cwo 0x0002 /* rebalance tasks next frame (off 'i'/ 'n') */ @@ -527,7 +527,7 @@ typedef struct win { /*------ Tiny useful routine(s) ----------------------------------------*/ //atic int chin (int ech, char *buf, unsigned cnt); //atic const char *fmtmk (const char *fmts, ...); -//atic inline char *scat (char *dst, const char *src); +//atic inline char *scat (char *restrict dst, const char *restrict src); //atic char *strim (int sp, char *str); //atic const char *tg2 (int x, int y); /*------ Exit/Interrput routines ---------------------------------------*/ @@ -548,9 +548,9 @@ typedef struct win { //atic const char *scale_num (unsigned num, const int width, const unsigned type); //atic const char *scale_tics (TICS_t tics, const int width); /*------ Library Alternatives ------------------------------------------*/ -//atic void *alloc_c (unsigned numb); -//atic void *alloc_r (void *q, unsigned numb); -//atic CPUS_t *cpus_refresh (CPUS_t *cpus); +//atic void *alloc_c (unsigned numb) MALLOC; +//atic void *alloc_r (void *q, unsigned numb) MALLOC; +//atic CPUS_t *cpus_refresh (CPUS_t *restrict cpus); //atic void prochlp (proc_t *this); //atic proc_t **procs_refresh (proc_t **table, int flags); /*------ Startup routines ----------------------------------------------*/ @@ -577,9 +577,9 @@ typedef struct win { //atic void windows_stage2 (void); /*------ Main Screen routines ------------------------------------------*/ //atic void do_key (unsigned c); -//atic void summaryhlp (CPUS_t *cpu, const char *pfx); +//atic void summaryhlp (CPUS_t *restrict const cpu, const char *restrict const pfx); //atic proc_t **summary_show (void); -//atic void task_show (WIN_t *q, proc_t *p); +//atic void task_show (const WIN_t *restrict q, const proc_t *restrict p); //atic void window_show (proc_t **ppt, WIN_t *q, int *lscr); /*------ Entry point plus two ------------------------------------------*/ //atic void framehlp (int wix, int max);