Decrease EventListener buffer size (#25526)
authorSung Yoon Whang <suwhang@microsoft.com>
Tue, 2 Jul 2019 06:19:07 +0000 (23:19 -0700)
committerGitHub <noreply@github.com>
Tue, 2 Jul 2019 06:19:07 +0000 (23:19 -0700)
* Reduce the default EventPipe circularBufferSize to 10MB for EventListener sessions

* make it a static var instead of random # in the code

src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipeEventDispatcher.cs

index a58d4eb..4360283 100644 (file)
@@ -36,6 +36,8 @@ namespace System.Diagnostics.Tracing
         private object m_dispatchControlLock = new object();
         private Dictionary<EventListener, EventListenerSubscription> m_subscriptions = new Dictionary<EventListener, EventListenerSubscription>();
 
+        private static uint DefaultEventListenerCircularMBSize = 10;
+
         private EventPipeEventDispatcher()
         {
             // Get the ID of the runtime provider so that it can be used as a filter when processing events.
@@ -110,7 +112,7 @@ namespace System.Diagnostics.Tracing
                 new EventPipeProviderConfiguration(NativeRuntimeEventSource.EventSourceName, (ulong) aggregatedKeywords, (uint) highestLevel, null)
             };
 
-            m_sessionID = EventPipeInternal.Enable(null, EventPipeSerializationFormat.NetTrace, 1024, providerConfiguration, 1);
+            m_sessionID = EventPipeInternal.Enable(null, EventPipeSerializationFormat.NetTrace, DefaultEventListenerCircularMBSize, providerConfiguration, 1);
             Debug.Assert(m_sessionID != 0);
 
             // Get the session information that is required to properly dispatch events.