]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/task_info.h
bc7283aa25a2fb84ac56ae88e94b81578983c924
[apple/xnu.git] / osfmk / mach / task_info.h
1 /*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * @OSF_COPYRIGHT@
25 */
26 /*
27 * Mach Operating System
28 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
29 * All Rights Reserved.
30 *
31 * Permission to use, copy, modify and distribute this software and its
32 * documentation is hereby granted, provided that both the copyright
33 * notice and this permission notice appear in all copies of the
34 * software, derivative works or modified versions, and any portions
35 * thereof, and that both notices appear in supporting documentation.
36 *
37 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
38 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
39 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
40 *
41 * Carnegie Mellon requests users of this software to return to
42 *
43 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
44 * School of Computer Science
45 * Carnegie Mellon University
46 * Pittsburgh PA 15213-3890
47 *
48 * any improvements or extensions that they make and grant Carnegie Mellon
49 * the rights to redistribute these changes.
50 */
51 /*
52 */
53 /*
54 * Machine-independent task information structures and definitions.
55 *
56 * The definitions in this file are exported to the user. The kernel
57 * will translate its internal data structures to these structures
58 * as appropriate.
59 *
60 */
61
62 #ifndef _MACH_TASK_INFO_H_
63 #define _MACH_TASK_INFO_H_
64
65 #include <mach/message.h>
66 #include <mach/machine/vm_types.h>
67 #include <mach/time_value.h>
68 #include <mach/policy.h>
69
70 #include <sys/cdefs.h>
71
72 /*
73 * Generic information structure to allow for expansion.
74 */
75 typedef natural_t task_flavor_t;
76 typedef integer_t *task_info_t; /* varying array of int */
77
78 #define TASK_INFO_MAX (1024) /* maximum array size */
79 typedef integer_t task_info_data_t[TASK_INFO_MAX];
80
81 /*
82 * Currently defined information structures.
83 */
84
85 #if __DARWIN_ALIGN_POWER
86 #pragma options align=power
87 #endif
88
89 #define TASK_BASIC_INFO_32 4 /* basic information */
90
91 struct task_basic_info_32 {
92 integer_t suspend_count; /* suspend count for task */
93 natural_t virtual_size; /* virtual memory size (bytes) */
94 natural_t resident_size; /* resident memory size (bytes) */
95 time_value_t user_time; /* total user run time for
96 terminated threads */
97 time_value_t system_time; /* total system run time for
98 terminated threads */
99 policy_t policy; /* default policy for new threads */
100 };
101 typedef struct task_basic_info_32 task_basic_info_32_data_t;
102 typedef struct task_basic_info_32 *task_basic_info_32_t;
103 #define TASK_BASIC_INFO_32_COUNT \
104 (sizeof(task_basic_info_32_data_t) / sizeof(natural_t))
105
106
107 #define TASK_BASIC_INFO_64 5 /* 64-bit capable basic info */
108
109 struct task_basic_info_64 {
110 integer_t suspend_count; /* suspend count for task */
111 mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
112 mach_vm_size_t resident_size; /* resident memory size (bytes) */
113 time_value_t user_time; /* total user run time for
114 terminated threads */
115 time_value_t system_time; /* total system run time for
116 terminated threads */
117 policy_t policy; /* default policy for new threads */
118 };
119 typedef struct task_basic_info_64 task_basic_info_64_data_t;
120 typedef struct task_basic_info_64 *task_basic_info_64_t;
121 #define TASK_BASIC_INFO_64_COUNT \
122 (sizeof(task_basic_info_64_data_t) / sizeof(natural_t))
123
124
125 /* localized structure - cannot be safely passed between tasks of differing sizes */
126
127 struct task_basic_info {
128 integer_t suspend_count; /* suspend count for task */
129 vm_size_t virtual_size; /* virtual memory size (bytes) */
130 vm_size_t resident_size; /* resident memory size (bytes) */
131 time_value_t user_time; /* total user run time for
132 terminated threads */
133 time_value_t system_time; /* total system run time for
134 terminated threads */
135 policy_t policy; /* default policy for new threads */
136 };
137
138 typedef struct task_basic_info task_basic_info_data_t;
139 typedef struct task_basic_info *task_basic_info_t;
140 #define TASK_BASIC_INFO_COUNT \
141 (sizeof(task_basic_info_data_t) / sizeof(natural_t))
142 #if !defined(__LP64__)
143 #define TASK_BASIC_INFO TASK_BASIC_INFO_32
144 #else
145 #define TASK_BASIC_INFO TASK_BASIC_INFO_64
146 #endif
147
148
149
150 #define TASK_EVENTS_INFO 2 /* various event counts */
151
152 struct task_events_info {
153 integer_t faults; /* number of page faults */
154 integer_t pageins; /* number of actual pageins */
155 integer_t cow_faults; /* number of copy-on-write faults */
156 integer_t messages_sent; /* number of messages sent */
157 integer_t messages_received; /* number of messages received */
158 integer_t syscalls_mach; /* number of mach system calls */
159 integer_t syscalls_unix; /* number of unix system calls */
160 integer_t csw; /* number of context switches */
161 };
162 typedef struct task_events_info task_events_info_data_t;
163 typedef struct task_events_info *task_events_info_t;
164 #define TASK_EVENTS_INFO_COUNT ((mach_msg_type_number_t) \
165 (sizeof(task_events_info_data_t) / sizeof(natural_t)))
166
167 #define TASK_THREAD_TIMES_INFO 3 /* total times for live threads -
168 only accurate if suspended */
169
170 struct task_thread_times_info {
171 time_value_t user_time; /* total user run time for
172 live threads */
173 time_value_t system_time; /* total system run time for
174 live threads */
175 };
176
177 typedef struct task_thread_times_info task_thread_times_info_data_t;
178 typedef struct task_thread_times_info *task_thread_times_info_t;
179 #define TASK_THREAD_TIMES_INFO_COUNT ((mach_msg_type_number_t) \
180 (sizeof(task_thread_times_info_data_t) / sizeof(natural_t)))
181
182 #define TASK_ABSOLUTETIME_INFO 1
183
184 struct task_absolutetime_info {
185 uint64_t total_user; /* total time */
186 uint64_t total_system;
187 uint64_t threads_user; /* existing threads only */
188 uint64_t threads_system;
189 };
190
191 typedef struct task_absolutetime_info task_absolutetime_info_data_t;
192 typedef struct task_absolutetime_info *task_absolutetime_info_t;
193 #define TASK_ABSOLUTETIME_INFO_COUNT ((mach_msg_type_number_t) \
194 (sizeof (task_absolutetime_info_data_t) / sizeof (natural_t)))
195
196 #define TASK_SECURITY_TOKEN 13
197 #define TASK_SECURITY_TOKEN_COUNT ((mach_msg_type_number_t) \
198 (sizeof(security_token_t) / sizeof(natural_t)))
199
200 #define TASK_AUDIT_TOKEN 15
201 #define TASK_AUDIT_TOKEN_COUNT \
202 (sizeof(audit_token_t) / sizeof(natural_t))
203
204 #if __DARWIN_ALIGN_POWER
205 #pragma options align=reset
206 #endif
207
208
209 /*
210 * Obsolete interfaces.
211 */
212
213 #define TASK_SCHED_TIMESHARE_INFO 10
214 #define TASK_SCHED_RR_INFO 11
215 #define TASK_SCHED_FIFO_INFO 12
216
217 #define TASK_SCHED_INFO 14
218
219 #endif /* _MACH_TASK_INFO_H_ */