print.c (155876) | print.c (172207) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 20 unchanged lines hidden (view full) --- 29 30#if 0 31#ifndef lint 32static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; 33#endif /* not lint */ 34#endif 35 36#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 20 unchanged lines hidden (view full) --- 29 30#if 0 31#ifndef lint 32static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; 33#endif /* not lint */ 34#endif 35 36#include <sys/cdefs.h> |
37__FBSDID("$FreeBSD: head/bin/ps/print.c 155876 2006-02-21 13:02:18Z cognet $"); | 37__FBSDID("$FreeBSD: head/bin/ps/print.c 172207 2007-09-17 05:31:39Z jeff $"); |
38 39#include <sys/param.h> 40#include <sys/time.h> 41#include <sys/resource.h> 42#include <sys/proc.h> 43#include <sys/stat.h> 44 45#include <sys/mac.h> --- 146 unchanged lines hidden (view full) --- 192 193 v = ve->var; 194 (void)printf("%-*s", v->width, (s = k->ki_p->ki_login, *s) ? s : "-"); 195} 196 197void 198state(KINFO *k, VARENT *ve) 199{ | 38 39#include <sys/param.h> 40#include <sys/time.h> 41#include <sys/resource.h> 42#include <sys/proc.h> 43#include <sys/stat.h> 44 45#include <sys/mac.h> --- 146 unchanged lines hidden (view full) --- 192 193 v = ve->var; 194 (void)printf("%-*s", v->width, (s = k->ki_p->ki_login, *s) ? s : "-"); 195} 196 197void 198state(KINFO *k, VARENT *ve) 199{ |
200 int flag, sflag, tdflags; | 200 int flag, tdflags; |
201 char *cp; 202 VAR *v; 203 char buf[16]; 204 205 v = ve->var; 206 flag = k->ki_p->ki_flag; | 201 char *cp; 202 VAR *v; 203 char buf[16]; 204 205 v = ve->var; 206 flag = k->ki_p->ki_flag; |
207 sflag = k->ki_p->ki_sflag; | |
208 tdflags = k->ki_p->ki_tdflags; /* XXXKSE */ 209 cp = buf; 210 211 switch (k->ki_p->ki_stat) { 212 213 case SSTOP: 214 *cp = 'T'; 215 break; --- 21 unchanged lines hidden (view full) --- 237 case SZOMB: 238 *cp = 'Z'; 239 break; 240 241 default: 242 *cp = '?'; 243 } 244 cp++; | 207 tdflags = k->ki_p->ki_tdflags; /* XXXKSE */ 208 cp = buf; 209 210 switch (k->ki_p->ki_stat) { 211 212 case SSTOP: 213 *cp = 'T'; 214 break; --- 21 unchanged lines hidden (view full) --- 236 case SZOMB: 237 *cp = 'Z'; 238 break; 239 240 default: 241 *cp = '?'; 242 } 243 cp++; |
245 if (!(sflag & PS_INMEM)) | 244 if (!(flag & P_INMEM)) |
246 *cp++ = 'W'; 247 if (k->ki_p->ki_nice < NZERO) 248 *cp++ = '<'; 249 else if (k->ki_p->ki_nice > NZERO) 250 *cp++ = 'N'; 251 if (flag & P_TRACED) 252 *cp++ = 'X'; 253 if (flag & P_WEXIT && k->ki_p->ki_stat != SZOMB) --- 332 unchanged lines hidden (view full) --- 586 if (!nlistread) 587 failure = donlist(); 588 if (failure) 589 return (0.0); 590 591#define fxtofl(fixpt) ((double)(fixpt) / fscale) 592 593 /* XXX - I don't like this */ | 245 *cp++ = 'W'; 246 if (k->ki_p->ki_nice < NZERO) 247 *cp++ = '<'; 248 else if (k->ki_p->ki_nice > NZERO) 249 *cp++ = 'N'; 250 if (flag & P_TRACED) 251 *cp++ = 'X'; 252 if (flag & P_WEXIT && k->ki_p->ki_stat != SZOMB) --- 332 unchanged lines hidden (view full) --- 585 if (!nlistread) 586 failure = donlist(); 587 if (failure) 588 return (0.0); 589 590#define fxtofl(fixpt) ((double)(fixpt) / fscale) 591 592 /* XXX - I don't like this */ |
594 if (k->ki_p->ki_swtime == 0 || (k->ki_p->ki_sflag & PS_INMEM) == 0) | 593 if (k->ki_p->ki_swtime == 0 || (k->ki_p->ki_flag & P_INMEM) == 0) |
595 return (0.0); 596 if (rawcpu) 597 return (100.0 * fxtofl(k->ki_p->ki_pctcpu)); 598 return (100.0 * fxtofl(k->ki_p->ki_pctcpu) / 599 (1.0 - exp(k->ki_p->ki_swtime * log(fxtofl(ccpu))))); 600} 601 602void --- 11 unchanged lines hidden (view full) --- 614 static int failure; 615 double fracmem; 616 617 if (!nlistread) 618 failure = donlist(); 619 if (failure) 620 return (0.0); 621 | 594 return (0.0); 595 if (rawcpu) 596 return (100.0 * fxtofl(k->ki_p->ki_pctcpu)); 597 return (100.0 * fxtofl(k->ki_p->ki_pctcpu) / 598 (1.0 - exp(k->ki_p->ki_swtime * log(fxtofl(ccpu))))); 599} 600 601void --- 11 unchanged lines hidden (view full) --- 613 static int failure; 614 double fracmem; 615 616 if (!nlistread) 617 failure = donlist(); 618 if (failure) 619 return (0.0); 620 |
622 if ((k->ki_p->ki_sflag & PS_INMEM) == 0) | 621 if ((k->ki_p->ki_flag & P_INMEM) == 0) |
623 return (0.0); 624 /* XXX want pmap ptpages, segtab, etc. (per architecture) */ 625 /* XXX don't have info about shared */ 626 fracmem = ((float)k->ki_p->ki_rssize) / mempages; 627 return (100.0 * fracmem); 628} 629 630void --- 196 unchanged lines hidden --- | 622 return (0.0); 623 /* XXX want pmap ptpages, segtab, etc. (per architecture) */ 624 /* XXX don't have info about shared */ 625 fracmem = ((float)k->ki_p->ki_rssize) / mempages; 626 return (100.0 * fracmem); 627} 628 629void --- 196 unchanged lines hidden --- |