xref: /titanic_41/usr/src/cmd/avs/dsstat/sdbc_stats.h (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SDBC_STATS_H
27 #define	_SDBC_STATS_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 /*
34  * Internal flags to denote data collection status
35  */
36 #define	GOT_SET_KSTAT	0x01
37 #define	GOT_IO_KSTAT	0x02
38 #define	GOT_COMPLETE_SDBC	(GOT_SET_KSTAT | GOT_IO_KSTAT)
39 
40 #define	SDBC_COMPLETE(x)	(((x) & (GOT_COMPLETE_SDBC)) != \
41 				    (GOT_COMPLETE_SDBC))
42 
43 #define	SDBC_KBYTES	0x01
44 #define	SDBC_INTAVG	0x02
45 
46 #define	KILOBYTE	1024
47 
48 typedef struct sdbcstat_s
49 {
50 	kstat_t			*pre_set;
51 	kstat_t			*pre_io;
52 	kstat_t			*cur_set;
53 	kstat_t			*cur_io;
54 	int			collected;
55 	struct sdbcstat_s	*next;
56 } sdbcstat_t;
57 
58 typedef struct sdbcvals_t
59 {
60 	uint32_t	cache_read;
61 	uint32_t	cache_write;
62 	uint32_t	total_cache;
63 
64 	float		cache_hit;
65 	float		read_hit;
66 	float		write_hit;
67 
68 	uint32_t	disk_read;
69 	uint32_t	disk_write;
70 	uint32_t	total_disk;
71 
72 	uint32_t	destaged;
73 	uint32_t	write_cancellations;
74 
75 	uint32_t	total_reads;
76 	uint32_t	total_writes;
77 } sdbcvals_t;
78 
79 extern kstat_t *sdbc_global;
80 
81 /* Prototypes */
82 int sdbc_discover(kstat_ctl_t *);
83 int sdbc_update(kstat_ctl_t *);
84 int sdbc_report();
85 sdbcstat_t *sdbc_getstat(char *);
86 int sdbc_getvalues(sdbcstat_t *, sdbcvals_t *, int);
87 
88 #ifdef	__cplusplus
89 }
90 #endif
91 
92 #endif /* _SDBC_STATS_H */
93