]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/processor_info.h
xnu-201.19.tar.gz
[apple/xnu.git] / osfmk / mach / processor_info.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25 /*
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
28 * All Rights Reserved.
29 *
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
35 *
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50 /*
51 */
52
53 /*
54 * File: mach/processor_info.h
55 * Author: David L. Black
56 * Date: 1988
57 *
58 * Data structure definitions for processor_info, processor_set_info
59 */
60
61 #ifndef _MACH_PROCESSOR_INFO_H_
62 #define _MACH_PROCESSOR_INFO_H_
63
64 #include <mach/machine.h>
65 #include <mach/machine/processor_info.h>
66
67 /*
68 * Generic information structure to allow for expansion.
69 */
70 typedef integer_t *processor_info_t; /* varying array of int. */
71 typedef integer_t *processor_info_array_t; /* varying array of int */
72
73 #define PROCESSOR_INFO_MAX (1024) /* max array size */
74 typedef integer_t processor_info_data_t[PROCESSOR_INFO_MAX];
75
76
77 typedef integer_t *processor_set_info_t; /* varying array of int. */
78
79 #define PROCESSOR_SET_INFO_MAX (1024) /* max array size */
80 typedef integer_t processor_set_info_data_t[PROCESSOR_SET_INFO_MAX];
81
82 /*
83 * Currently defined information.
84 */
85 typedef int processor_flavor_t;
86 #define PROCESSOR_BASIC_INFO 1 /* basic information */
87 #define PROCESSOR_CPU_LOAD_INFO 2 /* cpu load information */
88 #define PROCESSOR_PM_REGS_INFO 0x10000001 /* performance monitor register info */
89 #define PROCESSOR_TEMPERATURE 0x10000002 /* Processor core temperature */
90
91 struct processor_basic_info {
92 cpu_type_t cpu_type; /* type of cpu */
93 cpu_subtype_t cpu_subtype; /* subtype of cpu */
94 boolean_t running; /* is processor running */
95 int slot_num; /* slot number */
96 boolean_t is_master; /* is this the master processor */
97 };
98
99 typedef struct processor_basic_info processor_basic_info_data_t;
100 typedef struct processor_basic_info *processor_basic_info_t;
101 #define PROCESSOR_BASIC_INFO_COUNT \
102 (sizeof(processor_basic_info_data_t)/sizeof(natural_t))
103
104 struct processor_cpu_load_info { /* number of ticks while running... */
105 unsigned long cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
106 };
107
108 typedef struct processor_cpu_load_info processor_cpu_load_info_data_t;
109 typedef struct processor_cpu_load_info *processor_cpu_load_info_t;
110 #define PROCESSOR_CPU_LOAD_INFO_COUNT \
111 (sizeof(processor_cpu_load_info_data_t)/sizeof(natural_t))
112
113 /*
114 * Scaling factor for load_average, mach_factor.
115 */
116 #define LOAD_SCALE 1000
117
118 typedef int processor_set_flavor_t;
119 #define PROCESSOR_SET_BASIC_INFO 5 /* basic information */
120
121 struct processor_set_basic_info {
122 int processor_count; /* How many processors */
123 int default_policy; /* When others not enabled */
124 };
125
126 typedef struct processor_set_basic_info processor_set_basic_info_data_t;
127 typedef struct processor_set_basic_info *processor_set_basic_info_t;
128 #define PROCESSOR_SET_BASIC_INFO_COUNT \
129 (sizeof(processor_set_basic_info_data_t)/sizeof(natural_t))
130
131 #define PROCESSOR_SET_LOAD_INFO 4 /* scheduling statistics */
132
133 struct processor_set_load_info {
134 int task_count; /* How many tasks */
135 int thread_count; /* How many threads */
136 integer_t load_average; /* Scaled */
137 integer_t mach_factor; /* Scaled */
138 };
139
140 typedef struct processor_set_load_info processor_set_load_info_data_t;
141 typedef struct processor_set_load_info *processor_set_load_info_t;
142 #define PROCESSOR_SET_LOAD_INFO_COUNT \
143 (sizeof(processor_set_load_info_data_t)/sizeof(natural_t))
144
145
146 /*
147 * New scheduling control interface
148 */
149 #define PROCESSOR_SET_ENABLED_POLICIES 3
150 #define PROCESSOR_SET_ENABLED_POLICIES_COUNT \
151 (sizeof(policy_t)/sizeof(natural_t))
152
153 #define PROCESSOR_SET_TIMESHARE_DEFAULT 10
154 #define PROCESSOR_SET_TIMESHARE_LIMITS 11
155
156 #define PROCESSOR_SET_RR_DEFAULT 20
157 #define PROCESSOR_SET_RR_LIMITS 21
158
159 #define PROCESSOR_SET_FIFO_DEFAULT 30
160 #define PROCESSOR_SET_FIFO_LIMITS 31
161
162 #endif /* _MACH_PROCESSOR_INFO_H_ */