1 .\"
2 .\" Mach Operating System
3 .\" Copyright (c) 1991,1990 Carnegie Mellon University
4 .\" All Rights Reserved.
5 .\"
6 .\" Permission to use, copy, modify and distribute this software and its
7 .\" documentation is hereby granted, provided that both the copyright
8 .\" notice and this permission notice appear in all copies of the
9 .\" software, derivative works or modified versions, and any portions
10 .\" thereof, and that both notices appear in supporting documentation.
11 .\"
12 .\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 .\" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 .\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 .\"
16 .\" Carnegie Mellon requests users of this software to return to
17 .\"
18 .\" Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 .\" School of Computer Science
20 .\" Carnegie Mellon University
21 .\" Pittsburgh PA 15213-3890
22 .\"
23 .\" any improvements or extensions that they make and grant Carnegie Mellon
24 .\" the rights to redistribute these changes.
25 .\"
26 .\"
27 .\" HISTORY
28 .\" $Log: thread_info.man,v $
29 .\" Revision 2.5 93/03/18 15:15:47 mrt
30 .\" corrected types
31 .\" [93/03/12 16:54:11 lli]
32 .\"
33 .\" Revision 2.4 91/05/14 17:14:01 mrt
34 .\" Correcting copyright
35 .\"
36 .\" Revision 2.3 91/02/14 14:15:16 mrt
37 .\" Changed to new Mach copyright
38 .\" [91/02/12 18:16:06 mrt]
39 .\"
40 .\" Revision 2.2 90/08/07 18:45:59 rpd
41 .\" Created.
42 .\"
43 .TH thread_info 2 1/20/88
44 .CM 4
45 .SH NAME
46 .nf
47 thread_info \- gets thread machine independent information
48 .SH SYNOPSIS
49 .nf
50 .ft B
51 #include <mach.h>
52
53 /* the definition of thread_info_data_t from mach.h - mach/thread_info.h is */
54
55 typedef int *thread_info_t; /* variable length array of int */
56
57 /* only current interpretation of thread_info */
58
59 struct thread_basic_info {
60 time_value_t user_time; /* user run time */
61 time_value_t system_time; /* system run time */
62 int cpu_usage; /* scaled cpu usage percentage */
63 int base_priority; /* base scheduling priority */
64 int cur_priority; /* current scheduling priority */
65 int run_state; /* run state (see below) */
66 int flags; /* various flags (see below) */
67 int suspend_count; /* suspend count for thread */
68 long sleep_time; /* number of seconds that thread
69 has been sleeping */
70 };
71 typedef struct thread_basic_info *thread_basic_info_t;
72
73 The possible values of the run_state field are:
74 TH_STATE_RUNNING, thread is running normally
75 TH_STATE_STOPPED, thread is suspended
76 TH_STATE_WAITING, thread is waiting normally
77 TH_STATE_UNINTERRUPTIBLE, thread is in an uninterruptible wait
78 TH_STATE_HALTED, thread is halted at a clean point
79
80 The possible values of the flags field are:
81 TH_FLAGS_SWAPPED, thread is swapped out
82 TH_FLAGS_IDLE, thread is an idle thread
83
84
85 .nf
86 .ft B
87 kern_return_t thread_info(target_thread, flavor, thread_info,
88 thread_infoCnt)
89 mach_port_t target_thread;
90 int flavor;
91 thread_info_t thread_info; /* in and out */
92 mach_msg_type_number_t *thread_infoCnt; /* in and out */
93
94
95 .fi
96 .ft P
97 .SH ARGUMENTS
98 .TP 15
99 .B
100 target_thread
101 The thread to be affected.
102 .TP 15
103 .B
104 flavor
105 The type of statistics that are wanted. Currently only
106 .B THREAD_BASIC_INFO
107 is implemented.
108 .TP 15
109 .B
110 thread_info
111 Statistics about the thread specified by
112 .B target_thread
113 .
114 .TP 15
115 .B
116 thread_infoCnt
117 Size of the info structure. Currently only
118 .B THREAD_BASIC_INFO_COUNT
119 is implemented.
120
121 .SH DESCRIPTION
122
123 Returns the selected information array for a thread, as specified
124 by
125 .B flavor
126 .
127 .B thread_info
128 is an array of integers that is supplied
129 by the caller and returned filled with specified information.
130 .B thread_infoCnt
131 is supplied as the maximum number of integers in
132 .B thread_info
133 . On return,
134 it contains the actual number of integers in
135 .B thread_info
136 .
137
138 Currently there is only one flavor of information which is defined
139 by
140 .B THREAD_BASIC_INFO
141 . Its size is defined by
142 .B THREAD_BASIC_INFO_COUNT
143 .
144
145
146 .SH DIAGNOSTICS
147 .TP 25
148 KERN_SUCCESS
149 The call succeeded.
150 .TP 25
151 KERN_INVALID_ARGUMENT
152 .B target_thread
153 is not a thread or
154 .B flavor
155 is not recognized.
156 .TP 25
157 MIG_ARRAY_TOO_LARGE
158 Returned info array is too large for
159 .B thread_info
160 .
161 .B thread_info
162 is filled as much as possible.
163 .B thread_infoCnt
164 is set to the number of elements that would
165 have been returned if there were enough room.
166
167 .SH SEE ALSO
168 .B thread_special_ports, task_threads,
169 .B task_info, thread_state
170
171
172
173
Cache object: 55770af17b66c0cfe13646e57d78328a
|