related: adapt for changes in result types, <PIDS> api

This patch is the response to changes in <pids> types.

These additional modifications were also incorporated.

. ps -------------------------------------------------
pr_wname was eliminated as it just duplicated pr_wchan
pr_wchan referenced WCHAN_ADDR in error, vs WCHAN_NAME
pr_nwchan referenced WCHAN_NAME, not proper WCHAN_ADDR

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-07-31 00:00:00 -05:00 committed by Craig Small
parent c4aa6c0ab4
commit 51aef8f769
2 changed files with 125 additions and 142 deletions

View File

@ -452,7 +452,7 @@ setREL1(TIME_ALL)
*/
static int pr_vsz(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(VM_SIZE)
return snprintf(outbuf, COLWID, "%ld", rSv(VM_SIZE, sl_int, pp));
return snprintf(outbuf, COLWID, "%lu", rSv(VM_SIZE, ul_int, pp));
}
//////////////////////////////////////////////////////////////////////////////////////
@ -555,8 +555,8 @@ setREL1(PRIORITY)
// policies (-1).
static int pr_nice(char *restrict const outbuf, const proc_t *restrict const pp){
setREL2(NICE,SCHED_CLASS)
if(rSv(SCHED_CLASS, ul_int, pp)!=0 && rSv(SCHED_CLASS, ul_int, pp)!=3 && rSv(SCHED_CLASS, ul_int, pp)!=-1) return snprintf(outbuf, COLWID, "-");
return snprintf(outbuf, COLWID, "%ld", rSv(NICE, sl_int, pp));
if(rSv(SCHED_CLASS, s_int, pp)!=0 && rSv(SCHED_CLASS, s_int, pp)!=3 && rSv(SCHED_CLASS, s_int, pp)!=-1) return snprintf(outbuf, COLWID, "-");
return snprintf(outbuf, COLWID, "%d", rSv(NICE, s_int, pp));
}
// HP-UX "cls": RT RR RR2 ???? HPUX FIFO KERN
@ -571,7 +571,7 @@ setREL2(NICE,SCHED_CLASS)
// see miser(1) for this; PRI has some letter codes too
static int pr_class(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(SCHED_CLASS)
switch(rSv(SCHED_CLASS, ul_int, pp)){
switch(rSv(SCHED_CLASS, s_int, pp)){
case -1: return snprintf(outbuf, COLWID, "-"); // not reported
case 0: return snprintf(outbuf, COLWID, "TS"); // SCHED_OTHER SCHED_NORMAL
case 1: return snprintf(outbuf, COLWID, "FF"); // SCHED_FIFO
@ -594,13 +594,13 @@ setREL1(SCHED_CLASS)
// We just print the priority, and have other keywords for type.
static int pr_rtprio(char *restrict const outbuf, const proc_t *restrict const pp){
setREL2(SCHED_CLASS,RTPRIO)
if(rSv(SCHED_CLASS, ul_int, pp)==0 || rSv(SCHED_CLASS, ul_int, pp)==(unsigned long)-1) return snprintf(outbuf, COLWID, "-");
return snprintf(outbuf, COLWID, "%ld", rSv(RTPRIO, ul_int, pp));
if(rSv(SCHED_CLASS, s_int, pp)==0 || rSv(SCHED_CLASS, s_int, pp)==-1) return snprintf(outbuf, COLWID, "-");
return snprintf(outbuf, COLWID, "%d", rSv(RTPRIO, s_int, pp));
}
static int pr_sched(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(SCHED_CLASS)
if(rSv(SCHED_CLASS, ul_int, pp)==(unsigned long)-1) return snprintf(outbuf, COLWID, "-");
return snprintf(outbuf, COLWID, "%ld", rSv(SCHED_CLASS, ul_int, pp));
if(rSv(SCHED_CLASS, s_int, pp)==-1) return snprintf(outbuf, COLWID, "-");
return snprintf(outbuf, COLWID, "%d", rSv(SCHED_CLASS, s_int, pp));
}
////////////////////////////////////////////////////////////////////////////////
@ -632,34 +632,17 @@ setREL1(WCHAN_NAME)
return len;
}
static int pr_wname(char *restrict const outbuf, const proc_t *restrict const pp){
/* SGI's IRIX always uses a number for "wchan", so "wname" is provided too.
*
* We use '-' for running processes, the location when there is
* only one thread waiting in the kernel, and '*' when there is
* more than one thread waiting in the kernel.
*
* The output should be truncated to maximal columns width -- overflow
* is not supported for the "wchan".
*/
const char *w;
size_t len;
setREL1(WCHAN_NAME)
w = rSv(WCHAN_NAME, str, pp);
len = strlen(w);
if(len>max_rightward) len=max_rightward;
memcpy(outbuf, w, len);
outbuf[len] = '\0';
return len;
}
static int pr_nwchan(char *restrict const outbuf, const proc_t *restrict const pp){
char buf[32];
setREL1(WCHAN_ADDR)
if (!(rSv(WCHAN_ADDR, ul_int, pp) & 0xffffff)) {
memcpy(outbuf, "-",2);
return 1;
}
return snprintf(outbuf, COLWID, "%x", (unsigned)rSv(WCHAN_ADDR, ul_int, pp));
snprintf(buf, sizeof(buf), "%lx", rSv(WCHAN_ADDR, ul_int, pp));
// this will force a match with that old ps ...
buf[6] = '\0';
return snprintf(outbuf, COLWID, "%s", buf);
}
/* Terrible trunctuation, like BSD crap uses: I999 J999 K999 */
@ -697,16 +680,16 @@ static int pr_stat(char *restrict const outbuf, const proc_t *restrict const pp)
return 0;
}
outbuf[end++] = rSv(STATE, s_ch, pp);
// if(rSv(RSS, sl_int, pp)==0 && rSv(STATE, s_ch, pp)!='Z') outbuf[end++] = 'W'; // useless "swapped out"
if(rSv(NICE, sl_int, pp) < 0) outbuf[end++] = '<';
if(rSv(NICE, sl_int, pp) > 0) outbuf[end++] = 'N';
// if(rSv(RSS, ul_int, pp)==0 && rSv(STATE, s_ch, pp)!='Z') outbuf[end++] = 'W'; // useless "swapped out"
if(rSv(NICE, s_int, pp) < 0) outbuf[end++] = '<';
if(rSv(NICE, s_int, pp) > 0) outbuf[end++] = 'N';
// In this order, NetBSD would add:
// traced 'X'
// systrace 'x'
// exiting 'E' (not printed for zombies)
// vforked 'V'
// system 'K' (and do not print 'L' too)
if(rSv(VM_RSS_LOCKED, sl_int, pp)) outbuf[end++] = 'L';
if(rSv(VM_RSS_LOCKED, ul_int, pp)) outbuf[end++] = 'L';
if(rSv(ID_SESSION, s_int, pp) == rSv(ID_TGID, s_int, pp)) outbuf[end++] = 's'; // session leader
if(rSv(NLWP, s_int, pp) > 1) outbuf[end++] = 'l'; // multi-threaded
if(rSv(ID_PGRP, s_int, pp) == rSv(ID_TPGID, s_int, pp)) outbuf[end++] = '+'; // in foreground process group
@ -794,13 +777,13 @@ setREL1(TIME_START)
static int pr_alarm(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(ALARM)
return old_time_helper(outbuf, rSv(ALARM, sl_int, pp), 0ULL);
return old_time_helper(outbuf, rSv(ALARM, ul_int, pp), 0ULL);
}
/* HP-UX puts this in pages and uses "vsz" for kB */
static int pr_sz(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(VM_SIZE)
return snprintf(outbuf, COLWID, "%ld", rSv(VM_SIZE, sl_int, pp)/(page_size/1024));
return snprintf(outbuf, COLWID, "%lu", rSv(VM_SIZE, ul_int, pp)/(page_size/1024));
}
@ -853,28 +836,28 @@ setREL3(VSIZE_PGS,ADDR_END_CODE,ADDR_START_CODE)
static int pr_swapable(char *restrict const outbuf, const proc_t *restrict const pp){
setREL3(VM_DATA,VM_STACK,VSIZE_PGS) // that last enum will approximate sort needs
return snprintf(outbuf, COLWID, "%ld", rSv(VM_DATA, sl_int, pp) + rSv(VM_STACK, sl_int, pp));
return snprintf(outbuf, COLWID, "%lu", rSv(VM_DATA, ul_int, pp) + rSv(VM_STACK, ul_int, pp));
}
/* nasty old Debian thing */
static int pr_size(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(VSIZE_PGS)
return snprintf(outbuf, COLWID, "%ld", rSv(VSIZE_PGS, ul_int, pp));
return snprintf(outbuf, COLWID, "%lu", rSv(VSIZE_PGS, ul_int, pp));
}
static int pr_minflt(char *restrict const outbuf, const proc_t *restrict const pp){
setREL2(FLT_MIN,FLT_MIN_C)
long flt = rSv(FLT_MIN, ul_int, pp);
unsigned long flt = rSv(FLT_MIN, ul_int, pp);
if(include_dead_children) flt = rSv(FLT_MIN_C, ul_int, pp);
return snprintf(outbuf, COLWID, "%ld", flt);
return snprintf(outbuf, COLWID, "%lu", flt);
}
static int pr_majflt(char *restrict const outbuf, const proc_t *restrict const pp){
setREL2(FLT_MAJ,FLT_MAJ_C)
long flt = rSv(FLT_MAJ, ul_int, pp);
unsigned long flt = rSv(FLT_MAJ, ul_int, pp);
if(include_dead_children) flt = rSv(FLT_MAJ_C, ul_int, pp);
return snprintf(outbuf, COLWID, "%ld", flt);
return snprintf(outbuf, COLWID, "%lu", flt);
}
static int pr_lim(char *restrict const outbuf, const proc_t *restrict const pp){
@ -885,7 +868,7 @@ setREL1(RSS_RLIM)
outbuf[2] = '\0';
return 2;
}
return snprintf(outbuf, COLWID, "%5ld", rSv(RSS_RLIM, ul_int, pp) >> 10L);
return snprintf(outbuf, COLWID, "%5lu", rSv(RSS_RLIM, ul_int, pp) >> 10L);
}
/* should print leading tilde ('~') if process is bound to the CPU */
@ -896,14 +879,14 @@ setREL1(PROCESSOR)
static int pr_rss(char *restrict const outbuf, const proc_t *restrict const pp){
setREL1(VM_RSS)
return snprintf(outbuf, COLWID, "%ld", rSv(VM_RSS, sl_int, pp));
return snprintf(outbuf, COLWID, "%lu", rSv(VM_RSS, ul_int, pp));
}
/* pp->vm_rss * 1000 would overflow on 32-bit systems with 64 GB memory */
static int pr_pmem(char *restrict const outbuf, const proc_t *restrict const pp){
unsigned long pmem = 0;
setREL1(VM_RSS)
pmem = rSv(VM_RSS, sl_int, pp) * 1000ULL / memory_total;
pmem = rSv(VM_RSS, ul_int, pp) * 1000ULL / memory_total;
if (pmem > 999) pmem = 999;
return snprintf(outbuf, COLWID, "%2u.%u", (unsigned)(pmem/10), (unsigned)(pmem%10));
}
@ -1466,10 +1449,10 @@ static const format_struct format_array[] = { /*
{"lwp", "LWP", pr_tasks, PIDS_ID_PID, 5, SUN, TO|PIDMAX|RIGHT},
{"lxc", "LXC", pr_lxcname, PIDS_LXCNAME, 8, LNX, ET|LEFT},
{"m_drs", "DRS", pr_drs, PIDS_VSIZE_PGS, 5, LNx, PO|RIGHT},
{"m_dt", "DT", pr_nop, PIDS_MEM_DT, 4, LNx, PO|RIGHT},
{"m_lrs", "LRS", pr_nop, PIDS_MEM_LRS, 5, LNx, PO|RIGHT},
{"m_resident", "RES", pr_nop, PIDS_MEM_RES, 5, LNx, PO|RIGHT},
{"m_share", "SHRD", pr_nop, PIDS_MEM_SHR, 5, LNx, PO|RIGHT},
{"m_dt", "DT", pr_nop, PIDS_MEM_DT_PGS, 4, LNx, PO|RIGHT},
{"m_lrs", "LRS", pr_nop, PIDS_MEM_LRS_PGS, 5, LNx, PO|RIGHT},
{"m_resident", "RES", pr_nop, PIDS_MEM_RES_PGS, 5, LNx, PO|RIGHT},
{"m_share", "SHRD", pr_nop, PIDS_MEM_SHR_PGS, 5, LNx, PO|RIGHT},
{"m_size", "SIZE", pr_size, PIDS_VSIZE_PGS, 5, LNX, PO|RIGHT},
{"m_swap", "SWAP", pr_nop, PIDS_noop, 5, LNx, PO|RIGHT},
{"m_trs", "TRS", pr_trs, PIDS_VSIZE_PGS, 5, LNx, PO|RIGHT},
@ -1491,7 +1474,7 @@ static const format_struct format_array[] = { /*
{"nsigs", "NSIGS", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT}, /*nsignals*/
{"nswap", "NSWAP", pr_nop, PIDS_noop, 5, XXX, AN|RIGHT},
{"nvcsw", "VCSW", pr_nop, PIDS_noop, 5, XXX, AN|RIGHT},
{"nwchan", "WCHAN", pr_nwchan, PIDS_WCHAN_NAME, 6, XXX, TO|RIGHT},
{"nwchan", "WCHAN", pr_nwchan, PIDS_WCHAN_ADDR, 6, XXX, TO|RIGHT},
{"opri", "PRI", pr_opri, PIDS_PRIORITY, 3, SUN, TO|RIGHT},
{"osz", "SZ", pr_nop, PIDS_noop, 2, SUN, PO|RIGHT},
{"oublk", "OUBLK", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT}, /*oublock*/
@ -1524,7 +1507,7 @@ static const format_struct format_array[] = { /*
{"psr", "PSR", pr_psr, PIDS_PROCESSOR, 3, DEC, TO|RIGHT},
{"psxpri", "PPR", pr_nop, PIDS_noop, 3, DEC, TO|RIGHT},
{"re", "RE", pr_nop, PIDS_noop, 3, BSD, AN|RIGHT},
{"resident", "RES", pr_nop, PIDS_MEM_RES, 5, LNX, PO|RIGHT},
{"resident", "RES", pr_nop, PIDS_MEM_RES_PGS, 5, LNX, PO|RIGHT},
{"rgid", "RGID", pr_rgid, PIDS_ID_RGID, 5, XXX, ET|RIGHT},
{"rgroup", "RGROUP", pr_rgroup, PIDS_ID_RGROUP, 8, U98, ET|USER}, /* was 8 wide */
{"rlink", "RLINK", pr_nop, PIDS_noop, 8, BSD, AN|RIGHT},
@ -1624,8 +1607,8 @@ static const format_struct format_array[] = { /*
{"vm_stack", "STACK", pr_nop, PIDS_VM_STACK, 5, LNx, PO|RIGHT},
{"vsize", "VSZ", pr_vsz, PIDS_VSIZE_PGS, 6, DEC, PO|RIGHT}, /*vsz*/
{"vsz", "VSZ", pr_vsz, PIDS_VM_SIZE, 6, U98, PO|RIGHT}, /*vsize*/
{"wchan", "WCHAN", pr_wchan, PIDS_WCHAN_ADDR, 6, XXX, TO|WCHAN}, /* BSD n forces this to nwchan */ /* was 10 wide */
{"wname", "WCHAN", pr_wname, PIDS_WCHAN_NAME, 6, SGI, TO|WCHAN}, /* opposite of nwchan */
{"wchan", "WCHAN", pr_wchan, PIDS_WCHAN_NAME, 6, XXX, TO|WCHAN}, /* BSD n forces this to nwchan */ /* was 10 wide */
{"wname", "WCHAN", pr_wchan, PIDS_WCHAN_NAME, 6, SGI, TO|WCHAN}, /* opposite of nwchan */
{"xstat", "XSTAT", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT},
{"zone", "ZONE", pr_context, PIDS_ID_TGID, 31, SUN, ET|LEFT}, // Solaris zone == Linux context?
{"zoneid", "ZONEID", pr_nop, PIDS_noop, 31, SUN, ET|RIGHT}, // Linux only offers context names

View File

@ -1496,7 +1496,7 @@ static struct {
a 0 width represents columns set once at startup (see zap_fieldstab)
.width .scale .align .erel .item
------ ------ -------- ----- ------------------ */
------ ------ -------- ----- ------------------- */
{ 0, -1, A_right, -1, PIDS_ID_PID }, // s_int EU_PID
{ 0, -1, A_right, -1, PIDS_ID_PPID }, // s_int EU_PPD
{ 5, -1, A_right, -1, PIDS_ID_EUID }, // u_int EU_UED
@ -1512,35 +1512,35 @@ static struct {
{ 0, -1, A_right, -1, PIDS_ID_TPGID }, // s_int EU_TPG
{ 0, -1, A_right, -1, PIDS_ID_SESSION }, // s_int EU_SID
{ 3, -1, A_right, -1, PIDS_PRIORITY }, // s_int EU_PRI
{ 3, -1, A_right, -1, PIDS_NICE }, // sl_int EU_NCE
{ 3, -1, A_right, -1, PIDS_NICE }, // s_int EU_NCE
{ 3, -1, A_right, -1, PIDS_NLWP }, // s_int EU_THD
{ 0, -1, A_right, -1, PIDS_PROCESSOR }, // u_int EU_CPN
{ 0, -1, A_right, -1, PIDS_TICS_DELTA }, // sl_int EU_CPU
{ 0, -1, A_right, -1, PIDS_TICS_ALL_DELTA }, // s_int EU_CPU
{ 6, -1, A_right, -1, PIDS_TICS_ALL }, // ull_int EU_TME
{ 9, -1, A_right, -1, PIDS_TICS_ALL }, // ull_int EU_TM2
#ifdef BOOST_PERCNT
{ 5, -1, A_right, -1, PIDS_VM_RSS }, // sl_int EU_MEM
{ 5, -1, A_right, -1, PIDS_VM_RSS }, // ul_int EU_MEM
#else
{ 4, -1, A_right, -1, PIDS_VM_RSS }, // sl_int EU_MEM,
{ 4, -1, A_right, -1, PIDS_VM_RSS }, // ul_int EU_MEM,
#endif
#ifndef NOBOOST_MEMS
{ 7, SK_Kb, A_right, -1, PIDS_MEM_VIRT_KIB }, // sl_int EU_VRT
{ 6, SK_Kb, A_right, -1, PIDS_VM_SWAP }, // sl_int EU_SWP
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS }, // sl_int EU_RES
{ 6, SK_Kb, A_right, -1, PIDS_MEM_CODE_KIB }, // sl_int EU_COD
{ 7, SK_Kb, A_right, -1, PIDS_MEM_DATA_KIB }, // sl_int EU_DAT
{ 6, SK_Kb, A_right, -1, PIDS_MEM_SHR_KIB }, // sl_int EU_SHR
{ 7, SK_Kb, A_right, -1, PIDS_MEM_VIRT }, // ul_int EU_VRT
{ 6, SK_Kb, A_right, -1, PIDS_VM_SWAP }, // ul_int EU_SWP
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS }, // ul_int EU_RES
{ 6, SK_Kb, A_right, -1, PIDS_MEM_CODE }, // ul_int EU_COD
{ 7, SK_Kb, A_right, -1, PIDS_MEM_DATA }, // ul_int EU_DAT
{ 6, SK_Kb, A_right, -1, PIDS_MEM_SHR }, // ul_int EU_SHR
#else
{ 5, SK_Kb, A_right, -1, PIDS_MEM_VIRT_KIB }, // sl_int EU_VRT
{ 4, SK_Kb, A_right, -1, PIDS_VM_SWAP }, // sl_int EU_SWP
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS }, // sl_int EU_RES
{ 4, SK_Kb, A_right, -1, PIDS_MEM_CODE_KIB }, // sl_int EU_COD
{ 5, SK_Kb, A_right, -1, PIDS_MEM_DATA_KIB }, // sl_int EU_DAT
{ 4, SK_Kb, A_right, -1, PIDS_MEM_SHR_KIB }, // sl_int EU_SHR
{ 5, SK_Kb, A_right, -1, PIDS_MEM_VIRT }, // ul_int EU_VRT
{ 4, SK_Kb, A_right, -1, PIDS_VM_SWAP }, // ul_int EU_SWP
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS }, // ul_int EU_RES
{ 4, SK_Kb, A_right, -1, PIDS_MEM_CODE }, // ul_int EU_COD
{ 5, SK_Kb, A_right, -1, PIDS_MEM_DATA }, // ul_int EU_DAT
{ 4, SK_Kb, A_right, -1, PIDS_MEM_SHR }, // ul_int EU_SHR
#endif
{ 4, -1, A_right, -1, PIDS_FLT_MAJ }, // sl_int EU_FL1
{ 4, -1, A_right, -1, PIDS_FLT_MIN }, // sl_int EU_FL2
{ 4, -1, A_right, -1, PIDS_MEM_DT }, // sl_int EU_DRT ( always 0 w/ since 2.6 )
{ 4, -1, A_right, -1, PIDS_FLT_MAJ }, // ul_int EU_FL1
{ 4, -1, A_right, -1, PIDS_FLT_MIN }, // ul_int EU_FL2
{ 4, -1, A_right, -1, PIDS_MEM_DT_PGS }, // ul_int EU_DRT ( always 0 w/ since 2.6 )
{ 1, -1, A_right, -1, PIDS_STATE }, // s_ch EU_STA
{ -1, -1, A_left, -1, PIDS_CMD }, // str EU_CMD
{ 10, -1, A_left, -1, PIDS_WCHAN_NAME }, // str EU_WCH
@ -1552,12 +1552,12 @@ static struct {
{ 5, -1, A_right, -1, PIDS_OOM_ADJ }, // s_int EU_OOA
{ 4, -1, A_right, -1, PIDS_OOM_SCORE }, // s_int EU_OOM
{ -1, -1, A_left, -1, PIDS_ENVIRON }, // str EU_ENV
{ 3, -1, A_right, -1, PIDS_FLT_MAJ_DELTA }, // sl_int EU_FV1
{ 3, -1, A_right, -1, PIDS_FLT_MIN_DELTA }, // sl_int EU_FV2
{ 3, -1, A_right, -1, PIDS_FLT_MAJ_DELTA }, // s_int EU_FV1
{ 3, -1, A_right, -1, PIDS_FLT_MIN_DELTA }, // s_int EU_FV2
#ifndef NOBOOST_MEMS
{ 6, SK_Kb, A_right, -1, PIDS_VM_USED }, // sl_int EU_USE
{ 6, SK_Kb, A_right, -1, PIDS_VM_USED }, // ul_int EU_USE
#else
{ 4, SK_Kb, A_right, -1, PIDS_VM_USED }, // sl_int EU_USE
{ 4, SK_Kb, A_right, -1, PIDS_VM_USED }, // ul_int EU_USE
#endif
{ 10, -1, A_right, -1, PIDS_NS_IPC }, // ul_int EU_NS1
{ 10, -1, A_right, -1, PIDS_NS_MNT }, // ul_int EU_NS2
@ -1567,15 +1567,15 @@ static struct {
{ 10, -1, A_right, -1, PIDS_NS_UTS }, // ul_int EU_NS6
{ 8, -1, A_left, -1, PIDS_LXCNAME }, // str EU_LXC
#ifndef NOBOOST_MEMS
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS_ANON }, // sl_int EU_RZA
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS_FILE }, // sl_int EU_RZF
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS_LOCKED }, // sl_int EU_RZL
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS_SHARED }, // sl_int EU_RZS
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS_ANON }, // ul_int EU_RZA
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS_FILE }, // ul_int EU_RZF
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS_LOCKED }, // ul_int EU_RZL
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS_SHARED }, // ul_int EU_RZS
#else
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS_ANON }, // sl_int EU_RZA
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS_FILE }, // sl_int EU_RZF
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS_LOCKED }, // sl_int EU_RZL
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS_SHARED }, // sl_int EU_RZS
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS_ANON }, // ul_int EU_RZA
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS_FILE }, // ul_int EU_RZF
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS_LOCKED }, // ul_int EU_RZL
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS_SHARED }, // ul_int EU_RZS
#endif
{ -1, -1, A_left, -1, PIDS_CGNAME }, // str EU_CGN
#define eu_LAST EU_CGN
@ -4895,10 +4895,16 @@ static const char *task_show (const WIN_t *q, struct pids_stack *p) {
cp = make_num(rSv(i, s_int), W, Jn, AUTOX_NO, 0);
break;
/* s_int, make_num without auto width, but with zero supression */
case EU_NCE:
case EU_OOA:
case EU_OOM:
cp = make_num(rSv(i, s_int), W, Jn, AUTOX_NO, 1);
break;
/* s_int, scale_num */
case EU_FV1:
case EU_FV2:
cp = scale_num(rSv(i, s_int), W, Jn);
break;
/* s_int, make_num or make_str */
case EU_PRI:
if (-99 > rSv(EU_PRI, s_int) || 999 < rSv(EU_PRI, s_int)) {
@ -4919,7 +4925,7 @@ static const char *task_show (const WIN_t *q, struct pids_stack *p) {
break;
/* u_int, scale_pcnt with special handling */
case EU_CPU:
{ float u = (float)rSv(EU_CPU, sl_int) * Frame_etscale;
{ float u = (float)rSv(EU_CPU, s_int) * Frame_etscale;
int n = rSv(EU_THD, s_int);
/* process can't use more %cpu than number of threads it has
( thanks Jaromir Capik <jcapik@redhat.com> ) */
@ -4928,10 +4934,6 @@ static const char *task_show (const WIN_t *q, struct pids_stack *p) {
cp = scale_pcnt(u, W, Jn);
}
break;
/* sl_int, make_num without auto width, but with zero supression */
case EU_NCE:
cp = make_num(rSv(EU_NCE, sl_int), W, Jn, AUTOX_NO, 1);
break;
/* ul_int, make_num with auto width and zero supression */
case EU_NS1:
case EU_NS2:
@ -4944,7 +4946,7 @@ static const char *task_show (const WIN_t *q, struct pids_stack *p) {
/* ul_int, scale_mem */
case EU_COD:
case EU_DAT:
case EU_DRT: // really # pgs & sl_int, but always zero since 2.6
case EU_DRT: // really # pgs, but always zero since 2.6
case EU_RES:
case EU_RZA:
case EU_RZF:
@ -4954,18 +4956,16 @@ static const char *task_show (const WIN_t *q, struct pids_stack *p) {
case EU_SWP:
case EU_USE:
case EU_VRT:
cp = scale_mem(S, rSv(i, sl_int), W, Jn);
cp = scale_mem(S, rSv(i, ul_int), W, Jn);
break;
/* ul_int, scale_num */
case EU_FL1:
case EU_FL2:
case EU_FV1:
case EU_FV2:
cp = scale_num(rSv(i, sl_int), W, Jn);
cp = scale_num(rSv(i, ul_int), W, Jn);
break;
/* ul_int, scale_pcnt */
case EU_MEM:
cp = scale_pcnt((float)rSv(EU_RES, sl_int) * 100 / MEM_VAL(mem_TOT), W, Jn);
cp = scale_pcnt((float)rSv(EU_RES, ul_int) * 100 / MEM_VAL(mem_TOT), W, Jn);
break;
/* ul_int, make_str with special handling */
case EU_FLG:
@ -5051,7 +5051,7 @@ static int window_show (WIN_t *q, int wmax) {
/* the isBUSY macro determines if a task is 'active' --
it returns true if some cpu was used since the last sample.
( actual 'running' tasks will be a subset of those selected ) */
#define isBUSY(x) (0 < PID_VAL(EU_CPU, u_int, x))
#define isBUSY(x) (0 < PID_VAL(EU_CPU, s_int, x))
#define winMIN(a,b) ((a < b) ? a : b)
int i, lwin;