version 1.101, 2019/10/08 20:51:03 |
version 1.102, 2020/01/06 20:05:10 |
|
|
int rundisplay(void); |
int rundisplay(void); |
|
|
static int max_topn; /* maximum displayable processes */ |
static int max_topn; /* maximum displayable processes */ |
|
static int skip; /* how many processes to skip (scroll) */ |
|
|
extern int ncpu; |
extern int ncpu; |
extern int ncpuonline; |
extern int ncpuonline; |
|
|
#define CMD_add 21 |
#define CMD_add 21 |
#define CMD_hl 22 |
#define CMD_hl 22 |
#define CMD_cpus 23 |
#define CMD_cpus 23 |
|
#define CMD_down 24 |
|
#define CMD_up 25 |
|
#define CMD_pagedown 26 |
|
#define CMD_pageup 27 |
|
|
static void |
static void |
usage(void) |
usage(void) |
|
|
active_procs = topn; |
active_procs = topn; |
if (active_procs > max_topn) |
if (active_procs > max_topn) |
active_procs = max_topn; |
active_procs = max_topn; |
|
/* determine how many process to skip, if asked to */ |
|
/* |
|
* this number is tweaked by user, but gets shrinked |
|
* when number of active processes lowers too much |
|
*/ |
|
if (skip + active_procs > system_info.p_active) |
|
skip = system_info.p_active - active_procs; |
|
for (i = skip; i > 0; i--) |
|
skip_next_process(processes); |
/* now show the top "n" processes. */ |
/* now show the top "n" processes. */ |
for (i = 0; i < active_procs; i++) { |
for (i = 0; i < active_procs; i++) { |
pid_t pid; |
pid_t pid; |
|
|
char ch, *iptr; |
char ch, *iptr; |
int change, i; |
int change, i; |
struct pollfd pfd[1]; |
struct pollfd pfd[1]; |
static char command_chars[] = "\f qh?en#sdkriIuSopCHg+P1"; |
static char command_chars[] = "\f qh?en#sdkriIuSopCHg+P109)("; |
|
|
/* |
/* |
* assume valid command unless told |
* assume valid command unless told |
|
|
combine_cpus = !combine_cpus; |
combine_cpus = !combine_cpus; |
max_topn = display_resize(); |
max_topn = display_resize(); |
reset_display(); |
reset_display(); |
|
break; |
|
case CMD_down: |
|
skip++; |
|
break; |
|
case CMD_up: |
|
if (skip > 0) |
|
skip--; |
|
break; |
|
case CMD_pagedown: |
|
skip += max_topn / 2; |
|
break; |
|
case CMD_pageup: |
|
skip -= max_topn / 2; |
|
if (skip < 0) |
|
skip = 0; |
break; |
break; |
default: |
default: |
new_message(MT_standout, " BAD CASE IN SWITCH!"); |
new_message(MT_standout, " BAD CASE IN SWITCH!"); |