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