xref: /xnu-10002.1.13/osfmk/man/thread_sample.html (revision 1031c584a5e37aff177559b9f69dbd3c8c3fd30a)
1<h2>thread_sample</h2>
2<hr>
3<p>
4<strong>Function</strong> - Perform periodic PC sampling for a thread.
5<h3>SYNOPSIS</h3>
6<pre>
7<strong>kern_return_t   thread_sample</strong>
8                <strong>(thread_act_t</strong>                     <var>sample_thread</var>,
9                 <strong>mach_port_make_send_t</strong>               <var>reply_port</var><strong>);</strong>
10</pre>
11<h3>PARAMETERS</h3>
12<dl>
13<p>
14<dt> <var>sample_thread</var>
15<dd>
16[in thread send right]
17Thread whose PC is to be sampled
18<p>
19<dt> <var>reply_port</var>
20<dd>
21[in sample receive (to be converted to send) right]
22Port to which PC
23sample buffers are sent.  A value of <strong>MACH_PORT_NULL</strong> stops PC
24sampling for the thread.
25</dl>
26<h3>DESCRIPTION</h3>
27<p>
28The <strong>thread_sample</strong> function causes the program counter
29(PC) of the specified
30<var>sample_thread</var> to be sampled periodically (whenever the thread happens to be
31running at the time of the kernel's "hardclock" interrupt).
32The set of PC sample
33values obtained are saved in buffers which are sent to the specified
34<var>reply_port</var> in
35<strong>receive_samples</strong> messages.
36<h3>RETURN VALUES</h3>
37<p>
38Only generic errors apply.
39<h3>RELATED INFORMATION</h3>
40<p>
41Functions:
42<a href="task_sample.html"><strong>task_sample</strong></a>,
43<a href="receive_samples.html"><strong>receive_samples</strong></a>.
44