@@ -19,6 +19,7 @@ EventPipeConfiguration::EventPipeConfiguration()
1919 STANDARD_VM_CONTRACT;
2020
2121 m_enabled = false ;
22+ m_rundownEnabled = false ;
2223 m_circularBufferSizeInBytes = 1024 * 1024 * 1000 ; // Default to 1000MB.
2324 m_pEnabledProviderList = NULL ;
2425 m_pProviderList = new SList<SListElem<EventPipeProvider*>>();
@@ -266,6 +267,7 @@ void EventPipeConfiguration::Disable()
266267 }
267268
268269 m_enabled = false ;
270+ m_rundownEnabled = false ;
269271
270272 // Free the enabled providers list.
271273 if (m_pEnabledProviderList != NULL )
@@ -281,6 +283,38 @@ bool EventPipeConfiguration::Enabled() const
281283 return m_enabled;
282284}
283285
286+ bool EventPipeConfiguration::RundownEnabled () const
287+ {
288+ LIMITED_METHOD_CONTRACT;
289+ return m_rundownEnabled;
290+ }
291+
292+ void EventPipeConfiguration::EnableRundown ()
293+ {
294+ CONTRACTL
295+ {
296+ THROWS;
297+ GC_NOTRIGGER;
298+ MODE_ANY;
299+ // Lock must be held by EventPipe::Disable.
300+ PRECONDITION (EventPipe::GetLock ()->OwnedByCurrentThread ());
301+ }
302+ CONTRACTL_END;
303+
304+ // Build the rundown configuration.
305+ _ASSERTE (m_pEnabledProviderList == NULL );
306+ const unsigned int numRundownProviders = 2 ;
307+ EventPipeProviderConfiguration rundownProviders[numRundownProviders];
308+ rundownProviders[0 ] = EventPipeProviderConfiguration (W (" e13c0d23-ccbc-4e12-931b-d9cc2eee27e4" ), 0x80020138 , static_cast <unsigned int >(EventPipeEventLevel::Verbose)); // Public provider.
309+ rundownProviders[1 ] = EventPipeProviderConfiguration (W (" a669021c-c450-4609-a035-5af59af4df18" ), 0x80020138 , static_cast <unsigned int >(EventPipeEventLevel::Verbose)); // Rundown provider.
310+
311+ // Enable rundown.
312+ m_rundownEnabled = true ;
313+
314+ // Enable tracing. The circular buffer size doesn't matter because we're going to write all events synchronously during rundown.
315+ Enable (1 /* circularBufferSizeInMB */ , rundownProviders, numRundownProviders);
316+ }
317+
284318EventPipeEventInstance* EventPipeConfiguration::BuildEventMetadataEvent (EventPipeEventInstance &sourceInstance, BYTE *pPayloadData, unsigned int payloadLength)
285319{
286320 CONTRACTL
@@ -351,14 +385,16 @@ EventPipeEnabledProviderList::EventPipeEnabledProviderList(
351385 }
352386 CONTRACTL_END;
353387
388+ m_pProviders = NULL ;
389+ m_pCatchAllProvider = NULL ;
390+ m_numProviders = 0 ;
391+
354392 // Test COMPLUS variable to enable tracing at start-up.
355393 // If tracing is enabled at start-up create the catch-all provider and always return it.
356394 if ((CLRConfig::GetConfigValue (CLRConfig::INTERNAL_PerformanceTracing) & 1 ) == 1 )
357395 {
358396 m_pCatchAllProvider = new EventPipeEnabledProvider ();
359397 m_pCatchAllProvider->Set (NULL , 0xFFFFFFFF , EventPipeEventLevel::Verbose);
360- m_pProviders = NULL ;
361- m_numProviders = 0 ;
362398 return ;
363399 }
364400
0 commit comments