2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
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
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
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.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
36 * All Rights Reserved.
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.
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.
48 * Carnegie Mellon requests users of this software to return to
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
62 * File: mach/processor_info.h
63 * Author: David L. Black
66 * Data structure definitions for processor_info, processor_set_info
69 #ifndef _MACH_PROCESSOR_INFO_H_
70 #define _MACH_PROCESSOR_INFO_H_
72 #include <mach/message.h>
73 #include <mach/machine.h>
74 #include <mach/machine/processor_info.h>
77 * Generic information structure to allow for expansion.
79 typedef integer_t
*processor_info_t
; /* varying array of int. */
80 typedef integer_t
*processor_info_array_t
; /* varying array of int */
82 #define PROCESSOR_INFO_MAX (1024) /* max array size */
83 typedef integer_t processor_info_data_t
[PROCESSOR_INFO_MAX
];
86 typedef integer_t
*processor_set_info_t
; /* varying array of int. */
88 #define PROCESSOR_SET_INFO_MAX (1024) /* max array size */
89 typedef integer_t processor_set_info_data_t
[PROCESSOR_SET_INFO_MAX
];
92 * Currently defined information.
94 typedef 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 */
100 struct 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 */
108 typedef struct processor_basic_info processor_basic_info_data_t
;
109 typedef struct processor_basic_info
*processor_basic_info_t
;
110 #define PROCESSOR_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
111 (sizeof(processor_basic_info_data_t)/sizeof(natural_t)))
113 struct processor_cpu_load_info
{ /* number of ticks while running... */
114 unsigned long cpu_ticks
[CPU_STATE_MAX
]; /* ... in the given mode */
117 typedef struct processor_cpu_load_info processor_cpu_load_info_data_t
;
118 typedef struct processor_cpu_load_info
*processor_cpu_load_info_t
;
119 #define PROCESSOR_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
120 (sizeof(processor_cpu_load_info_data_t)/sizeof(natural_t)))
123 * Scaling factor for load_average, mach_factor.
125 #define LOAD_SCALE 1000
127 typedef int processor_set_flavor_t
;
128 #define PROCESSOR_SET_BASIC_INFO 5 /* basic information */
130 struct processor_set_basic_info
{
131 int processor_count
; /* How many processors */
132 int default_policy
; /* When others not enabled */
135 typedef struct processor_set_basic_info processor_set_basic_info_data_t
;
136 typedef struct processor_set_basic_info
*processor_set_basic_info_t
;
137 #define PROCESSOR_SET_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
138 (sizeof(processor_set_basic_info_data_t)/sizeof(natural_t)))
140 #define PROCESSOR_SET_LOAD_INFO 4 /* scheduling statistics */
142 struct 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 */
149 typedef struct processor_set_load_info processor_set_load_info_data_t
;
150 typedef struct processor_set_load_info
*processor_set_load_info_t
;
151 #define PROCESSOR_SET_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
152 (sizeof(processor_set_load_info_data_t)/sizeof(natural_t)))
156 #define PROCESSOR_SET_ENABLED_POLICIES 3
157 #define PROCESSOR_SET_ENABLED_POLICIES_COUNT ((mach_msg_type_number_t) \
158 (sizeof(policy_t)/sizeof(natural_t)))
160 #define PROCESSOR_SET_TIMESHARE_DEFAULT 10
161 #define PROCESSOR_SET_TIMESHARE_LIMITS 11
163 #define PROCESSOR_SET_RR_DEFAULT 20
164 #define PROCESSOR_SET_RR_LIMITS 21
166 #define PROCESSOR_SET_FIFO_DEFAULT 30
167 #define PROCESSOR_SET_FIFO_LIMITS 31
171 #endif /* _MACH_PROCESSOR_INFO_H_ */