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