Profile CPU usage of threads in state for howlong, sampling
stacks at frequency Hz.
As an example, using Nyquist's sampling theorem, we see that
sampling at 100Hz will accurately represent components 50Hz or
less; ie. any stack that contributes 2% or more to the total CPU
Note that the maximum sampling frequency is set to 1000Hz.
Anything greater than this is likely to consume considerable
amounts of CPU while sampling.
The profiler will discount its own stacks.
Call record in a thread with the given parameters, returning a
Future representing the completion of the profile.