Exemple #1
0
        void HandleEvent(TraceEvent evt, EventType type)
        {
            var include = Filter?.EvaluateEvent(evt);

            if (include == null || include == FilterRuleResult.Include)
            {
                EventTrace(evt.Clone(), type);
            }
        }
Exemple #2
0
        private void ProcessUnhandledEvent(TraceEvent ev)
        {
            if (ev.ProviderGuid == Guid.Empty)
            {
                ++this.UnreadableEvents;
                return;
            }

            Queue <TraceEvent> eventList = null;

            if (this.MaximumBufferTimeForUnknownEvents != TimeSpan.Zero)
            {
                this.UnhandledEvents.TryGetValue(ev.ProviderGuid, out eventList);
            }

            if (ev.ID == DynamicTraceEventParser.ManifestEventID)
            {
                // For manifest IDs if we found a provider (meaning this was the final manifest event needed to
                // create the provider) then we can reprocess any unknown events. In any case we do not pass manifest
                // events up to our own users because they are unlikely to be particularly useful on their own -- if
                // in future users want to capture manifests when they are emitted we could trigger a specific event
                // with the full manifest payload here. Nobody needs that today, though.
                if (eventList != null)
                {
                    this.UnhandledEvents.Remove(ev.ProviderGuid);
                    this.ReprocessUnhandledEvents(eventList);
                }
                return;
            }

            if (this.MaximumBufferTimeForUnknownEvents != TimeSpan.Zero)
            {
                if (eventList == null)
                {
                    eventList = new Queue <TraceEvent>();
                    this.UnhandledEvents[ev.ProviderGuid] = eventList;
                }

                while (eventList.Count > 0 &&
                       ev.TimeStamp - eventList.Peek().TimeStamp > this.MaximumBufferTimeForUnknownEvents)
                {
                    eventList.Dequeue();
                }

                eventList.Enqueue(ev.Clone());
            }
        }
Exemple #3
0
 internal EtwEvent(TraceEvent data)
 {
     _data = data.Clone();
 }
        private void ProcessUnhandledEvent(TraceEvent ev)
        {
            if (ev.ProviderGuid == Guid.Empty)
            {
                ++this.UnreadableEvents;
                return;
            }

            Queue<TraceEvent> eventList = null;
            if (this.MaximumBufferTimeForUnknownEvents != TimeSpan.Zero)
            {
                this.UnhandledEvents.TryGetValue(ev.ProviderGuid, out eventList);
            }

            if (ev.ID == DynamicTraceEventParser.ManifestEventID)
            {
                // For manifest IDs if we found a provider (meaning this was the final manifest event needed to
                // create the provider) then we can reprocess any unknown events. In any case we do not pass manifest
                // events up to our own users because they are unlikely to be particularly useful on their own -- if
                // in future users want to capture manifests when they are emitted we could trigger a specific event
                // with the full manifest payload here. Nobody needs that today, though.
                if (eventList != null)
                {
                    this.UnhandledEvents.Remove(ev.ProviderGuid);
                    this.ReprocessUnhandledEvents(eventList);
                }
                return;
            }

            if (this.MaximumBufferTimeForUnknownEvents != TimeSpan.Zero)
            {
                if (eventList == null)
                {
                    eventList = new Queue<TraceEvent>();
                    this.UnhandledEvents[ev.ProviderGuid] = eventList;
                }

                while (eventList.Count > 0
                       && ev.TimeStamp - eventList.Peek().TimeStamp > this.MaximumBufferTimeForUnknownEvents)
                {
                    eventList.Dequeue();
                }

                eventList.Enqueue(ev.Clone());
            }
        }