|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T p
Length: 823 (0x337)
Types: TextFile
Names: »percentmem.c«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
└─⟦this⟧ »EUUGD11/euug-87hel/sec8/sps/percentmem.c«
# include "sps.h"
# include <h/text.h>
# ifdef BSD42
# include <machine/pte.h>
# else
# include <h/pte.h>
# include <h/vmparam.h>
# endif
# include <h/vmmac.h>
/* PERCENTMEM - Returns the percentage of real memory used by this process */
double percentmem ( p )
register struct process *p ;
{
register struct text *tp ;
int szptudot ;
double fracmem ;
extern struct info Info ;
tp = p->pr_p.p_textp ;
if ( !(p->pr_p.p_flag & SLOAD) || !tp )
return ( 0.0 ) ;
szptudot = UPAGES + clrnd( ctopt( p->pr_p.p_dsize + p->pr_p.p_ssize ) );
fracmem = ( (double)p->pr_p.p_rssize + szptudot ) / CLSIZE ;
if ( tp->x_ccount )
fracmem += ((double)tp->x_rssize)/CLSIZE/tp->x_ccount ;
return ( 100.0 * fracmem / (double)Info.i_ecmx ) ;
}