xref: /NextBSD/sys/sys/mach/host_info.h (revision 33da5adc555b3bc29986eeadca03829e4ad06b1e)
1 /*
2  * Copyright 1991-1998 by Open Software Foundation, Inc.
3  *              All Rights Reserved
4  *
5  * Permission to use, copy, modify, and distribute this software and
6  * its documentation for any purpose and without fee is hereby granted,
7  * provided that the above copyright notice appears in all copies and
8  * that both the copyright notice and this permission notice appear in
9  * supporting documentation.
10  *
11  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
12  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13  * FOR A PARTICULAR PURPOSE.
14  *
15  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
16  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
18  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
19  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21 /*
22  * MkLinux
23  */
24 /* CMU_HIST */
25 /*
26  * Revision 2.4.2.1  92/01/09  18:44:17  jsb
27  * 	From durriya@ri.osf.org: defined kernel_boot_info_t.
28  * 	[92/01/08  15:01:53  jsb]
29  *
30  * Revision 2.4  91/05/14  16:51:48  mrt
31  * 	Correcting copyright
32  *
33  * Revision 2.3  91/02/05  17:31:58  mrt
34  * 	Changed to new Mach copyright
35  * 	[91/02/01  17:17:13  mrt]
36  *
37  * Revision 2.2  90/06/02  14:57:58  rpd
38  * 	Added HOST_LOAD_INFO and related definitions.
39  * 	[90/04/27            rpd]
40  * 	Created for new host/processor technology.
41  * 	[90/03/26  23:50:51  rpd]
42  *
43  * 	Cleanup changes.
44  * 	[89/08/02            dlb]
45  * 	Add sched_info flavor to return minimum times for use by
46  * 	external schedulers.
47  * 	[89/06/08            dlb]
48  * 	Added kernel_version type definitions.
49  * 	[88/12/02            dlb]
50  *
51  * Revision 2.4  89/10/15  02:05:31  rpd
52  * 	Minor cleanups.
53  *
54  * Revision 2.3  89/10/11  17:32:15  dlb
55  * 	Include mach/machine/vm_types.h instead of mach/vm_param.h
56  * 	[89/10/11            dlb]
57  *
58  * Revision 2.2  89/10/11  14:36:55  dlb
59  * 	Add sched_info flavor to return minimum times for use by
60  * 	external schedulers.
61  * 	[89/06/08            dlb]
62  *
63  * 	Added kernel_version type definitions.
64  * 	[88/12/02            dlb]
65  *
66  * 30-Nov-88  David Black (dlb) at Carnegie-Mellon University
67  *	Created.  2 flavors so far: basic info,  slot numbers.
68  *
69  */
70 /* CMU_ENDHIST */
71 /*
72  * Mach Operating System
73  * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
74  * All Rights Reserved.
75  *
76  * Permission to use, copy, modify and distribute this software and its
77  * documentation is hereby granted, provided that both the copyright
78  * notice and this permission notice appear in all copies of the
79  * software, derivative works or modified versions, and any portions
80  * thereof, and that both notices appear in supporting documentation.
81  *
82  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
83  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
84  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
85  *
86  * Carnegie Mellon requests users of this software to return to
87  *
88  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
89  *  School of Computer Science
90  *  Carnegie Mellon University
91  *  Pittsburgh PA 15213-3890
92  *
93  * any improvements or extensions that they make and grant Carnegie Mellon
94  * the rights to redistribute these changes.
95  */
96 /*
97  */
98 
99 /*
100  *	File:	mach/host_info.h
101  *
102  *	Definitions for host_info call.
103  */
104 
105 #ifndef	_MACH_HOST_INFO_H_
106 #define	_MACH_HOST_INFO_H_
107 
108 #include <sys/mach/vm_statistics.h>
109 #include <sys/mach/machine.h>
110 
111 #include <sys/mach/time_value.h>
112 
113 /*
114  *	Generic information structure to allow for expansion.
115  */
116 typedef integer_t        *host_info64_t;         /* varying array of int. */
117 typedef integer_t	*host_info_t;		/* varying array of int. */
118 
119 #define	HOST_INFO_MAX	(1024)		/* max array size */
120 typedef integer_t	host_info_data_t[HOST_INFO_MAX];
121 
122 #define KERNEL_VERSION_MAX (512)
123 typedef char	kernel_version_t[KERNEL_VERSION_MAX];
124 
125 #define KERNEL_BOOT_INFO_MAX (4096)
126 typedef char	kernel_boot_info_t[KERNEL_BOOT_INFO_MAX];
127 
128 #define	KERNEL_BOOTMAGIC_MAX	(8192)
129 
130 /*
131  *	Currently defined information.
132  */
133 /* host_info() */
134 typedef	integer_t	host_flavor_t;
135 #define HOST_BASIC_INFO		1	/* basic info */
136 #define HOST_SCHED_INFO		3	/* scheduling info */
137 #define HOST_RESOURCE_SIZES	4	/* kernel struct sizes */
138 #define HOST_PRIORITY_INFO	5	/* priority information */
139 #define HOST_PAGING_INFO	6	/* VM/paging info */
140 
141 struct host_basic_info {
142 	integer_t	max_cpus;	/* max number of cpus possible */
143 	integer_t	avail_cpus;	/* number of cpus now available */
144 	vm_size_t	memory_size;	/* size of memory in bytes */
145 	cpu_type_t	cpu_type;	/* cpu type */
146 	cpu_subtype_t	cpu_subtype;	/* cpu subtype */
147 };
148 
149 typedef	struct host_basic_info	host_basic_info_data_t;
150 typedef struct host_basic_info	*host_basic_info_t;
151 #define HOST_BASIC_INFO_COUNT \
152 		(sizeof(host_basic_info_data_t)/sizeof(integer_t))
153 
154 struct host_sched_info {
155 	integer_t	min_timeout;	/* minimum timeout in milliseconds */
156 	integer_t	min_quantum;	/* minimum quantum in milliseconds */
157 };
158 
159 typedef	struct host_sched_info	host_sched_info_data_t;
160 typedef struct host_sched_info	*host_sched_info_t;
161 #define HOST_SCHED_INFO_COUNT \
162 		(sizeof(host_sched_info_data_t)/sizeof(integer_t))
163 
164 struct kernel_resource_sizes {
165 	vm_size_t	task;
166         vm_size_t	thread;
167         vm_size_t	port;
168         vm_size_t	memory_region;
169         vm_size_t	memory_object;
170 };
171 
172 typedef struct kernel_resource_sizes	kernel_resource_sizes_data_t;
173 typedef struct kernel_resource_sizes	*kernel_resource_sizes_t;
174 #define HOST_RESOURCE_SIZES_COUNT \
175 		(sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t))
176 
177 struct host_priority_info {
178     	integer_t	kernel_priority;
179     	integer_t	system_priority;
180     	integer_t	server_priority;
181     	integer_t	user_priority;
182     	integer_t	depress_priority;
183     	integer_t	idle_priority;
184     	integer_t	minimum_priority;
185 	integer_t	maximum_priority;
186 };
187 
188 typedef struct host_priority_info	host_priority_info_data_t;
189 typedef struct host_priority_info	*host_priority_info_t;
190 #define HOST_PRIORITY_INFO_COUNT \
191 		(sizeof(host_priority_info_data_t)/sizeof(integer_t))
192 
193 /* host_statistics() */
194 #define	HOST_LOAD_INFO		1	/* System loading stats */
195 #define HOST_VM_INFO		2	/* Virtual memory stats */
196 #define HOST_CPU_LOAD_INFO	3	/* CPU load stats */
197 
198 struct host_load_info {
199 	integer_t	avenrun[3];	/* scaled by LOAD_SCALE */
200 	integer_t	mach_factor[3];	/* scaled by LOAD_SCALE */
201 };
202 
203 typedef struct host_load_info	host_load_info_data_t;
204 typedef struct host_load_info	*host_load_info_t;
205 #define	HOST_LOAD_INFO_COUNT \
206 		(sizeof(host_load_info_data_t)/sizeof(integer_t))
207 
208 /* in <mach/vm_statistics.h> */
209 #define	HOST_VM_INFO_COUNT \
210 		(sizeof(vm_statistics_data_t)/sizeof(integer_t))
211 
212 struct host_cpu_load_info {		/* number of ticks while running... */
213 	unsigned long	cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
214 };
215 typedef struct host_cpu_load_info	host_cpu_load_info_data_t;
216 typedef struct host_cpu_load_info	*host_cpu_load_info_t;
217 #define HOST_CPU_LOAD_INFO_COUNT \
218 		(sizeof (host_cpu_load_info_data_t) / sizeof (integer_t))
219 
220 struct host_paging_info {
221 	time_value_t	sample_time;	/* (TOD) time sample taken */
222 	time_value_t	reset_time;	/* (TOD) time at last reset */
223 
224 			/* Information about page queues */
225 	long	pagesize;		/* page size in bytes */
226 	long	free_count;		/* # of pages free */
227 	long	active_count;		/* # of pages active */
228 	long	inactive_count;		/* # of pages inactive */
229 	long	wire_count;		/* # of pages wired down */
230 
231 			/* Information about page faults */
232 	long	faults;			/* # of faults */
233 	long	zero_fill_count;	/* # of zero fill pages */
234 	long	pageins;		/* # of faults resulting in pageins */
235 	long	pages_pagedin;		/* # of pages paged in */
236 	long	cow_faults;		/* # of copy-on-write faults */
237 	long	reactivations;		/* # of pages reactivated */
238 
239 			/* Information about object cache performance */
240 	long	lookups;		/* object cache lookups */
241 	long	hits;			/* object cache hits */
242 
243 			/* Information about page replacement algorithm */
244 	long	pageouts;		/* # of pageout operations (clusters) */
245 	long	pages_pagedout;		/* # of pages paged out */
246 };
247 
248 typedef struct host_paging_info	host_paging_info_data_t;
249 typedef struct host_paging_info	*host_paging_info_t;
250 #define HOST_PAGING_INFO_COUNT \
251 		(sizeof(host_paging_info_data_t)/sizeof(int))
252 
253 #endif	/* _MACH_HOST_INFO_H_ */
254