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@
28 * Revision 1.1.1.1 1998/09/22 21:05:30 wsanchez
29 * Import of Mac OS X kernel (~semeria)
31 * Revision 1.1.1.1 1998/03/07 02:25:46 wsanchez
32 * Import of OSF Mach kernel (~mburg)
34 * Revision 1.2.17.3 1995/01/06 19:52:05 devrcs
35 * mk6 CR668 - 1.3b26 merge
36 * 64bit cleanup, flavor typedefs
37 * [1994/10/14 03:43:17 dwm]
39 * Revision 1.2.17.2 1994/09/23 02:43:16 ezf
40 * change marker to not FREE
41 * [1994/09/22 21:43:12 ezf]
43 * Revision 1.2.17.1 1994/08/07 20:50:11 bolinger
44 * Merge up to colo_b7.
45 * [1994/08/01 21:02:09 bolinger]
47 * Revision 1.2.13.3 1994/06/25 03:47:23 dwm
48 * mk6 CR98 - add flavor interface typedefs.
49 * [1994/06/24 21:55:01 dwm]
51 * Revision 1.2.13.2 1994/05/02 21:36:08 dwm
52 * Remove nmk15_compat support.
53 * [1994/05/02 21:09:13 dwm]
55 * Revision 1.2.13.1 1994/01/12 17:57:31 dwm
56 * Fix "ifdef" NMK15_COMPAT to "if"
57 * [1994/01/12 17:31:16 dwm]
59 * Revision 1.2.3.5 1993/08/03 18:29:54 gm
60 * CR9596: Change KERNEL to MACH_KERNEL.
61 * [1993/08/02 18:56:17 gm]
63 * Revision 1.2.3.4 1993/07/08 19:04:54 watkins
64 * New version of thread_basic_info structure; old version
65 * is now under nmk15_compat.
66 * [1993/07/07 21:04:15 watkins]
68 * Revision 1.2.3.3 1993/06/29 21:55:52 watkins
69 * New definitions for scheduling control interfaces.
70 * [1993/06/29 20:51:04 watkins]
72 * Revision 1.2.3.2 1993/06/09 02:43:43 gm
73 * Added to OSF/1 R1.3 from NMK15.0.
74 * [1993/06/02 21:18:25 jeffc]
76 * Revision 1.2 1993/04/19 16:39:43 devrcs
77 * ansi C conformance changes
78 * [1993/02/02 18:55:07 david]
80 * Revision 1.1 1992/09/30 02:32:13 robert
87 * Revision 2.4 91/05/14 17:01:06 mrt
88 * Correcting copyright
90 * Revision 2.3 91/02/05 17:36:34 mrt
91 * Changed to new Mach copyright
92 * [91/02/01 17:21:39 mrt]
94 * Revision 2.2 90/06/02 15:00:08 rpd
95 * Updated for new scheduling info.
96 * [90/03/26 22:40:55 rpd]
98 * Revision 2.1 89/08/03 16:06:07 rwd
101 * Revision 2.4 89/02/25 18:41:18 gm0w
102 * Changes for cleanup.
104 * 4-Mar-88 David Black (dlb) at Carnegie-Mellon University
105 * Added TH_USAGE_SCALE for cpu_usage field.
107 * 15-Jan-88 David Golub (dbg) at Carnegie-Mellon University
108 * Changed to generic interface (variable-length array) to allow
109 * for expansion. Renamed to thread_info.
111 * 1-Jun-87 Avadis Tevanian (avie) at Carnegie-Mellon University
117 * Mach Operating System
118 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
119 * All Rights Reserved.
121 * Permission to use, copy, modify and distribute this software and its
122 * documentation is hereby granted, provided that both the copyright
123 * notice and this permission notice appear in all copies of the
124 * software, derivative works or modified versions, and any portions
125 * thereof, and that both notices appear in supporting documentation.
127 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
128 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
129 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
131 * Carnegie Mellon requests users of this software to return to
133 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
134 * School of Computer Science
135 * Carnegie Mellon University
136 * Pittsburgh PA 15213-3890
138 * any improvements or extensions that they make and grant Carnegie Mellon
139 * the rights to redistribute these changes.
144 * File: mach/thread_info
146 * Thread information structure and definitions.
148 * The defintions in this file are exported to the user. The kernel
149 * will translate its internal data structures to these structures
154 #ifndef _MACH_THREAD_INFO_H_
155 #define _MACH_THREAD_INFO_H_
157 #include <mach/boolean.h>
158 #include <mach/policy.h>
159 #include <mach/time_value.h>
160 #include <mach/machine/vm_types.h>
163 * Generic information structure to allow for expansion.
165 typedef natural_t thread_flavor_t
;
166 typedef integer_t
*thread_info_t
; /* varying array of int */
168 #define THREAD_INFO_MAX (1024) /* maximum array size */
169 typedef integer_t thread_info_data_t
[THREAD_INFO_MAX
];
172 * Currently defined information.
174 #define THREAD_BASIC_INFO 3 /* basic information */
176 struct thread_basic_info
{
177 time_value_t user_time
; /* user run time */
178 time_value_t system_time
; /* system run time */
179 integer_t cpu_usage
; /* scaled cpu usage percentage */
180 policy_t policy
; /* scheduling policy in effect */
181 integer_t run_state
; /* run state (see below) */
182 integer_t flags
; /* various flags (see below) */
183 integer_t suspend_count
; /* suspend count for thread */
184 integer_t sleep_time
; /* number of seconds that thread
188 typedef struct thread_basic_info thread_basic_info_data_t
;
189 typedef struct thread_basic_info
*thread_basic_info_t
;
190 #define THREAD_BASIC_INFO_COUNT \
191 (sizeof(thread_basic_info_data_t) / sizeof(natural_t))
194 * Scale factor for usage field.
197 #define TH_USAGE_SCALE 1000
200 * Thread run states (state field).
203 #define TH_STATE_RUNNING 1 /* thread is running normally */
204 #define TH_STATE_STOPPED 2 /* thread is stopped */
205 #define TH_STATE_WAITING 3 /* thread is waiting normally */
206 #define TH_STATE_UNINTERRUPTIBLE 4 /* thread is in an uninterruptible
208 #define TH_STATE_HALTED 5 /* thread is halted at a
212 * Thread flags (flags field).
214 #define TH_FLAGS_SWAPPED 0x1 /* thread is swapped out */
215 #define TH_FLAGS_IDLE 0x2 /* thread is an idle thread */
217 #define THREAD_SCHED_TIMESHARE_INFO 10
218 #define THREAD_SCHED_RR_INFO 11
219 #define THREAD_SCHED_FIFO_INFO 12
221 #endif /* _MACH_THREAD_INFO_H_ */