xref: /xnu-8792.61.2/osfmk/man/task_sample.html (revision 42e220869062b56f8d7d0726fd4c88954f87902c)
1*42e22086SApple OSS Distributions<h2>task_sample</h2>
2*42e22086SApple OSS Distributions<hr>
3*42e22086SApple OSS Distributions<p>
4*42e22086SApple OSS Distributions<strong>Function</strong> - Sample the target task's thread program counters periodically.
5*42e22086SApple OSS Distributions<h3>SYNOPSIS</h3>
6*42e22086SApple OSS Distributions<pre>
7*42e22086SApple OSS Distributions<strong>kern_return_t   task_sample</strong>
8*42e22086SApple OSS Distributions                <strong>(task_t</strong>                             <var>sample_task</var>,
9*42e22086SApple OSS Distributions                 <strong>mach_port_make_send_t</strong>               <var>reply_port</var><strong>);</strong>
10*42e22086SApple OSS Distributions</pre>
11*42e22086SApple OSS Distributions<h3>PARAMETERS</h3>
12*42e22086SApple OSS Distributions<dl>
13*42e22086SApple OSS Distributions<p>
14*42e22086SApple OSS Distributions<dt> <var>sample_task</var>
15*42e22086SApple OSS Distributions<dd>
16*42e22086SApple OSS Distributions[in task send right]
17*42e22086SApple OSS DistributionsPort for the task whose threads' PC are to be
18*42e22086SApple OSS Distributionssampled.
19*42e22086SApple OSS Distributions<p>
20*42e22086SApple OSS Distributions<dt> <var>reply_port</var>
21*42e22086SApple OSS Distributions<dd>
22*42e22086SApple OSS Distributions[in sample receive (to be converted to send) right]
23*42e22086SApple OSS DistributionsPort to which PC sample buffers are sent.  A value of <strong>MACH_PORT_NULL</strong>
24*42e22086SApple OSS Distributionsstops PC sampling for the task.
25*42e22086SApple OSS Distributions</dl>
26*42e22086SApple OSS Distributions<h3>DESCRIPTION</h3>
27*42e22086SApple OSS Distributions<p>
28*42e22086SApple OSS DistributionsThe <strong>task_sample</strong> function causes the program counter (PC) of the
29*42e22086SApple OSS Distributionsspecified <var>sample_task</var> (actually, all of the threads within
30*42e22086SApple OSS Distributions<var>sample_task</var>) to be sampled periodically (whenever one of the threads
31*42e22086SApple OSS Distributionshappens to be running at the time of the kernel's "hardclock" interrupt).
32*42e22086SApple OSS DistributionsThe set of PC sample values obtained are saved in buffers which are sent to
33*42e22086SApple OSS Distributionsthe specified <var>reply_port</var> in <strong>receive_samples</strong> messages.
34*42e22086SApple OSS Distributions<h3>RETURN VALUES</h3>
35*42e22086SApple OSS Distributions<p>
36*42e22086SApple OSS DistributionsOnly generic errors apply.
37*42e22086SApple OSS Distributions<h3>RELATED INFORMATION</h3>
38*42e22086SApple OSS Distributions<p>
39*42e22086SApple OSS DistributionsFunctions:
40*42e22086SApple OSS Distributions<a href="thread_sample.html"><strong>thread_sample</strong></a>,
41*42e22086SApple OSS Distributions<a href="receive_samples.html"><strong>receive_samples</strong></a>.
42