2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
28 * All Rights Reserved.
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.
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.
40 * Carnegie Mellon requests users of this software to return to
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
54 * File: mach/processor_info.h
55 * Author: David L. Black
58 * Data structure definitions for processor_info, processor_set_info
61 #ifndef _MACH_PROCESSOR_INFO_H_
62 #define _MACH_PROCESSOR_INFO_H_
64 #include <mach/machine.h>
65 #include <mach/machine/processor_info.h>
68 * Generic information structure to allow for expansion.
70 typedef integer_t
*processor_info_t
; /* varying array of int. */
71 typedef integer_t
*processor_info_array_t
; /* varying array of int */
73 #define PROCESSOR_INFO_MAX (1024) /* max array size */
74 typedef integer_t processor_info_data_t
[PROCESSOR_INFO_MAX
];
77 typedef integer_t
*processor_set_info_t
; /* varying array of int. */
79 #define PROCESSOR_SET_INFO_MAX (1024) /* max array size */
80 typedef integer_t processor_set_info_data_t
[PROCESSOR_SET_INFO_MAX
];
83 * Currently defined information.
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 */
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 */
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))
104 struct processor_cpu_load_info
{ /* number of ticks while running... */
105 unsigned long cpu_ticks
[CPU_STATE_MAX
]; /* ... in the given mode */
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))
114 * Scaling factor for load_average, mach_factor.
116 #define LOAD_SCALE 1000
118 typedef int processor_set_flavor_t
;
119 #define PROCESSOR_SET_BASIC_INFO 5 /* basic information */
121 struct processor_set_basic_info
{
122 int processor_count
; /* How many processors */
123 int default_policy
; /* When others not enabled */
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))
131 #define PROCESSOR_SET_LOAD_INFO 4 /* scheduling statistics */
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 */
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))
147 * New scheduling control interface
149 #define PROCESSOR_SET_ENABLED_POLICIES 3
150 #define PROCESSOR_SET_ENABLED_POLICIES_COUNT \
151 (sizeof(policy_t)/sizeof(natural_t))
153 #define PROCESSOR_SET_TIMESHARE_DEFAULT 10
154 #define PROCESSOR_SET_TIMESHARE_LIMITS 11
156 #define PROCESSOR_SET_RR_DEFAULT 20
157 #define PROCESSOR_SET_RR_LIMITS 21
159 #define PROCESSOR_SET_FIFO_DEFAULT 30
160 #define PROCESSOR_SET_FIFO_LIMITS 31
162 #endif /* _MACH_PROCESSOR_INFO_H_ */