devstat.h (50476) | devstat.h (81133) |
---|---|
1/* 2 * Copyright (c) 1997, 1998 Kenneth D. Merry. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * | 1/* 2 * Copyright (c) 1997, 1998 Kenneth D. Merry. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/lib/libdevstat/devstat.h 50476 1999-08-28 00:22:10Z peter $ | 28 * $FreeBSD: head/lib/libdevstat/devstat.h 81133 2001-08-04 18:25:48Z tmm $ |
29 */ 30 31#ifndef _DEVSTAT_H 32#define _DEVSTAT_H 33#include <sys/cdefs.h> 34#include <sys/devicestat.h> 35 | 29 */ 30 31#ifndef _DEVSTAT_H 32#define _DEVSTAT_H 33#include <sys/cdefs.h> 34#include <sys/devicestat.h> 35 |
36#include <kvm.h> 37 |
|
36#define DEVSTAT_ERRBUF_SIZE 2048 /* size of the devstat library error string */ 37 38extern char devstat_errbuf[]; 39 40typedef enum { 41 DEVSTAT_MATCH_NONE = 0x00, 42 DEVSTAT_MATCH_TYPE = 0x01, 43 DEVSTAT_MATCH_IF = 0x02, 44 DEVSTAT_MATCH_PASS = 0x04 45} devstat_match_flags; 46 | 38#define DEVSTAT_ERRBUF_SIZE 2048 /* size of the devstat library error string */ 39 40extern char devstat_errbuf[]; 41 42typedef enum { 43 DEVSTAT_MATCH_NONE = 0x00, 44 DEVSTAT_MATCH_TYPE = 0x01, 45 DEVSTAT_MATCH_IF = 0x02, 46 DEVSTAT_MATCH_PASS = 0x04 47} devstat_match_flags; 48 |
49typedef enum { 50 DSM_NONE, 51 DSM_TOTAL_BYTES, 52 DSM_TOTAL_BYTES_READ, 53 DSM_TOTAL_BYTES_WRITE, 54 DSM_TOTAL_TRANSFERS, 55 DSM_TOTAL_TRANSFERS_READ, 56 DSM_TOTAL_TRANSFERS_WRITE, 57 DSM_TOTAL_TRANSFERS_OTHER, 58 DSM_TOTAL_BLOCKS, 59 DSM_TOTAL_BLOCKS_READ, 60 DSM_TOTAL_BLOCKS_WRITE, 61 DSM_KB_PER_TRANSFER, 62 DSM_KB_PER_TRANSFER_READ, 63 DSM_KB_PER_TRANSFER_WRITE, 64 DSM_TRANSFERS_PER_SECOND, 65 DSM_TRANSFERS_PER_SECOND_READ, 66 DSM_TRANSFERS_PER_SECOND_WRITE, 67 DSM_TRANSFERS_PER_SECOND_OTHER, 68 DSM_MB_PER_SECOND, 69 DSM_MB_PER_SECOND_READ, 70 DSM_MB_PER_SECOND_WRITE, 71 DSM_BLOCKS_PER_SECOND, 72 DSM_BLOCKS_PER_SECOND_READ, 73 DSM_BLOCKS_PER_SECOND_WRITE, 74 DSM_MS_PER_TRANSACTION, 75 DSM_MS_PER_TRANSACTION_READ, 76 DSM_MS_PER_TRANSACTION_WRITE, 77 DSM_MAX 78} devstat_metric; 79 |
|
47struct devstat_match { 48 devstat_match_flags match_fields; 49 devstat_type_flags device_type; 50 int num_match_categories; 51}; 52 53struct devstat_match_table { 54 char *match_str; --- 28 unchanged lines hidden (view full) --- 83typedef enum { 84 DS_SELECT_ADD, 85 DS_SELECT_ONLY, 86 DS_SELECT_REMOVE, 87 DS_SELECT_ADDONLY 88} devstat_select_mode; 89 90__BEGIN_DECLS | 80struct devstat_match { 81 devstat_match_flags match_fields; 82 devstat_type_flags device_type; 83 int num_match_categories; 84}; 85 86struct devstat_match_table { 87 char *match_str; --- 28 unchanged lines hidden (view full) --- 116typedef enum { 117 DS_SELECT_ADD, 118 DS_SELECT_ONLY, 119 DS_SELECT_REMOVE, 120 DS_SELECT_ADDONLY 121} devstat_select_mode; 122 123__BEGIN_DECLS |
124/* Legacy interfaces. */ |
|
91int getnumdevs(void); 92long getgeneration(void); 93int getversion(void); 94int checkversion(void); 95int getdevs(struct statinfo *stats); 96int selectdevs(struct device_selection **dev_select, int *num_selected, 97 int *num_selections, long *select_generation, 98 long current_generation, struct devstat *devices, int numdevs, --- 6 unchanged lines hidden (view full) --- 105int compute_stats(struct devstat *current, struct devstat *previous, 106 long double etime, u_int64_t *total_bytes, 107 u_int64_t *total_transfers, u_int64_t *total_blocks, 108 long double *kb_per_transfer, 109 long double *transfers_per_second, long double *mb_per_second, 110 long double *blocks_per_second, 111 long double *ms_per_transaction); 112long double compute_etime(struct timeval cur_time, struct timeval prev_time); | 125int getnumdevs(void); 126long getgeneration(void); 127int getversion(void); 128int checkversion(void); 129int getdevs(struct statinfo *stats); 130int selectdevs(struct device_selection **dev_select, int *num_selected, 131 int *num_selections, long *select_generation, 132 long current_generation, struct devstat *devices, int numdevs, --- 6 unchanged lines hidden (view full) --- 139int compute_stats(struct devstat *current, struct devstat *previous, 140 long double etime, u_int64_t *total_bytes, 141 u_int64_t *total_transfers, u_int64_t *total_blocks, 142 long double *kb_per_transfer, 143 long double *transfers_per_second, long double *mb_per_second, 144 long double *blocks_per_second, 145 long double *ms_per_transaction); 146long double compute_etime(struct timeval cur_time, struct timeval prev_time); |
147 148/* New interfaces. */ 149int devstat_getnumdevs(kvm_t *kd); 150long devstat_getgeneration(kvm_t *kd); 151int devstat_getversion(kvm_t *kd); 152int devstat_checkversion(kvm_t *kd); 153int devstat_getdevs(kvm_t *kd, struct statinfo *stats); 154int devstat_selectdevs(struct device_selection **dev_select, int *num_selected, 155 int *num_selections, long *select_generation, 156 long current_generation, struct devstat *devices, 157 int numdevs, struct devstat_match *matches, 158 int num_matches, char **dev_selections, 159 int num_dev_selections, devstat_select_mode select_mode, 160 int maxshowdevs, int perf_select); 161int devstat_buildmatch(char *match_str, struct devstat_match **matches, 162 int *num_matches); 163int devstat_compute_statistics(struct devstat *current, 164 struct devstat *previous, 165 long double etime, ...); 166long double devstat_compute_etime(struct timeval cur_time, 167 struct timeval prev_time); |
|
113__END_DECLS 114 115#endif /* _DEVSTAT_H */ | 168__END_DECLS 169 170#endif /* _DEVSTAT_H */ |