2 * Copyright (c) 2000-2005 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/message.h>
65 #include <mach/machine.h>
66 #include <mach/machine/processor_info.h>
69 * Generic information structure to allow for expansion.
71 typedef integer_t
*processor_info_t
; /* varying array of int. */
72 typedef integer_t
*processor_info_array_t
; /* varying array of int */
74 #define PROCESSOR_INFO_MAX (1024) /* max array size */
75 typedef integer_t processor_info_data_t
[PROCESSOR_INFO_MAX
];
78 typedef integer_t
*processor_set_info_t
; /* varying array of int. */
80 #define PROCESSOR_SET_INFO_MAX (1024) /* max array size */
81 typedef integer_t processor_set_info_data_t
[PROCESSOR_SET_INFO_MAX
];
84 * Currently defined information.
86 typedef int processor_flavor_t
;
87 #define PROCESSOR_BASIC_INFO 1 /* basic information */
88 #define PROCESSOR_CPU_LOAD_INFO 2 /* cpu load information */
89 #define PROCESSOR_PM_REGS_INFO 0x10000001 /* performance monitor register info */
90 #define PROCESSOR_TEMPERATURE 0x10000002 /* Processor core temperature */
92 struct processor_basic_info
{
93 cpu_type_t cpu_type
; /* type of cpu */
94 cpu_subtype_t cpu_subtype
; /* subtype of cpu */
95 boolean_t running
; /* is processor running */
96 int slot_num
; /* slot number */
97 boolean_t is_master
; /* is this the master processor */
100 typedef struct processor_basic_info processor_basic_info_data_t
;
101 typedef struct processor_basic_info
*processor_basic_info_t
;
102 #define PROCESSOR_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
103 (sizeof(processor_basic_info_data_t)/sizeof(natural_t)))
105 struct processor_cpu_load_info
{ /* number of ticks while running... */
106 unsigned long cpu_ticks
[CPU_STATE_MAX
]; /* ... in the given mode */
109 typedef struct processor_cpu_load_info processor_cpu_load_info_data_t
;
110 typedef struct processor_cpu_load_info
*processor_cpu_load_info_t
;
111 #define PROCESSOR_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
112 (sizeof(processor_cpu_load_info_data_t)/sizeof(natural_t)))
115 * Scaling factor for load_average, mach_factor.
117 #define LOAD_SCALE 1000
119 typedef int processor_set_flavor_t
;
120 #define PROCESSOR_SET_BASIC_INFO 5 /* basic information */
122 struct processor_set_basic_info
{
123 int processor_count
; /* How many processors */
124 int default_policy
; /* When others not enabled */
127 typedef struct processor_set_basic_info processor_set_basic_info_data_t
;
128 typedef struct processor_set_basic_info
*processor_set_basic_info_t
;
129 #define PROCESSOR_SET_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
130 (sizeof(processor_set_basic_info_data_t)/sizeof(natural_t)))
132 #define PROCESSOR_SET_LOAD_INFO 4 /* scheduling statistics */
134 struct processor_set_load_info
{
135 int task_count
; /* How many tasks */
136 int thread_count
; /* How many threads */
137 integer_t load_average
; /* Scaled */
138 integer_t mach_factor
; /* Scaled */
141 typedef struct processor_set_load_info processor_set_load_info_data_t
;
142 typedef struct processor_set_load_info
*processor_set_load_info_t
;
143 #define PROCESSOR_SET_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
144 (sizeof(processor_set_load_info_data_t)/sizeof(natural_t)))
148 #define PROCESSOR_SET_ENABLED_POLICIES 3
149 #define PROCESSOR_SET_ENABLED_POLICIES_COUNT ((mach_msg_type_number_t) \
150 (sizeof(policy_t)/sizeof(natural_t)))
152 #define PROCESSOR_SET_TIMESHARE_DEFAULT 10
153 #define PROCESSOR_SET_TIMESHARE_LIMITS 11
155 #define PROCESSOR_SET_RR_DEFAULT 20
156 #define PROCESSOR_SET_RR_LIMITS 21
158 #define PROCESSOR_SET_FIFO_DEFAULT 30
159 #define PROCESSOR_SET_FIFO_LIMITS 31
163 #endif /* _MACH_PROCESSOR_INFO_H_ */