2 * Copyright (c) 2000-2003 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,1988,1987 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.
53 * Machine-independent task information structures and definitions.
55 * The definitions in this file are exported to the user. The kernel
56 * will translate its internal data structures to these structures
64 #include <mach/machine/vm_types.h>
65 #include <mach/time_value.h>
66 #include <mach/policy.h>
68 #include <sys/appleapiopts.h>
71 * Generic information structure to allow for expansion.
73 typedef natural_t task_flavor_t
;
74 typedef integer_t
*task_info_t
; /* varying array of int */
76 #define TASK_INFO_MAX (1024) /* maximum array size */
77 typedef integer_t task_info_data_t
[TASK_INFO_MAX
];
80 * Currently defined information structures.
83 #define TASK_BASIC_INFO 4 /* basic information */
85 struct task_basic_info
{
86 integer_t suspend_count
; /* suspend count for task */
87 vm_size_t virtual_size
; /* number of virtual pages */
88 vm_size_t resident_size
; /* number of resident pages */
89 time_value_t user_time
; /* total user run time for
91 time_value_t system_time
; /* total system run time for
93 policy_t policy
; /* default policy for new threads */
96 typedef struct task_basic_info task_basic_info_data_t
;
97 typedef struct task_basic_info
*task_basic_info_t
;
98 #define TASK_BASIC_INFO_COUNT \
99 (sizeof(task_basic_info_data_t) / sizeof(natural_t))
102 #define TASK_EVENTS_INFO 2 /* various event counts */
104 struct task_events_info
{
105 integer_t faults
; /* number of page faults */
106 integer_t pageins
; /* number of actual pageins */
107 integer_t cow_faults
; /* number of copy-on-write faults */
108 integer_t messages_sent
; /* number of messages sent */
109 integer_t messages_received
; /* number of messages received */
110 integer_t syscalls_mach
; /* number of mach system calls */
111 integer_t syscalls_unix
; /* number of unix system calls */
112 integer_t csw
; /* number of context switches */
114 typedef struct task_events_info task_events_info_data_t
;
115 typedef struct task_events_info
*task_events_info_t
;
116 #define TASK_EVENTS_INFO_COUNT \
117 (sizeof(task_events_info_data_t) / sizeof(natural_t))
119 #define TASK_THREAD_TIMES_INFO 3 /* total times for live threads -
120 only accurate if suspended */
122 struct task_thread_times_info
{
123 time_value_t user_time
; /* total user run time for
125 time_value_t system_time
; /* total system run time for
129 typedef struct task_thread_times_info task_thread_times_info_data_t
;
130 typedef struct task_thread_times_info
*task_thread_times_info_t
;
131 #define TASK_THREAD_TIMES_INFO_COUNT \
132 (sizeof(task_thread_times_info_data_t) / sizeof(natural_t))
134 #ifdef __APPLE_API_UNSTABLE
136 #define TASK_SCHED_TIMESHARE_INFO 10
137 #define TASK_SCHED_RR_INFO 11
138 #define TASK_SCHED_FIFO_INFO 12
140 #define TASK_SCHED_INFO 14
142 #endif /* __APPLE_API_UNSTABLE */
144 #define TASK_SECURITY_TOKEN 13
145 #define TASK_SECURITY_TOKEN_COUNT \
146 (sizeof(security_token_t) / sizeof(natural_t))
148 #define TASK_AUDIT_TOKEN 15
149 #define TASK_AUDIT_TOKEN_COUNT \
150 (sizeof(audit_token_t) / sizeof(natural_t))
152 #endif /* TASK_INFO_H_ */