2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
31 * All Rights Reserved.
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.
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.
43 * Carnegie Mellon requests users of this software to return to
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
57 * File: mach/processor_info.h
58 * Author: David L. Black
61 * Data structure definitions for processor_info, processor_set_info
64 #ifndef _MACH_PROCESSOR_INFO_H_
65 #define _MACH_PROCESSOR_INFO_H_
67 #include <mach/machine.h>
68 #include <mach/machine/processor_info.h>
71 * Generic information structure to allow for expansion.
73 typedef integer_t
*processor_info_t
; /* varying array of int. */
74 typedef integer_t
*processor_info_array_t
; /* varying array of int */
76 #define PROCESSOR_INFO_MAX (1024) /* max array size */
77 typedef integer_t processor_info_data_t
[PROCESSOR_INFO_MAX
];
80 typedef integer_t
*processor_set_info_t
; /* varying array of int. */
82 #define PROCESSOR_SET_INFO_MAX (1024) /* max array size */
83 typedef integer_t processor_set_info_data_t
[PROCESSOR_SET_INFO_MAX
];
86 * Currently defined information.
88 typedef 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 */
94 struct 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 */
102 typedef struct processor_basic_info processor_basic_info_data_t
;
103 typedef struct processor_basic_info
*processor_basic_info_t
;
104 #define PROCESSOR_BASIC_INFO_COUNT \
105 (sizeof(processor_basic_info_data_t)/sizeof(natural_t))
107 struct processor_cpu_load_info
{ /* number of ticks while running... */
108 unsigned long cpu_ticks
[CPU_STATE_MAX
]; /* ... in the given mode */
111 typedef struct processor_cpu_load_info processor_cpu_load_info_data_t
;
112 typedef 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))
117 * Scaling factor for load_average, mach_factor.
119 #define LOAD_SCALE 1000
121 typedef int processor_set_flavor_t
;
122 #define PROCESSOR_SET_BASIC_INFO 5 /* basic information */
124 struct processor_set_basic_info
{
125 int processor_count
; /* How many processors */
126 int default_policy
; /* When others not enabled */
129 typedef struct processor_set_basic_info processor_set_basic_info_data_t
;
130 typedef 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))
134 #define PROCESSOR_SET_LOAD_INFO 4 /* scheduling statistics */
136 struct 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 */
143 typedef struct processor_set_load_info processor_set_load_info_data_t
;
144 typedef 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))
150 * New scheduling control interface
152 #define PROCESSOR_SET_ENABLED_POLICIES 3
153 #define PROCESSOR_SET_ENABLED_POLICIES_COUNT \
154 (sizeof(policy_t)/sizeof(natural_t))
156 #define PROCESSOR_SET_TIMESHARE_DEFAULT 10
157 #define PROCESSOR_SET_TIMESHARE_LIMITS 11
159 #define PROCESSOR_SET_RR_DEFAULT 20
160 #define PROCESSOR_SET_RR_LIMITS 21
162 #define PROCESSOR_SET_FIFO_DEFAULT 30
163 #define PROCESSOR_SET_FIFO_LIMITS 31
165 #endif /* _MACH_PROCESSOR_INFO_H_ */