]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/task_info.h
xnu-517.11.1.tar.gz
[apple/xnu.git] / osfmk / mach / task_info.h
CommitLineData
1c79356b 1/*
55e303ae 2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
1c79356b
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
e5568f75
A
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.
1c79356b 11 *
e5568f75
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
e5568f75
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
1c79356b
A
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * @OSF_COPYRIGHT@
24 */
1c79356b
A
25/*
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
28 * All Rights Reserved.
29 *
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.
35 *
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.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50/*
51 */
52/*
53 * Machine-independent task information structures and definitions.
54 *
55 * The definitions in this file are exported to the user. The kernel
56 * will translate its internal data structures to these structures
57 * as appropriate.
58 *
59 */
60
61#ifndef TASK_INFO_H_
62#define TASK_INFO_H_
63
64#include <mach/machine/vm_types.h>
65#include <mach/time_value.h>
66#include <mach/policy.h>
67
9bccf70c
A
68#include <sys/appleapiopts.h>
69
1c79356b
A
70/*
71 * Generic information structure to allow for expansion.
72 */
73typedef natural_t task_flavor_t;
74typedef integer_t *task_info_t; /* varying array of int */
75
76#define TASK_INFO_MAX (1024) /* maximum array size */
77typedef integer_t task_info_data_t[TASK_INFO_MAX];
78
79/*
80 * Currently defined information structures.
81 */
82
83#define TASK_BASIC_INFO 4 /* basic information */
84
85struct 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
90 terminated threads */
91 time_value_t system_time; /* total system run time for
92 terminated threads */
93 policy_t policy; /* default policy for new threads */
94};
95
96typedef struct task_basic_info task_basic_info_data_t;
97typedef struct task_basic_info *task_basic_info_t;
98#define TASK_BASIC_INFO_COUNT \
99 (sizeof(task_basic_info_data_t) / sizeof(natural_t))
100
101
102#define TASK_EVENTS_INFO 2 /* various event counts */
103
104struct 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 */
113};
114typedef struct task_events_info task_events_info_data_t;
115typedef struct task_events_info *task_events_info_t;
116#define TASK_EVENTS_INFO_COUNT \
117 (sizeof(task_events_info_data_t) / sizeof(natural_t))
118
119#define TASK_THREAD_TIMES_INFO 3 /* total times for live threads -
120 only accurate if suspended */
121
122struct task_thread_times_info {
123 time_value_t user_time; /* total user run time for
124 live threads */
125 time_value_t system_time; /* total system run time for
126 live threads */
127};
128
129typedef struct task_thread_times_info task_thread_times_info_data_t;
130typedef 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))
133
9bccf70c
A
134#ifdef __APPLE_API_UNSTABLE
135
1c79356b
A
136#define TASK_SCHED_TIMESHARE_INFO 10
137#define TASK_SCHED_RR_INFO 11
138#define TASK_SCHED_FIFO_INFO 12
139
9bccf70c
A
140#define TASK_SCHED_INFO 14
141
142#endif /* __APPLE_API_UNSTABLE */
143
1c79356b
A
144#define TASK_SECURITY_TOKEN 13
145#define TASK_SECURITY_TOKEN_COUNT \
146 (sizeof(security_token_t) / sizeof(natural_t))
147
55e303ae
A
148#define TASK_AUDIT_TOKEN 15
149#define TASK_AUDIT_TOKEN_COUNT \
150 (sizeof(audit_token_t) / sizeof(natural_t))
151
1c79356b 152#endif /* TASK_INFO_H_ */