summaryrefslogtreecommitdiff
path: root/usr/src/cmd/sa/sa.h
blob: af8f018aa4d86857ec3e1c340a4af2222638777d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
/*	  All Rights Reserved  	*/


/*
 * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef _SA_H
#define	_SA_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

/*
 * sa.h contains struct sa and defines variables used in sadc.c and sar.c.
 * RESTRICTION: the data types defined in this file must not be changed.
 * sar writes these types to disk as binary data and to ensure version to
 * version compatibility they must not be changed.
 */

#include <sys/kstat.h>

#ifdef	__cplusplus
extern "C" {
#endif

typedef struct iodevinfo {
	struct iodevinfo *next;
	kstat_t *ksp;
	kstat_t ks;
	kstat_io_t kios;
} iodevinfo_t;

#define	KMEM_SMALL  0		/* small KMEM request index		*/
#define	KMEM_LARGE  1		/* large KMEM request index		*/
#define	KMEM_OSIZE  2		/* outsize KMEM request index		*/
#define	KMEM_NCLASS 3		/* # of KMEM request classes		*/

typedef struct kmeminfo {
	ulong_t	km_mem[KMEM_NCLASS];	/* amount of mem owned by KMEM	*/
	ulong_t	km_alloc[KMEM_NCLASS];  /* amount of mem allocated	*/
	ulong_t	km_fail[KMEM_NCLASS];	/* # of failed requests		*/
} kmeminfo_t;

/*
 * structure sa defines the data structure of system activity data file
 */

struct sa {
	int		valid;		/* non-zero for valid data	*/
	time_t		ts;		/* time stamp			*/

	cpu_sysinfo_t	csi;		/* per-CPU system information	*/
	cpu_vminfo_t	cvmi;		/* per-CPU vm information	*/
	sysinfo_t	si;		/* global system information	*/
	vminfo_t	vmi;		/* global vm information	*/
	kmeminfo_t	kmi;		/* kernel mem allocation info	*/

	ulong_t		szinode;	/* inode table size		*/
	ulong_t		szfile;		/* file table size		*/
	ulong_t		szproc;		/* proc table size		*/
	ulong_t		szlckr;		/* file record lock table size	*/

	ulong_t		mszinode;	/* max inode table size		*/
	ulong_t		mszfile;	/* max file table size		*/
	ulong_t		mszproc;	/* max proc table size		*/
	ulong_t		mszlckr;	/* max file rec lock table size	*/

	ulong_t	niodevs;		/* number of I/O devices	*/

	/* An array of iodevinfo structs come next in the sadc files	*/
};

typedef struct cpu64_sysinfo {
	uint64_t	cpu[CPU_STATES];
	uint64_t	wait[W_STATES];
	uint64_t	bread;
	uint64_t	bwrite;
	uint64_t	lread;
	uint64_t	lwrite;
	uint64_t	phread;
	uint64_t	phwrite;
	uint64_t	pswitch;
	uint64_t	trap;
	uint64_t	intr;
	uint64_t	syscall;
	uint64_t	sysread;
	uint64_t	syswrite;
	uint64_t	sysfork;
	uint64_t	sysvfork;
	uint64_t	sysexec;
	uint64_t	readch;
	uint64_t	writech;
	uint64_t	rcvint;
	uint64_t	xmtint;
	uint64_t	mdmint;
	uint64_t	rawch;
	uint64_t	canch;
	uint64_t	outch;
	uint64_t	msg;
	uint64_t	sema;
	uint64_t	namei;
	uint64_t	ufsiget;
	uint64_t	ufsdirblk;
	uint64_t	ufsipage;
	uint64_t	ufsinopage;
	uint64_t	inodeovf;
	uint64_t	fileovf;
	uint64_t	procovf;
	uint64_t	intrthread;
	uint64_t	intrblk;
	uint64_t	idlethread;
	uint64_t	inv_swtch;
	uint64_t	nthreads;
	uint64_t	cpumigrate;
	uint64_t	xcalls;
	uint64_t	mutex_adenters;
	uint64_t	rw_rdfails;
	uint64_t	rw_wrfails;
	uint64_t	modload;
	uint64_t	modunload;
	uint64_t	bawrite;
	uint64_t	rw_enters;
	uint64_t	win_uo_cnt;
	uint64_t	win_uu_cnt;
	uint64_t	win_so_cnt;
	uint64_t	win_su_cnt;
	uint64_t	win_suo_cnt;
} cpu64_sysinfo_t;

typedef struct cpu64_vminfo {
	uint64_t	pgrec;
	uint64_t	pgfrec;
	uint64_t	pgin;
	uint64_t	pgpgin;
	uint64_t	pgout;
	uint64_t	pgpgout;
	uint64_t	swapin;
	uint64_t	pgswapin;
	uint64_t	swapout;
	uint64_t	pgswapout;
	uint64_t	zfod;
	uint64_t	dfree;
	uint64_t	scan;
	uint64_t	rev;
	uint64_t	hat_fault;
	uint64_t	as_fault;
	uint64_t	maj_fault;
	uint64_t	cow_fault;
	uint64_t	prot_fault;
	uint64_t	softlock;
	uint64_t	kernel_asflt;
	uint64_t	pgrrun;
	uint64_t	execpgin;
	uint64_t	execpgout;
	uint64_t	execfree;
	uint64_t	anonpgin;
	uint64_t	anonpgout;
	uint64_t	anonfree;
	uint64_t	fspgin;
	uint64_t	fspgout;
	uint64_t	fsfree;
} cpu64_vminfo_t;

typedef struct sysinfo64 {
	uint64_t	updates;
	uint64_t	runque;
	uint64_t	runocc;
	uint64_t	swpque;
	uint64_t	swpocc;
	uint64_t	waiting;
} sysinfo64_t;

struct sa64 {
	int		valid;
	time_t		ts;

	cpu64_sysinfo_t	csi;
	cpu64_vminfo_t	cvmi;
	sysinfo64_t	si;
	vminfo_t	vmi;
	kmeminfo_t	kmi;

	ulong_t		szinode;
	ulong_t		szfile;
	ulong_t		szproc;
	ulong_t		szlckr;

	ulong_t		mszinode;
	ulong_t		mszfile;
	ulong_t		mszproc;
	ulong_t		mszlckr;

	ulong_t	niodevs;
};

extern struct sa sa;

#ifdef	__cplusplus
}
#endif

#endif /* _SA_H */