## thread_sample

Function - Perform periodic PC sampling for a thread.

### SYNOPSIS

    kern_return_t   thread_sample
                    (thread_act_t                     sample_thread,
                     mach_port_make_send_t               reply_port);

### PARAMETERS

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.

### DESCRIPTION

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.

### RETURN VALUES

Only generic errors apply.

### RELATED INFORMATION

Functions: task_sample, receive_samples.