## task_sample

Function - Sample the target task's thread program counters periodically.

### SYNOPSIS

    kern_return_t   task_sample
                    (task_t                             sample_task,
                     mach_port_make_send_t               reply_port);

### PARAMETERS

sample_task
  [in task send right] Port for the task whose threads' PC are 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 task.

### DESCRIPTION

The task_sample function causes the program counter (PC) of the specified sample_task (actually, all of the threads within sample_task) to be sampled periodically (whenever one of the threads 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: thread_sample, receive_samples.