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