xref: /illumos-gate/usr/src/cmd/sa/sa.h (revision 7a6d80f1660abd4755c68cbd094d4a914681d26e)
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 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
22 /*	  All Rights Reserved  	*/
23 
24 
25 /*
26  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
28  */
29 
30 #ifndef _SA_H
31 #define	_SA_H
32 
33 /*
34  * sa.h contains struct sa and defines variables used in sadc.c and sar.c.
35  * RESTRICTION: the data types defined in this file must not be changed.
36  * sar writes these types to disk as binary data and to ensure version to
37  * version compatibility they must not be changed.
38  */
39 
40 #include <sys/kstat.h>
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 typedef struct iodevinfo {
47 	struct iodevinfo *next;
48 	kstat_t *ksp;
49 	kstat_t ks;
50 	kstat_io_t kios;
51 } iodevinfo_t;
52 
53 #define	KMEM_SMALL  0		/* small KMEM request index		*/
54 #define	KMEM_LARGE  1		/* large KMEM request index		*/
55 #define	KMEM_OSIZE  2		/* outsize KMEM request index		*/
56 #define	KMEM_NCLASS 3		/* # of KMEM request classes		*/
57 
58 typedef struct kmeminfo {
59 	ulong_t	km_mem[KMEM_NCLASS];	/* amount of mem owned by KMEM	*/
60 	ulong_t	km_alloc[KMEM_NCLASS];  /* amount of mem allocated	*/
61 	ulong_t	km_fail[KMEM_NCLASS];	/* # of failed requests		*/
62 } kmeminfo_t;
63 
64 /*
65  * structure sa defines the data structure of system activity data file
66  */
67 
68 struct sa {
69 	int		valid;		/* non-zero for valid data	*/
70 	time_t		ts;		/* time stamp			*/
71 
72 	cpu_sysinfo_t	csi;		/* per-CPU system information	*/
73 	cpu_vminfo_t	cvmi;		/* per-CPU vm information	*/
74 	sysinfo_t	si;		/* global system information	*/
75 	vminfo_t	vmi;		/* global vm information	*/
76 	kmeminfo_t	kmi;		/* kernel mem allocation info	*/
77 
78 	ulong_t		szinode;	/* inode table size		*/
79 	ulong_t		szfile;		/* file table size		*/
80 	ulong_t		szproc;		/* proc table size		*/
81 	ulong_t		szlckr;		/* file record lock table size	*/
82 
83 	ulong_t		mszinode;	/* max inode table size		*/
84 	ulong_t		mszfile;	/* max file table size		*/
85 	ulong_t		mszproc;	/* max proc table size		*/
86 	ulong_t		mszlckr;	/* max file rec lock table size	*/
87 
88 	ulong_t	niodevs;		/* number of I/O devices	*/
89 
90 	/* An array of iodevinfo structs come next in the sadc files	*/
91 };
92 
93 typedef struct cpu64_sysinfo {
94 	uint64_t	cpu[CPU_STATES];
95 	uint64_t	wait[W_STATES];
96 	uint64_t	bread;
97 	uint64_t	bwrite;
98 	uint64_t	lread;
99 	uint64_t	lwrite;
100 	uint64_t	phread;
101 	uint64_t	phwrite;
102 	uint64_t	pswitch;
103 	uint64_t	trap;
104 	uint64_t	intr;
105 	uint64_t	syscall;
106 	uint64_t	sysread;
107 	uint64_t	syswrite;
108 	uint64_t	sysfork;
109 	uint64_t	sysvfork;
110 	uint64_t	sysexec;
111 	uint64_t	readch;
112 	uint64_t	writech;
113 	uint64_t	rcvint;
114 	uint64_t	xmtint;
115 	uint64_t	mdmint;
116 	uint64_t	rawch;
117 	uint64_t	canch;
118 	uint64_t	outch;
119 	uint64_t	msg;
120 	uint64_t	sema;
121 	uint64_t	namei;
122 	uint64_t	ufsiget;
123 	uint64_t	ufsdirblk;
124 	uint64_t	ufsipage;
125 	uint64_t	ufsinopage;
126 	uint64_t	inodeovf;
127 	uint64_t	fileovf;
128 	uint64_t	procovf;
129 	uint64_t	intrthread;
130 	uint64_t	intrblk;
131 	uint64_t	idlethread;
132 	uint64_t	inv_swtch;
133 	uint64_t	nthreads;
134 	uint64_t	cpumigrate;
135 	uint64_t	xcalls;
136 	uint64_t	mutex_adenters;
137 	uint64_t	rw_rdfails;
138 	uint64_t	rw_wrfails;
139 	uint64_t	modload;
140 	uint64_t	modunload;
141 	uint64_t	bawrite;
142 	uint64_t	rw_enters;
143 	uint64_t	win_uo_cnt;
144 	uint64_t	win_uu_cnt;
145 	uint64_t	win_so_cnt;
146 	uint64_t	win_su_cnt;
147 	uint64_t	win_suo_cnt;
148 } cpu64_sysinfo_t;
149 
150 typedef struct cpu64_vminfo {
151 	uint64_t	pgrec;
152 	uint64_t	pgfrec;
153 	uint64_t	pgin;
154 	uint64_t	pgpgin;
155 	uint64_t	pgout;
156 	uint64_t	pgpgout;
157 	uint64_t	swapin;
158 	uint64_t	pgswapin;
159 	uint64_t	swapout;
160 	uint64_t	pgswapout;
161 	uint64_t	zfod;
162 	uint64_t	dfree;
163 	uint64_t	scan;
164 	uint64_t	rev;
165 	uint64_t	hat_fault;
166 	uint64_t	as_fault;
167 	uint64_t	maj_fault;
168 	uint64_t	cow_fault;
169 	uint64_t	prot_fault;
170 	uint64_t	softlock;
171 	uint64_t	kernel_asflt;
172 	uint64_t	pgrrun;
173 	uint64_t	execpgin;
174 	uint64_t	execpgout;
175 	uint64_t	execfree;
176 	uint64_t	anonpgin;
177 	uint64_t	anonpgout;
178 	uint64_t	anonfree;
179 	uint64_t	fspgin;
180 	uint64_t	fspgout;
181 	uint64_t	fsfree;
182 } cpu64_vminfo_t;
183 
184 typedef struct sysinfo64 {
185 	uint64_t	updates;
186 	uint64_t	runque;
187 	uint64_t	runocc;
188 	uint64_t	swpque;
189 	uint64_t	swpocc;
190 	uint64_t	waiting;
191 } sysinfo64_t;
192 
193 struct sa64 {
194 	int		valid;
195 	time_t		ts;
196 
197 	cpu64_sysinfo_t	csi;
198 	cpu64_vminfo_t	cvmi;
199 	sysinfo64_t	si;
200 	vminfo_t	vmi;
201 	kmeminfo_t	kmi;
202 
203 	ulong_t		szinode;
204 	ulong_t		szfile;
205 	ulong_t		szproc;
206 	ulong_t		szlckr;
207 
208 	ulong_t		mszinode;
209 	ulong_t		mszfile;
210 	ulong_t		mszproc;
211 	ulong_t		mszlckr;
212 
213 	ulong_t	niodevs;
214 };
215 
216 extern struct sa sa;
217 
218 #ifdef	__cplusplus
219 }
220 #endif
221 
222 #endif /* _SA_H */
223