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