Merge pull request #2805 from alexrp/profiler-sampling-thread2