xref: /netbsd/usr.bin/vmstat/drvstats.h (revision 961b3cc4)
1*961b3cc4She /*	$NetBSD: drvstats.h,v 1.6 2019/06/30 19:57:24 he Exp $	*/
27d866d26Sblymn 
37d866d26Sblymn /*
47d866d26Sblymn  * Copyright (c) 1996 John M. Vinopal
57d866d26Sblymn  * All rights reserved.
67d866d26Sblymn  *
77d866d26Sblymn  * Redistribution and use in source and binary forms, with or without
87d866d26Sblymn  * modification, are permitted provided that the following conditions
97d866d26Sblymn  * are met:
107d866d26Sblymn  * 1. Redistributions of source code must retain the above copyright
117d866d26Sblymn  *    notice, this list of conditions and the following disclaimer.
127d866d26Sblymn  * 2. Redistributions in binary form must reproduce the above copyright
137d866d26Sblymn  *    notice, this list of conditions and the following disclaimer in the
147d866d26Sblymn  *    documentation and/or other materials provided with the distribution.
157d866d26Sblymn  * 3. All advertising materials mentioning features or use of this software
167d866d26Sblymn  *    must display the following acknowledgement:
177d866d26Sblymn  *      This product includes software developed for the NetBSD Project
187d866d26Sblymn  *      by John M. Vinopal.
197d866d26Sblymn  * 4. The name of the author may not be used to endorse or promote products
207d866d26Sblymn  *    derived from this software without specific prior written permission.
217d866d26Sblymn  *
227d866d26Sblymn  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
237d866d26Sblymn  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
247d866d26Sblymn  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
257d866d26Sblymn  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
267d866d26Sblymn  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
277d866d26Sblymn  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
287d866d26Sblymn  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
297d866d26Sblymn  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
307d866d26Sblymn  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
317d866d26Sblymn  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
327d866d26Sblymn  * SUCH DAMAGE.
337d866d26Sblymn  */
347d866d26Sblymn 
357d866d26Sblymn #include <sys/time.h>
367d866d26Sblymn #include <sys/sched.h>
377d866d26Sblymn #include <unistd.h>
387d866d26Sblymn 
397d866d26Sblymn /* poseur disk entry to hold the information we're interested in. */
407d866d26Sblymn struct _drive {
417d866d26Sblymn 	int		 *select;	/* Display stats for selected disks. */
427d866d26Sblymn 	char		 **name;	/* Disk names (sd0, wd1, etc). */
437d866d26Sblymn 	u_int64_t	 *rxfer;	/* # of read transfers. */
447d866d26Sblymn 	u_int64_t	 *wxfer;	/* # of write transfers. */
457d866d26Sblymn 	u_int64_t	 *seek;	/* # of seeks (currently unused). */
467d866d26Sblymn 	u_int64_t	 *rbytes;	/* # of bytes read. */
477d866d26Sblymn 	u_int64_t	 *wbytes;	/* # of bytes written. */
48*961b3cc4She 	int		 *scale;	/* Sticky scale for bytes */
497d866d26Sblymn 	struct timeval	 *time;		/* Time spent in disk i/o. */
50d3b106f0Smlelstv 	struct timeval	 *wait;		/* Time spent in queue waiting. */
51d3b106f0Smlelstv 	struct timeval	 *busysum;	/* Time busy * queue length */
52d3b106f0Smlelstv 	struct timeval	 *waitsum;	/* Time waiting * queue length */
530b1cb418Smlelstv 	struct timeval	 *timestamp;	/* Disk sample time */
547d866d26Sblymn 	u_int64_t	  tk_nin;	/* TTY Chars in. */
557d866d26Sblymn 	u_int64_t	  tk_nout;	/* TTY Chars out. */
567d866d26Sblymn 	u_int64_t	  cp_time[CPUSTATES];	/* System timer ticks. */
577d866d26Sblymn 	int	 	  cp_ncpu;		/* Number of cpu's */
587d866d26Sblymn 	double		  cp_etime;		/* Elapsed time */
597d866d26Sblymn };
607d866d26Sblymn 
617d866d26Sblymn extern struct _drive	cur;
627d866d26Sblymn extern char		**dr_name;
633ceb6c1cSchristos extern int		*drv_select;
643ceb6c1cSchristos extern size_t		ndrive;
657d866d26Sblymn 
667d866d26Sblymn int	drvinit(int);
677d866d26Sblymn void	cpureadstats(void);
687d866d26Sblymn void	drvreadstats(void);
697d866d26Sblymn void	tkreadstats(void);
707d866d26Sblymn void	cpuswap(void);
717d866d26Sblymn void	drvswap(void);
727d866d26Sblymn void	tkswap(void);
73