]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/bsdtask_info.h
a18c56fc8e5a5298bbabfcd41e3dc7c3b52dbe3f
[apple/xnu.git] / bsd / sys / bsdtask_info.h
1
2 /*
3 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
4 *
5 * @APPLE_LICENSE_HEADER_START@
6 *
7 * The contents of this file constitute Original Code as defined in and
8 * are subject to the Apple Public Source License Version 1.1 (the
9 * "License"). You may not use this file except in compliance with the
10 * License. Please obtain a copy of the License at
11 * http://www.apple.com/publicsource and read it before using this file.
12 *
13 * This 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 OR NON-INFRINGEMENT. Please see the
18 * License for the specific language governing rights and limitations
19 * under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef _SYS_BSDTASK_INFO_H
25 #define _SYS_BSDTASK_INFO_H
26
27 struct proc_taskinfo_internal {
28 uint64_t pti_virtual_size; /* virtual memory size (bytes) */
29 uint64_t pti_resident_size; /* resident memory size (bytes) */
30 uint64_t pti_total_user; /* total time */
31 uint64_t pti_total_system;
32 uint64_t pti_threads_user; /* existing threads only */
33 uint64_t pti_threads_system;
34 int32_t pti_policy; /* default policy for new threads */
35 int32_t pti_faults; /* number of page faults */
36 int32_t pti_pageins; /* number of actual pageins */
37 int32_t pti_cow_faults; /* number of copy-on-write faults */
38 int32_t pti_messages_sent; /* number of messages sent */
39 int32_t pti_messages_received; /* number of messages received */
40 int32_t pti_syscalls_mach; /* number of mach system calls */
41 int32_t pti_syscalls_unix; /* number of unix system calls */
42 int32_t pti_csw; /* number of context switches */
43 int32_t pti_threadnum; /* number of threads in the task */
44 int32_t pti_numrunning; /* number of running threads */
45 int32_t pti_priority; /* task priority*/
46 };
47
48
49 struct proc_threadinfo_internal {
50 uint64_t pth_user_time; /* user run time */
51 uint64_t pth_system_time; /* system run time */
52 int32_t pth_cpu_usage; /* scaled cpu usage percentage */
53 int32_t pth_policy; /* scheduling policy in effect */
54 int32_t pth_run_state; /* run state (see below) */
55 int32_t pth_flags; /* various flags (see below) */
56 int32_t pth_sleep_time; /* number of seconds that thread */
57 int32_t pth_curpri; /* cur priority*/
58 int32_t pth_priority; /* priority*/
59 int32_t pth_maxpriority; /* max priority*/
60 };
61
62
63
64 struct proc_regioninfo_internal {
65 uint32_t pri_protection;
66 uint32_t pri_max_protection;
67 uint32_t pri_inheritance;
68 uint32_t pri_flags; /* shared, external pager, is submap */
69 uint64_t pri_offset;
70 uint32_t pri_behavior;
71 uint32_t pri_user_wired_count;
72 uint32_t pri_user_tag;
73 uint32_t pri_pages_resident;
74 uint32_t pri_pages_shared_now_private;
75 uint32_t pri_pages_swapped_out;
76 uint32_t pri_pages_dirtied;
77 uint32_t pri_ref_count;
78 uint32_t pri_shadow_depth;
79 uint32_t pri_share_mode;
80 uint32_t pri_private_pages_resident;
81 uint32_t pri_shared_pages_resident;
82 uint32_t pri_obj_id;
83 uint64_t pri_address;
84 uint64_t pri_size;
85 uint32_t pri_depth;
86 };
87
88 #ifdef MACH_KERNEL_PRIVATE
89
90 #define PROC_REGION_SUBMAP 1
91 #define PROC_REGION_SHARED 2
92
93 void vm_map_region_top_walk(vm_map_entry_t entry, vm_region_top_info_t top);
94 void vm_map_region_walk(vm_map_t map, vm_map_offset_t a, vm_map_entry_t entry, vm_object_offset_t offset, vm_object_size_t range, vm_region_extended_info_t extended);
95 kern_return_t vnode_pager_get_object_vnode(memory_object_t mem_obj,uint32_t * vnodeaddr, uint32_t * vid);
96 extern uint32_t vnode_vid(void *vp);
97
98 #endif /* MACH_KERNEL_PRIVATE */
99
100 extern int fill_procregioninfo(task_t t, uint64_t arg, struct proc_regioninfo_internal *pinfo, uint32_t *vp, uint32_t *vid);
101 void fill_taskprocinfo(task_t task, struct proc_taskinfo_internal * ptinfo);
102 int fill_taskthreadinfo(task_t task, uint64_t thaddr, struct proc_threadinfo_internal * ptinfo);
103 int fill_taskthreadlist(task_t task, void * buffer, int thcount);
104 int get_numthreads(task_t);
105
106
107 #endif /*_SYS_BSDTASK_INFO_H */
108