]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
3e170ce0 | 2 | * Copyright (c) 2000-2015 Apple Inc. All rights reserved. |
1c79356b | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
3e170ce0 | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
3e170ce0 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
3e170ce0 | 17 | * |
2d21ac55 A |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
3e170ce0 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | /* | |
29 | * @OSF_COPYRIGHT@ | |
30 | */ | |
3e170ce0 | 31 | /* |
1c79356b A |
32 | * Mach Operating System |
33 | * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University | |
34 | * All Rights Reserved. | |
3e170ce0 | 35 | * |
1c79356b A |
36 | * Permission to use, copy, modify and distribute this software and its |
37 | * documentation is hereby granted, provided that both the copyright | |
38 | * notice and this permission notice appear in all copies of the | |
39 | * software, derivative works or modified versions, and any portions | |
40 | * thereof, and that both notices appear in supporting documentation. | |
3e170ce0 | 41 | * |
1c79356b A |
42 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" |
43 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
44 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
3e170ce0 | 45 | * |
1c79356b | 46 | * Carnegie Mellon requests users of this software to return to |
3e170ce0 | 47 | * |
1c79356b A |
48 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU |
49 | * School of Computer Science | |
50 | * Carnegie Mellon University | |
51 | * Pittsburgh PA 15213-3890 | |
3e170ce0 | 52 | * |
1c79356b A |
53 | * any improvements or extensions that they make and grant Carnegie Mellon |
54 | * the rights to redistribute these changes. | |
55 | */ | |
1c79356b A |
56 | |
57 | /* | |
58 | * File: mach/host_info.h | |
59 | * | |
60 | * Definitions for host_info call. | |
61 | */ | |
62 | ||
63 | #ifndef _MACH_HOST_INFO_H_ | |
64 | #define _MACH_HOST_INFO_H_ | |
65 | ||
91447636 | 66 | #include <mach/message.h> |
1c79356b A |
67 | #include <mach/vm_statistics.h> |
68 | #include <mach/machine.h> | |
69 | #include <mach/machine/vm_types.h> | |
70 | #include <mach/time_value.h> | |
71 | ||
91447636 A |
72 | #include <sys/cdefs.h> |
73 | ||
1c79356b A |
74 | /* |
75 | * Generic information structure to allow for expansion. | |
76 | */ | |
77 | typedef integer_t *host_info_t; /* varying array of int. */ | |
b0d623f7 | 78 | typedef integer_t *host_info64_t; /* varying array of int. */ |
1c79356b A |
79 | |
80 | #define HOST_INFO_MAX (1024) /* max array size */ | |
81 | typedef integer_t host_info_data_t[HOST_INFO_MAX]; | |
82 | ||
83 | #define KERNEL_VERSION_MAX (512) | |
84 | typedef char kernel_version_t[KERNEL_VERSION_MAX]; | |
85 | ||
86 | #define KERNEL_BOOT_INFO_MAX (4096) | |
87 | typedef char kernel_boot_info_t[KERNEL_BOOT_INFO_MAX]; | |
88 | ||
1c79356b A |
89 | /* |
90 | * Currently defined information. | |
91 | */ | |
92 | /* host_info() */ | |
93 | typedef integer_t host_flavor_t; | |
94 | #define HOST_BASIC_INFO 1 /* basic info */ | |
95 | #define HOST_SCHED_INFO 3 /* scheduling info */ | |
96 | #define HOST_RESOURCE_SIZES 4 /* kernel struct sizes */ | |
97 | #define HOST_PRIORITY_INFO 5 /* priority information */ | |
9bccf70c A |
98 | #define HOST_SEMAPHORE_TRAPS 7 /* Has semaphore traps */ |
99 | #define HOST_MACH_MSG_TRAP 8 /* Has mach_msg_trap */ | |
39236c6e | 100 | #define HOST_VM_PURGABLE 9 /* purg'e'able memory info */ |
3e170ce0 | 101 | #define HOST_DEBUG_INFO_INTERNAL 10 /* Used for kernel internal development tests only */ |
1c79356b | 102 | |
91447636 A |
103 | #ifdef MACH_KERNEL_PRIVATE |
104 | struct host_basic_info_old { | |
1c79356b | 105 | integer_t max_cpus; /* max number of cpus possible */ |
2d21ac55 | 106 | uint32_t avail_cpus; /* number of cpus now available */ |
91447636 | 107 | natural_t memory_size; /* size of memory in bytes */ |
1c79356b A |
108 | cpu_type_t cpu_type; /* cpu type */ |
109 | cpu_subtype_t cpu_subtype; /* cpu subtype */ | |
110 | }; | |
111 | ||
91447636 A |
112 | typedef struct host_basic_info_old host_basic_info_data_old_t; |
113 | typedef struct host_basic_info_old *host_basic_info_old_t; | |
114 | #define HOST_BASIC_INFO_OLD_COUNT ((mach_msg_type_number_t) \ | |
115 | (sizeof(host_basic_info_data_old_t)/sizeof(integer_t))) | |
3e170ce0 | 116 | #endif /* MACH_KERNEL_PRIVATE */ |
91447636 | 117 | |
0c530ab8 | 118 | #pragma pack(4) |
91447636 A |
119 | |
120 | struct host_basic_info { | |
121 | integer_t max_cpus; /* max number of CPUs possible */ | |
122 | integer_t avail_cpus; /* number of CPUs now available */ | |
123 | natural_t memory_size; /* size of memory in bytes, capped at 2 GB */ | |
124 | cpu_type_t cpu_type; /* cpu type */ | |
125 | cpu_subtype_t cpu_subtype; /* cpu subtype */ | |
126 | cpu_threadtype_t cpu_threadtype; /* cpu threadtype */ | |
127 | integer_t physical_cpu; /* number of physical CPUs now available */ | |
128 | integer_t physical_cpu_max; /* max number of physical CPUs possible */ | |
129 | integer_t logical_cpu; /* number of logical cpu now available */ | |
130 | integer_t logical_cpu_max; /* max number of physical CPUs possible */ | |
131 | uint64_t max_mem; /* actual size of physical memory */ | |
132 | }; | |
133 | ||
0c530ab8 | 134 | #pragma pack() |
91447636 | 135 | |
1c79356b A |
136 | typedef struct host_basic_info host_basic_info_data_t; |
137 | typedef struct host_basic_info *host_basic_info_t; | |
91447636 A |
138 | #define HOST_BASIC_INFO_COUNT ((mach_msg_type_number_t) \ |
139 | (sizeof(host_basic_info_data_t)/sizeof(integer_t))) | |
1c79356b A |
140 | |
141 | struct host_sched_info { | |
142 | integer_t min_timeout; /* minimum timeout in milliseconds */ | |
143 | integer_t min_quantum; /* minimum quantum in milliseconds */ | |
144 | }; | |
145 | ||
146 | typedef struct host_sched_info host_sched_info_data_t; | |
147 | typedef struct host_sched_info *host_sched_info_t; | |
91447636 A |
148 | #define HOST_SCHED_INFO_COUNT ((mach_msg_type_number_t) \ |
149 | (sizeof(host_sched_info_data_t)/sizeof(integer_t))) | |
1c79356b A |
150 | |
151 | struct kernel_resource_sizes { | |
91447636 A |
152 | natural_t task; |
153 | natural_t thread; | |
154 | natural_t port; | |
155 | natural_t memory_region; | |
156 | natural_t memory_object; | |
1c79356b A |
157 | }; |
158 | ||
159 | typedef struct kernel_resource_sizes kernel_resource_sizes_data_t; | |
160 | typedef struct kernel_resource_sizes *kernel_resource_sizes_t; | |
91447636 A |
161 | #define HOST_RESOURCE_SIZES_COUNT ((mach_msg_type_number_t) \ |
162 | (sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t))) | |
1c79356b A |
163 | |
164 | struct host_priority_info { | |
165 | integer_t kernel_priority; | |
166 | integer_t system_priority; | |
167 | integer_t server_priority; | |
168 | integer_t user_priority; | |
169 | integer_t depress_priority; | |
170 | integer_t idle_priority; | |
171 | integer_t minimum_priority; | |
172 | integer_t maximum_priority; | |
173 | }; | |
174 | ||
175 | typedef struct host_priority_info host_priority_info_data_t; | |
176 | typedef struct host_priority_info *host_priority_info_t; | |
91447636 A |
177 | #define HOST_PRIORITY_INFO_COUNT ((mach_msg_type_number_t) \ |
178 | (sizeof(host_priority_info_data_t)/sizeof(integer_t))) | |
1c79356b A |
179 | |
180 | /* host_statistics() */ | |
181 | #define HOST_LOAD_INFO 1 /* System loading stats */ | |
182 | #define HOST_VM_INFO 2 /* Virtual memory stats */ | |
183 | #define HOST_CPU_LOAD_INFO 3 /* CPU load stats */ | |
184 | ||
b0d623f7 A |
185 | /* host_statistics64() */ |
186 | #define HOST_VM_INFO64 4 /* 64-bit virtual memory stats */ | |
6d2010ae | 187 | #define HOST_EXTMOD_INFO64 5 /* External modification stats */ |
39236c6e A |
188 | #define HOST_EXPIRED_TASK_INFO 6 /* Statistics for expired tasks */ |
189 | ||
b0d623f7 | 190 | |
1c79356b A |
191 | struct host_load_info { |
192 | integer_t avenrun[3]; /* scaled by LOAD_SCALE */ | |
193 | integer_t mach_factor[3]; /* scaled by LOAD_SCALE */ | |
194 | }; | |
195 | ||
196 | typedef struct host_load_info host_load_info_data_t; | |
197 | typedef struct host_load_info *host_load_info_t; | |
91447636 A |
198 | #define HOST_LOAD_INFO_COUNT ((mach_msg_type_number_t) \ |
199 | (sizeof(host_load_info_data_t)/sizeof(integer_t))) | |
1c79356b | 200 | |
39236c6e A |
201 | typedef struct vm_purgeable_info host_purgable_info_data_t; |
202 | typedef struct vm_purgeable_info *host_purgable_info_t; | |
203 | #define HOST_VM_PURGABLE_COUNT ((mach_msg_type_number_t) \ | |
204 | (sizeof(host_purgable_info_data_t)/sizeof(integer_t))) | |
205 | ||
1c79356b | 206 | /* in <mach/vm_statistics.h> */ |
b0d623f7 A |
207 | /* vm_statistics64 */ |
208 | #define HOST_VM_INFO64_COUNT ((mach_msg_type_number_t) \ | |
209 | (sizeof(vm_statistics64_data_t)/sizeof(integer_t))) | |
210 | ||
211 | /* size of the latest version of the structure */ | |
212 | #define HOST_VM_INFO64_LATEST_COUNT HOST_VM_INFO64_COUNT | |
39236c6e A |
213 | #define HOST_VM_INFO64_REV1_COUNT HOST_VM_INFO64_LATEST_COUNT |
214 | /* previous versions: adjust the size according to what was added each time */ | |
215 | #define HOST_VM_INFO64_REV0_COUNT /* added compression and swapper info (14 ints) */\ | |
216 | ((mach_msg_type_number_t) \ | |
217 | (HOST_VM_INFO64_REV1_COUNT - 14)) | |
b0d623f7 | 218 | |
6d2010ae A |
219 | /* in <mach/vm_statistics.h> */ |
220 | /* vm_extmod_statistics */ | |
221 | #define HOST_EXTMOD_INFO64_COUNT ((mach_msg_type_number_t) \ | |
222 | (sizeof(vm_extmod_statistics_data_t)/sizeof(integer_t))) | |
223 | ||
224 | /* size of the latest version of the structure */ | |
225 | #define HOST_EXTMOD_INFO64_LATEST_COUNT HOST_EXTMOD_INFO64_COUNT | |
b0d623f7 A |
226 | |
227 | /* vm_statistics */ | |
91447636 A |
228 | #define HOST_VM_INFO_COUNT ((mach_msg_type_number_t) \ |
229 | (sizeof(vm_statistics_data_t)/sizeof(integer_t))) | |
2d21ac55 A |
230 | |
231 | /* size of the latest version of the structure */ | |
232 | #define HOST_VM_INFO_LATEST_COUNT HOST_VM_INFO_COUNT | |
b0d623f7 | 233 | #define HOST_VM_INFO_REV2_COUNT HOST_VM_INFO_LATEST_COUNT |
2d21ac55 A |
234 | /* previous versions: adjust the size according to what was added each time */ |
235 | #define HOST_VM_INFO_REV1_COUNT /* added "speculative_count" (1 int) */ \ | |
236 | ((mach_msg_type_number_t) \ | |
237 | (HOST_VM_INFO_REV2_COUNT - 1)) | |
3e170ce0 | 238 | #define HOST_VM_INFO_REV0_COUNT /* added "purgable" info (2 ints) */ \ |
2d21ac55 A |
239 | ((mach_msg_type_number_t) \ |
240 | (HOST_VM_INFO_REV1_COUNT - 2)) | |
1c79356b A |
241 | |
242 | struct host_cpu_load_info { /* number of ticks while running... */ | |
91447636 | 243 | natural_t cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */ |
1c79356b | 244 | }; |
91447636 | 245 | |
1c79356b A |
246 | typedef struct host_cpu_load_info host_cpu_load_info_data_t; |
247 | typedef struct host_cpu_load_info *host_cpu_load_info_t; | |
91447636 A |
248 | #define HOST_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \ |
249 | (sizeof (host_cpu_load_info_data_t) / sizeof (integer_t))) | |
1c79356b | 250 | |
6d2010ae A |
251 | #ifdef PRIVATE |
252 | /* | |
253 | * CPU Statistics information | |
254 | */ | |
255 | struct _processor_statistics_np { | |
256 | int32_t ps_cpuid; | |
257 | ||
258 | uint32_t ps_csw_count; | |
259 | uint32_t ps_preempt_count; | |
260 | uint32_t ps_preempted_rt_count; | |
261 | uint32_t ps_preempted_by_rt_count; | |
262 | ||
263 | uint32_t ps_rt_sched_count; | |
264 | ||
265 | uint32_t ps_interrupt_count; | |
266 | uint32_t ps_ipi_count; | |
267 | uint32_t ps_timer_pop_count; | |
3e170ce0 | 268 | |
6d2010ae A |
269 | uint64_t ps_runq_count_sum __attribute((aligned(8))); |
270 | ||
271 | uint32_t ps_idle_transitions; | |
ebb1b9f4 | 272 | uint32_t ps_quantum_timer_expirations; |
6d2010ae A |
273 | }; |
274 | ||
3e170ce0 A |
275 | struct host_debug_info_internal { |
276 | uint64_t config_bank:1, /* built configurations */ | |
277 | config_atm:1, | |
278 | config_csr:1, | |
279 | config_coalitions:1, | |
280 | config_unused:60; | |
281 | }; | |
282 | ||
283 | typedef struct host_debug_info_internal *host_debug_info_internal_t; | |
284 | typedef struct host_debug_info_internal host_debug_info_internal_data_t; | |
285 | #define HOST_DEBUG_INFO_INTERNAL_COUNT ((mach_msg_type_number_t)\ | |
286 | (sizeof (host_debug_info_internal_data_t) / sizeof(integer_t))) | |
287 | ||
6d2010ae A |
288 | #endif /* PRIVATE */ |
289 | ||
290 | #ifdef KERNEL_PRIVATE | |
291 | ||
292 | extern kern_return_t set_sched_stats_active( | |
293 | boolean_t active); | |
294 | ||
3e170ce0 A |
295 | extern kern_return_t get_sched_statistics( |
296 | struct _processor_statistics_np *out, | |
6d2010ae A |
297 | uint32_t *count); |
298 | #endif /* KERNEL_PRIVATE */ | |
299 | ||
300 | ||
1c79356b | 301 | #endif /* _MACH_HOST_INFO_H_ */ |