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