Don't create the sampling thread if the threadtime event is disabled. (#15473)
authorBrian Robbins <brianrob@microsoft.com>
Tue, 12 Dec 2017 22:19:19 +0000 (14:19 -0800)
committerGitHub <noreply@github.com>
Tue, 12 Dec 2017 22:19:19 +0000 (14:19 -0800)
src/vm/sampleprofiler.cpp

index 4a858e9..d99667e 100644 (file)
@@ -45,6 +45,12 @@ void SampleProfiler::Enable()
             false /* NeedStack */);
     }
 
+    // Check to see if the sample profiler event is enabled.  If it is not, do not spin up the sampling thread.
+    if(!s_pThreadTimeEvent->IsEnabled())
+    {
+        return;
+    }
+
     if(s_pPayloadExternal == NULL)
     {
         s_pPayloadExternal = new BYTE[sizeof(unsigned int)];