/*	@(#)vmmeter.h	13.2 (RC International) 91/11/28	*/

/*
 * Virtual memory related instrumentation
 */
struct vmmeter
{
#define	v_first	v_swtch
	u_int	v_swtch;	/* context switches */
	u_int	v_tlbpid;	/* calls to new_tlbpid */
	u_int	v_trap;		/* calls to trap */
	u_int	v_syscall;	/* calls to syscall() */
	u_int	v_intr;		/* device interrupts */
	u_int	v_tlbmiss;	/* tlbmiss incl kernel tlbmiss, excl utlbmiss */
	u_int	v_ktlbmiss;	/* kernel tlbmiss, excl kpte window miss */
	u_int	v_pswpin;	/* pages swapped in */
	u_int	v_pswpout;	/* pages swapped out */
	u_int	v_pgin;		/* pageins */
	u_int	v_pgout;	/* pageouts */
	u_int	v_pgpgin;	/* pages paged in */
	u_int	v_pgpgout;	/* pages paged out */
	u_int	v_intrans;	/* intransit blocking page faults */
	u_int	v_pgrec;	/* total page reclaims */
	u_int	v_xsfrec;	/* found in free list rather than on swapdev */
	u_int	v_xifrec;	/* found in free list rather than in filsys */
	u_int	v_exfod;	/* pages filled on demand from executables */
	u_int	v_zfod;		/* pages zero filled on demand */
	u_int	v_shmzfod;	/* pages zero filled on demand for shm */
	u_int	v_nexfod;	/* number of exfod's created */
	u_int	v_nzfod;	/* number of zfod's created */
	u_int	v_nshmzfod;	/* number of shm zfod's created */
	u_int	v_pgfrec;	/* page reclaims from free list */
	u_int	v_faults;	/* total faults taken */
	u_int	v_scan;		/* scans in page out daemon */
	u_int	v_rev;		/* revolutions of the hand */
	u_int	v_seqfree;	/* pages taken from sequential programs */
	u_int	v_dfree;	/* pages freed by daemon */
#define	v_last	v_dfree		/* limit of addup loop in vmmeter() */
				/* swpin, swpout are handled specially */
	u_int	v_swpin;	/* swapins */
	u_int	v_swpout;	/* swapouts */
};

/* systemwide totals computed every five seconds */
struct vmtotal
{
	short	t_rq;		/* length of the run queue */
	short	t_dw;		/* jobs in ``disk wait'' (neg priority) */
	short	t_pw;		/* jobs in page wait */
	short	t_sl;		/* jobs sleeping in core */
	short	t_sw;		/* swapped out runnable/short block jobs */
	int	t_vm;		/* total virtual memory */
	int	t_avm;		/* active virtual memory */
	u_short	t_rm;		/* total real memory in use */
	u_short	t_arm;		/* active real memory */
	int	t_vmtxt;	/* virtual memory used by text */
	int	t_avmtxt;	/* active virtual memory used by text */
	u_short	t_rmtxt;	/* real memory used by text */
	u_short	t_armtxt;	/* active real memory used by text */
	u_short	t_free;		/* free memory pages */
			/* System V shared memory totals */
	int	t_vmshm;	/* virtual memory used by shm */
	int	t_avmshm;	/* active virtual memory used by shm */
	u_short	t_rmshm;	/* real memory used by shm */
	u_short	t_armshm;	/* active real memory used by shm */
};
#ifdef UPU
struct	vmtotal total;
#endif UPU

/*
 * Optional instrumentation.
 */
#ifdef PGINPROF

#define	NDMON	128
#define	NSMON	128

#define	DRES	20
#define	SRES	5

#define	PMONMIN	20
#define	PRES	50
#define	NPMON	64

#define	RMONMIN	130
#define	RRES	5
#define	NRMON	64

/* data and stack size distribution counters */
unsigned int	dmon[NDMON+1];
unsigned int	smon[NSMON+1];

/* page in time distribution counters */
unsigned int	pmon[NPMON+2];

/* reclaim time distribution counters */
unsigned int	rmon[NRMON+2];

int	pmonmin;
int	pres;
int	rmonmin;
int	rres;

unsigned int	rectime;	/* accumulator for reclaim times */
unsigned int	pgintime;	/* accumulator for page in times */
#endif PGINPROF

/*
 * miscellanous physical memory usage, not obviously accounted for
 * in other structures.
 */
struct miscmem {
	u_short	misc_wmem;	/* # pages of zmemall'ed/ wmemall'ed memory */
	u_short	misc_pmem;	/* # pages of pmemall'ed memory*/
	u_short	misc_umem;	/* # pages of u-area memory */
	u_short	misc_ptemem;	/* # pages of page table memory */
};

/*
 * GROT XXXX BLECH YEECH
 *
 * Temporary structure pointed to by txinfo which points to all
 * data required by vmstat program.
 */

struct vmstat_info
{
    unsigned int	    *vmi_firstfree;
    unsigned int	    *vmi_maxfree;
    int			    *vmi_freemem;
    int			    *vmi_deficit;
    long		    *vmi_time;
    struct vmmeter	    *vmi_rate;
    struct vmtotal	    *vmi_total;
    struct vmmeter	    *vmi_sum;
    struct forkstat	    *vmi_forkstat;
    unsigned int	    *vmi_rectime;
    unsigned int	    *vmi_pgintime;
    struct miscmem	    *vmi_totmisc;
    struct swp_voliostat    *vmi_swpvoliostat;
    struct timeval	    *vmi_boottime;
    short		    *vmi_hz;	
    struct disk_drive	    **vmi_diskinfo;
    struct disk_stats	    **vmi_diskstats;
    int			    **vmi_diskbusy;
};
#ifdef UPU
struct miscmem		totmisc;
struct vmstat_info	vmstat_info;
#ifndef PGINPROF
unsigned int		rectime;	/* accumulator for reclaim times */
unsigned int		pgintime;	/* accumulator for page in times */
#endif PGINPROF
#endif UPU
