osfmk/man/thread_sample.html
Function - Perform periodic PC sampling for a thread.
**kern\_return\_t thread\_sample**** (thread\_act\_t **sample\_thread,** mach\_port\_make\_send\_t **reply\_port** );**
sample_thread[in thread send right] Thread whose PC is to be sampled
reply_port[in sample receive (to be converted to send) right] Port to which PC sample buffers are sent. A value of MACH_PORT_NULL stops PC sampling for the thread.
The thread_sample function causes the program counter (PC) of the specified sample_thread to be sampled periodically (whenever the thread happens to be running at the time of the kernel's "hardclock" interrupt). The set of PC sample values obtained are saved in buffers which are sent to the specified reply_port in receive_samples messages.
Only generic errors apply.
Functions: task_sample, receive_samples.