Add COMPlus variable to control rundown. (#16109)
authorBrian Robbins <brianrob@microsoft.com>
Wed, 31 Jan 2018 00:38:39 +0000 (16:38 -0800)
committerGitHub <noreply@github.com>
Wed, 31 Jan 2018 00:38:39 +0000 (16:38 -0800)
src/inc/clrconfigvalues.h
src/vm/eventpipe.cpp

index afb6798..d8dbeca 100644 (file)
@@ -734,6 +734,7 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_AllowDComReflection, W("AllowDComReflection"),
 RETAIL_CONFIG_DWORD_INFO(INTERNAL_EnableEventPipe, W("EnableEventPipe"), 0, "Enable/disable event pipe.  Non-zero values enable tracing.")
 RETAIL_CONFIG_STRING_INFO(INTERNAL_EventPipeOutputFile, W("EventPipeOutputFile"), "The full path including file name for the trace file that will be written when COMPlus_EnableEventPipe&=1")
 RETAIL_CONFIG_STRING_INFO(INTERNAL_EventPipeConfig, W("EventPipeConfig"), "Configuration for EventPipe.")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_EventPipeRundown, W("EventPipeRundown"), 1, "Enable/disable eventpipe rundown.")
 
 #ifdef FEATURE_GDBJIT
 ///
index 2d7e302..026a775 100644 (file)
@@ -369,29 +369,32 @@ void EventPipe::Disable()
         QueryPerformanceCounter(&disableTimeStamp);
         s_pBufferManager->WriteAllBuffersToFile(s_pFile, disableTimeStamp);
 
-        // Before closing the file, do rundown.
-        const unsigned int numRundownProviders = 2;
-        EventPipeProviderConfiguration rundownProviders[] =
+        if(CLRConfig::GetConfigValue(CLRConfig::INTERNAL_EventPipeRundown) > 0)
         {
-            { W("Microsoft-Windows-DotNETRuntime"), 0x80020138, static_cast<unsigned int>(EventPipeEventLevel::Verbose) }, // Public provider.
-            { W("Microsoft-Windows-DotNETRuntimeRundown"), 0x80020138, static_cast<unsigned int>(EventPipeEventLevel::Verbose) } // Rundown provider.
-        };
-        // The circular buffer size doesn't matter because all events are written synchronously during rundown.
-        s_pSession = s_pConfig->CreateSession(1 /* circularBufferSizeInMB */, rundownProviders, numRundownProviders);
-        s_pConfig->EnableRundown(s_pSession);
-
-        // Ask the runtime to emit rundown events.
-        if(g_fEEStarted && !g_fEEShutDown)
-        {
-            ETW::EnumerationLog::EndRundown();
-        }
+            // Before closing the file, do rundown.
+            const unsigned int numRundownProviders = 2;
+            EventPipeProviderConfiguration rundownProviders[] =
+            {
+                { W("Microsoft-Windows-DotNETRuntime"), 0x80020138, static_cast<unsigned int>(EventPipeEventLevel::Verbose) }, // Public provider.
+                { W("Microsoft-Windows-DotNETRuntimeRundown"), 0x80020138, static_cast<unsigned int>(EventPipeEventLevel::Verbose) } // Rundown provider.
+            };
+            // The circular buffer size doesn't matter because all events are written synchronously during rundown.
+            s_pSession = s_pConfig->CreateSession(1 /* circularBufferSizeInMB */, rundownProviders, numRundownProviders);
+            s_pConfig->EnableRundown(s_pSession);
+
+            // Ask the runtime to emit rundown events.
+            if(g_fEEStarted && !g_fEEShutDown)
+            {
+                ETW::EnumerationLog::EndRundown();
+            }
 
-        // Disable the event pipe now that rundown is complete.
-        s_pConfig->Disable(s_pSession);
+            // Disable the event pipe now that rundown is complete.
+            s_pConfig->Disable(s_pSession);
 
-        // Delete the rundown session.
-        s_pConfig->DeleteSession(s_pSession);
-        s_pSession = NULL;
+            // Delete the rundown session.
+            s_pConfig->DeleteSession(s_pSession);
+            s_pSession = NULL;
+        }
 
         if(s_pFile != NULL)
         {