]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/task_info.h
df7da10a39f9ab1f4ed51157184cfd0eeb17ae53
[apple/xnu.git] / osfmk / mach / task_info.h
1 /*
2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
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
13 * file.
14 *
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.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * @OSF_COPYRIGHT@
27 */
28 /*
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
31 * All Rights Reserved.
32 *
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.
38 *
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.
42 *
43 * Carnegie Mellon requests users of this software to return to
44 *
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
49 *
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
52 */
53 /*
54 */
55 /*
56 * Machine-independent task information structures and definitions.
57 *
58 * The definitions in this file are exported to the user. The kernel
59 * will translate its internal data structures to these structures
60 * as appropriate.
61 *
62 */
63
64 #ifndef TASK_INFO_H_
65 #define TASK_INFO_H_
66
67 #include <mach/machine/vm_types.h>
68 #include <mach/time_value.h>
69 #include <mach/policy.h>
70
71 #include <sys/appleapiopts.h>
72
73 /*
74 * Generic information structure to allow for expansion.
75 */
76 typedef natural_t task_flavor_t;
77 typedef integer_t *task_info_t; /* varying array of int */
78
79 #define TASK_INFO_MAX (1024) /* maximum array size */
80 typedef integer_t task_info_data_t[TASK_INFO_MAX];
81
82 /*
83 * Currently defined information structures.
84 */
85
86 #define TASK_BASIC_INFO 4 /* basic information */
87
88 struct task_basic_info {
89 integer_t suspend_count; /* suspend count for task */
90 vm_size_t virtual_size; /* number of virtual pages */
91 vm_size_t resident_size; /* number of resident pages */
92 time_value_t user_time; /* total user run time for
93 terminated threads */
94 time_value_t system_time; /* total system run time for
95 terminated threads */
96 policy_t policy; /* default policy for new threads */
97 };
98
99 typedef struct task_basic_info task_basic_info_data_t;
100 typedef struct task_basic_info *task_basic_info_t;
101 #define TASK_BASIC_INFO_COUNT \
102 (sizeof(task_basic_info_data_t) / sizeof(natural_t))
103
104
105 #define TASK_EVENTS_INFO 2 /* various event counts */
106
107 struct task_events_info {
108 integer_t faults; /* number of page faults */
109 integer_t pageins; /* number of actual pageins */
110 integer_t cow_faults; /* number of copy-on-write faults */
111 integer_t messages_sent; /* number of messages sent */
112 integer_t messages_received; /* number of messages received */
113 integer_t syscalls_mach; /* number of mach system calls */
114 integer_t syscalls_unix; /* number of unix system calls */
115 integer_t csw; /* number of context switches */
116 };
117 typedef struct task_events_info task_events_info_data_t;
118 typedef struct task_events_info *task_events_info_t;
119 #define TASK_EVENTS_INFO_COUNT \
120 (sizeof(task_events_info_data_t) / sizeof(natural_t))
121
122 #define TASK_THREAD_TIMES_INFO 3 /* total times for live threads -
123 only accurate if suspended */
124
125 struct task_thread_times_info {
126 time_value_t user_time; /* total user run time for
127 live threads */
128 time_value_t system_time; /* total system run time for
129 live threads */
130 };
131
132 typedef struct task_thread_times_info task_thread_times_info_data_t;
133 typedef struct task_thread_times_info *task_thread_times_info_t;
134 #define TASK_THREAD_TIMES_INFO_COUNT \
135 (sizeof(task_thread_times_info_data_t) / sizeof(natural_t))
136
137 #ifdef __APPLE_API_UNSTABLE
138
139 #define TASK_SCHED_TIMESHARE_INFO 10
140 #define TASK_SCHED_RR_INFO 11
141 #define TASK_SCHED_FIFO_INFO 12
142
143 #define TASK_SCHED_INFO 14
144
145 #endif /* __APPLE_API_UNSTABLE */
146
147 #define TASK_SECURITY_TOKEN 13
148 #define TASK_SECURITY_TOKEN_COUNT \
149 (sizeof(security_token_t) / sizeof(natural_t))
150
151 #define TASK_AUDIT_TOKEN 15
152 #define TASK_AUDIT_TOKEN_COUNT \
153 (sizeof(audit_token_t) / sizeof(natural_t))
154
155 #endif /* TASK_INFO_H_ */