xref: /illumos-gate/usr/src/cmd/sa/sa.h (revision 2a8bcb4e)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*b9b602f4Sjs  * Common Development and Distribution License (the "License").
6*b9b602f4Sjs  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
227c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
237c478bd9Sstevel@tonic-gate 
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate /*
26*b9b602f4Sjs  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
277c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _SA_H
317c478bd9Sstevel@tonic-gate #define	_SA_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate /*
347c478bd9Sstevel@tonic-gate  * sa.h contains struct sa and defines variables used in sadc.c and sar.c.
357c478bd9Sstevel@tonic-gate  * RESTRICTION: the data types defined in this file must not be changed.
367c478bd9Sstevel@tonic-gate  * sar writes these types to disk as binary data and to ensure version to
377c478bd9Sstevel@tonic-gate  * version compatibility they must not be changed.
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #include <sys/kstat.h>
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
437c478bd9Sstevel@tonic-gate extern "C" {
447c478bd9Sstevel@tonic-gate #endif
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate typedef struct iodevinfo {
477c478bd9Sstevel@tonic-gate 	struct iodevinfo *next;
487c478bd9Sstevel@tonic-gate 	kstat_t *ksp;
497c478bd9Sstevel@tonic-gate 	kstat_t ks;
507c478bd9Sstevel@tonic-gate 	kstat_io_t kios;
517c478bd9Sstevel@tonic-gate } iodevinfo_t;
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate #define	KMEM_SMALL  0		/* small KMEM request index		*/
547c478bd9Sstevel@tonic-gate #define	KMEM_LARGE  1		/* large KMEM request index		*/
557c478bd9Sstevel@tonic-gate #define	KMEM_OSIZE  2		/* outsize KMEM request index		*/
567c478bd9Sstevel@tonic-gate #define	KMEM_NCLASS 3		/* # of KMEM request classes		*/
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate typedef struct kmeminfo {
597c478bd9Sstevel@tonic-gate 	ulong_t	km_mem[KMEM_NCLASS];	/* amount of mem owned by KMEM	*/
607c478bd9Sstevel@tonic-gate 	ulong_t	km_alloc[KMEM_NCLASS];  /* amount of mem allocated	*/
617c478bd9Sstevel@tonic-gate 	ulong_t	km_fail[KMEM_NCLASS];	/* # of failed requests		*/
627c478bd9Sstevel@tonic-gate } kmeminfo_t;
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /*
657c478bd9Sstevel@tonic-gate  * structure sa defines the data structure of system activity data file
667c478bd9Sstevel@tonic-gate  */
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate struct sa {
697c478bd9Sstevel@tonic-gate 	int		valid;		/* non-zero for valid data	*/
707c478bd9Sstevel@tonic-gate 	time_t		ts;		/* time stamp			*/
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate 	cpu_sysinfo_t	csi;		/* per-CPU system information	*/
737c478bd9Sstevel@tonic-gate 	cpu_vminfo_t	cvmi;		/* per-CPU vm information	*/
747c478bd9Sstevel@tonic-gate 	sysinfo_t	si;		/* global system information	*/
757c478bd9Sstevel@tonic-gate 	vminfo_t	vmi;		/* global vm information	*/
767c478bd9Sstevel@tonic-gate 	kmeminfo_t	kmi;		/* kernel mem allocation info	*/
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate 	ulong_t		szinode;	/* inode table size		*/
797c478bd9Sstevel@tonic-gate 	ulong_t		szfile;		/* file table size		*/
807c478bd9Sstevel@tonic-gate 	ulong_t		szproc;		/* proc table size		*/
817c478bd9Sstevel@tonic-gate 	ulong_t		szlckr;		/* file record lock table size	*/
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate 	ulong_t		mszinode;	/* max inode table size		*/
847c478bd9Sstevel@tonic-gate 	ulong_t		mszfile;	/* max file table size		*/
857c478bd9Sstevel@tonic-gate 	ulong_t		mszproc;	/* max proc table size		*/
867c478bd9Sstevel@tonic-gate 	ulong_t		mszlckr;	/* max file rec lock table size	*/
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate 	ulong_t	niodevs;		/* number of I/O devices	*/
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate 	/* An array of iodevinfo structs come next in the sadc files	*/
917c478bd9Sstevel@tonic-gate };
927c478bd9Sstevel@tonic-gate 
93*b9b602f4Sjs typedef struct cpu64_sysinfo {
94*b9b602f4Sjs 	uint64_t	cpu[CPU_STATES];
95*b9b602f4Sjs 	uint64_t	wait[W_STATES];
96*b9b602f4Sjs 	uint64_t	bread;
97*b9b602f4Sjs 	uint64_t	bwrite;
98*b9b602f4Sjs 	uint64_t	lread;
99*b9b602f4Sjs 	uint64_t	lwrite;
100*b9b602f4Sjs 	uint64_t	phread;
101*b9b602f4Sjs 	uint64_t	phwrite;
102*b9b602f4Sjs 	uint64_t	pswitch;
103*b9b602f4Sjs 	uint64_t	trap;
104*b9b602f4Sjs 	uint64_t	intr;
105*b9b602f4Sjs 	uint64_t	syscall;
106*b9b602f4Sjs 	uint64_t	sysread;
107*b9b602f4Sjs 	uint64_t	syswrite;
108*b9b602f4Sjs 	uint64_t	sysfork;
109*b9b602f4Sjs 	uint64_t	sysvfork;
110*b9b602f4Sjs 	uint64_t	sysexec;
111*b9b602f4Sjs 	uint64_t	readch;
112*b9b602f4Sjs 	uint64_t	writech;
113*b9b602f4Sjs 	uint64_t	rcvint;
114*b9b602f4Sjs 	uint64_t	xmtint;
115*b9b602f4Sjs 	uint64_t	mdmint;
116*b9b602f4Sjs 	uint64_t	rawch;
117*b9b602f4Sjs 	uint64_t	canch;
118*b9b602f4Sjs 	uint64_t	outch;
119*b9b602f4Sjs 	uint64_t	msg;
120*b9b602f4Sjs 	uint64_t	sema;
121*b9b602f4Sjs 	uint64_t	namei;
122*b9b602f4Sjs 	uint64_t	ufsiget;
123*b9b602f4Sjs 	uint64_t	ufsdirblk;
124*b9b602f4Sjs 	uint64_t	ufsipage;
125*b9b602f4Sjs 	uint64_t	ufsinopage;
126*b9b602f4Sjs 	uint64_t	inodeovf;
127*b9b602f4Sjs 	uint64_t	fileovf;
128*b9b602f4Sjs 	uint64_t	procovf;
129*b9b602f4Sjs 	uint64_t	intrthread;
130*b9b602f4Sjs 	uint64_t	intrblk;
131*b9b602f4Sjs 	uint64_t	idlethread;
132*b9b602f4Sjs 	uint64_t	inv_swtch;
133*b9b602f4Sjs 	uint64_t	nthreads;
134*b9b602f4Sjs 	uint64_t	cpumigrate;
135*b9b602f4Sjs 	uint64_t	xcalls;
136*b9b602f4Sjs 	uint64_t	mutex_adenters;
137*b9b602f4Sjs 	uint64_t	rw_rdfails;
138*b9b602f4Sjs 	uint64_t	rw_wrfails;
139*b9b602f4Sjs 	uint64_t	modload;
140*b9b602f4Sjs 	uint64_t	modunload;
141*b9b602f4Sjs 	uint64_t	bawrite;
142*b9b602f4Sjs 	uint64_t	rw_enters;
143*b9b602f4Sjs 	uint64_t	win_uo_cnt;
144*b9b602f4Sjs 	uint64_t	win_uu_cnt;
145*b9b602f4Sjs 	uint64_t	win_so_cnt;
146*b9b602f4Sjs 	uint64_t	win_su_cnt;
147*b9b602f4Sjs 	uint64_t	win_suo_cnt;
148*b9b602f4Sjs } cpu64_sysinfo_t;
149*b9b602f4Sjs 
150*b9b602f4Sjs typedef struct cpu64_vminfo {
151*b9b602f4Sjs 	uint64_t	pgrec;
152*b9b602f4Sjs 	uint64_t	pgfrec;
153*b9b602f4Sjs 	uint64_t	pgin;
154*b9b602f4Sjs 	uint64_t	pgpgin;
155*b9b602f4Sjs 	uint64_t	pgout;
156*b9b602f4Sjs 	uint64_t	pgpgout;
157*b9b602f4Sjs 	uint64_t	swapin;
158*b9b602f4Sjs 	uint64_t	pgswapin;
159*b9b602f4Sjs 	uint64_t	swapout;
160*b9b602f4Sjs 	uint64_t	pgswapout;
161*b9b602f4Sjs 	uint64_t	zfod;
162*b9b602f4Sjs 	uint64_t	dfree;
163*b9b602f4Sjs 	uint64_t	scan;
164*b9b602f4Sjs 	uint64_t	rev;
165*b9b602f4Sjs 	uint64_t	hat_fault;
166*b9b602f4Sjs 	uint64_t	as_fault;
167*b9b602f4Sjs 	uint64_t	maj_fault;
168*b9b602f4Sjs 	uint64_t	cow_fault;
169*b9b602f4Sjs 	uint64_t	prot_fault;
170*b9b602f4Sjs 	uint64_t	softlock;
171*b9b602f4Sjs 	uint64_t	kernel_asflt;
172*b9b602f4Sjs 	uint64_t	pgrrun;
173*b9b602f4Sjs 	uint64_t	execpgin;
174*b9b602f4Sjs 	uint64_t	execpgout;
175*b9b602f4Sjs 	uint64_t	execfree;
176*b9b602f4Sjs 	uint64_t	anonpgin;
177*b9b602f4Sjs 	uint64_t	anonpgout;
178*b9b602f4Sjs 	uint64_t	anonfree;
179*b9b602f4Sjs 	uint64_t	fspgin;
180*b9b602f4Sjs 	uint64_t	fspgout;
181*b9b602f4Sjs 	uint64_t	fsfree;
182*b9b602f4Sjs } cpu64_vminfo_t;
183*b9b602f4Sjs 
184*b9b602f4Sjs typedef struct sysinfo64 {
185*b9b602f4Sjs 	uint64_t	updates;
186*b9b602f4Sjs 	uint64_t	runque;
187*b9b602f4Sjs 	uint64_t	runocc;
188*b9b602f4Sjs 	uint64_t	swpque;
189*b9b602f4Sjs 	uint64_t	swpocc;
190*b9b602f4Sjs 	uint64_t	waiting;
191*b9b602f4Sjs } sysinfo64_t;
192*b9b602f4Sjs 
193*b9b602f4Sjs struct sa64 {
194*b9b602f4Sjs 	int		valid;
195*b9b602f4Sjs 	time_t		ts;
196*b9b602f4Sjs 
197*b9b602f4Sjs 	cpu64_sysinfo_t	csi;
198*b9b602f4Sjs 	cpu64_vminfo_t	cvmi;
199*b9b602f4Sjs 	sysinfo64_t	si;
200*b9b602f4Sjs 	vminfo_t	vmi;
201*b9b602f4Sjs 	kmeminfo_t	kmi;
202*b9b602f4Sjs 
203*b9b602f4Sjs 	ulong_t		szinode;
204*b9b602f4Sjs 	ulong_t		szfile;
205*b9b602f4Sjs 	ulong_t		szproc;
206*b9b602f4Sjs 	ulong_t		szlckr;
207*b9b602f4Sjs 
208*b9b602f4Sjs 	ulong_t		mszinode;
209*b9b602f4Sjs 	ulong_t		mszfile;
210*b9b602f4Sjs 	ulong_t		mszproc;
211*b9b602f4Sjs 	ulong_t		mszlckr;
212*b9b602f4Sjs 
213*b9b602f4Sjs 	ulong_t	niodevs;
214*b9b602f4Sjs };
215*b9b602f4Sjs 
2167c478bd9Sstevel@tonic-gate extern struct sa sa;
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2197c478bd9Sstevel@tonic-gate }
2207c478bd9Sstevel@tonic-gate #endif
2217c478bd9Sstevel@tonic-gate 
2227c478bd9Sstevel@tonic-gate #endif /* _SA_H */
223