Home | History | Annotate | Line # | Download | only in vmstat
drvstats.h revision 1.5.6.1
      1  1.5.6.1    martin /*	$NetBSD: drvstats.h,v 1.5.6.1 2020/04/13 08:05:49 martin Exp $	*/
      2      1.1     blymn 
      3      1.1     blymn /*
      4      1.1     blymn  * Copyright (c) 1996 John M. Vinopal
      5      1.1     blymn  * All rights reserved.
      6      1.1     blymn  *
      7      1.1     blymn  * Redistribution and use in source and binary forms, with or without
      8      1.1     blymn  * modification, are permitted provided that the following conditions
      9      1.1     blymn  * are met:
     10      1.1     blymn  * 1. Redistributions of source code must retain the above copyright
     11      1.1     blymn  *    notice, this list of conditions and the following disclaimer.
     12      1.1     blymn  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1     blymn  *    notice, this list of conditions and the following disclaimer in the
     14      1.1     blymn  *    documentation and/or other materials provided with the distribution.
     15      1.1     blymn  * 3. All advertising materials mentioning features or use of this software
     16      1.1     blymn  *    must display the following acknowledgement:
     17      1.1     blymn  *      This product includes software developed for the NetBSD Project
     18      1.1     blymn  *      by John M. Vinopal.
     19      1.1     blymn  * 4. The name of the author may not be used to endorse or promote products
     20      1.1     blymn  *    derived from this software without specific prior written permission.
     21      1.1     blymn  *
     22      1.1     blymn  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23      1.1     blymn  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24      1.1     blymn  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25      1.1     blymn  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     26      1.1     blymn  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     27      1.1     blymn  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     28      1.1     blymn  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     29      1.1     blymn  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     30      1.1     blymn  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31      1.1     blymn  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32      1.1     blymn  * SUCH DAMAGE.
     33      1.1     blymn  */
     34      1.1     blymn 
     35      1.1     blymn #include <sys/time.h>
     36      1.1     blymn #include <sys/sched.h>
     37      1.1     blymn #include <unistd.h>
     38      1.1     blymn 
     39      1.1     blymn /* poseur disk entry to hold the information we're interested in. */
     40      1.1     blymn struct _drive {
     41      1.1     blymn 	int		 *select;	/* Display stats for selected disks. */
     42      1.5   mlelstv 	char		 **name;	/* Disk names (sd0, wd1, etc). */
     43      1.1     blymn 	u_int64_t	 *rxfer;	/* # of read transfers. */
     44      1.1     blymn 	u_int64_t	 *wxfer;	/* # of write transfers. */
     45      1.1     blymn 	u_int64_t	 *seek;	/* # of seeks (currently unused). */
     46      1.1     blymn 	u_int64_t	 *rbytes;	/* # of bytes read. */
     47      1.1     blymn 	u_int64_t	 *wbytes;	/* # of bytes written. */
     48  1.5.6.1    martin 	int		 *scale;	/* Sticky scale for bytes */
     49      1.4   mlelstv 	struct timeval	 *time;		/* Time spent in disk i/o. */
     50      1.4   mlelstv 	struct timeval	 *wait;		/* Time spent in queue waiting. */
     51      1.5   mlelstv 	struct timeval	 *busysum;	/* Time busy * queue length */
     52      1.5   mlelstv 	struct timeval	 *waitsum;	/* Time waiting * queue length */
     53      1.5   mlelstv 	struct timeval	 *timestamp;	/* Disk sample time */
     54      1.1     blymn 	u_int64_t	  tk_nin;	/* TTY Chars in. */
     55      1.1     blymn 	u_int64_t	  tk_nout;	/* TTY Chars out. */
     56      1.1     blymn 	u_int64_t	  cp_time[CPUSTATES];	/* System timer ticks. */
     57      1.1     blymn 	int	 	  cp_ncpu;		/* Number of cpu's */
     58      1.1     blymn 	double		  cp_etime;		/* Elapsed time */
     59      1.1     blymn };
     60      1.1     blymn 
     61      1.1     blymn extern struct _drive	cur;
     62      1.1     blymn extern char		**dr_name;
     63      1.3  christos extern int		*drv_select;
     64      1.3  christos extern size_t		ndrive;
     65      1.1     blymn 
     66      1.1     blymn int	drvinit(int);
     67      1.1     blymn void	cpureadstats(void);
     68      1.1     blymn void	drvreadstats(void);
     69      1.1     blymn void	tkreadstats(void);
     70      1.1     blymn void	cpuswap(void);
     71      1.1     blymn void	drvswap(void);
     72      1.1     blymn void	tkswap(void);
     73