1 /* $NetBSD: iostat.h,v 1.10 2009/04/04 07:30:09 ad Exp $ */
4 * Copyright (c) 1996, 1997, 2004, 2009 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
33 #ifndef _SYS_IOSTAT_H_
34 #define _SYS_IOSTAT_H_
37 * Disk device structures.
41 #include <sys/queue.h>
43 #define IOSTATNAMELEN 16
45 /* types of drives we can have */
50 /* The following structure is 64-bit alignment safe */
52 char name
[IOSTATNAMELEN
];
58 u_int32_t attachtime_sec
;
59 u_int32_t attachtime_usec
;
60 u_int32_t timestamp_sec
;
61 u_int32_t timestamp_usec
;
64 /* New separate read/write stats */
72 * Structure for keeping the in-kernel drive stats - these are linked
73 * together in drivelist.
77 char io_name
[IOSTATNAMELEN
]; /* device name */
78 void *io_parent
; /* pointer to what we are attached to */
79 int io_type
; /* type of device the state belong to */
80 int io_busy
; /* busy counter */
81 u_int64_t io_rxfer
; /* total number of read transfers */
82 u_int64_t io_wxfer
; /* total number of write transfers */
83 u_int64_t io_seek
; /* total independent seek operations */
84 u_int64_t io_rbytes
; /* total bytes read */
85 u_int64_t io_wbytes
; /* total bytes written */
86 struct timeval io_attachtime
; /* time disk was attached */
87 struct timeval io_timestamp
; /* timestamp of last unbusy */
88 struct timeval io_time
; /* total time spent busy */
89 TAILQ_ENTRY(io_stats
) io_link
;
93 * drivelist_head is defined here so that user-land has access to it.
95 TAILQ_HEAD(iostatlist_head
, io_stats
); /* the iostatlist is a TAILQ */
98 void iostat_init(void);
99 void iostat_busy(struct io_stats
*);
100 void iostat_unbusy(struct io_stats
*, long, int);
101 bool iostat_isbusy(struct io_stats
*);
102 struct io_stats
*iostat_find(const char *);
103 struct io_stats
*iostat_alloc(int32_t, void *, const char *);
104 void iostat_free(struct io_stats
*);
105 void iostat_seek(struct io_stats
*);
108 #endif /* _SYS_IOSTAT_H_ */