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