Exemple #1
0
        private List <ProfilerEvent> PollSession(ProfilerSession session)
        {
            var events = new List <ProfilerEvent>();

            try
            {
                if (session == null || session.XEventSession == null)
                {
                    return(events);
                }

                var targetXml = session.XEventSession.GetTargetXml();

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(targetXml);

                var nodes = xmlDoc.DocumentElement.GetElementsByTagName("event");
                foreach (XmlNode node in nodes)
                {
                    var profilerEvent = ParseProfilerEvent(node);
                    if (profilerEvent != null)
                    {
                        events.Add(profilerEvent);
                    }
                }
            }
            catch (XEventException)
            {
                SendStoppedSessionInfoToListeners(session.XEventSession.Id);
                ProfilerSession tempSession;
                RemoveSession(session.XEventSession.Id, out tempSession);
            }
            catch (Exception ex)
            {
                Logger.Write(TraceEventType.Warning, "Failed to poll session. error: " + ex.Message);
            }
            finally
            {
                session.IsPolling = false;
            }

            session.FilterOldEvents(events);
            return(session.FilterProfilerEvents(events));
        }
Exemple #2
0
        private List <ProfilerEvent> PollSession(ProfilerSession session)
        {
            var events = new List <ProfilerEvent>();

            try
            {
                if (session == null || session.XEventSession == null)
                {
                    return(events);
                }

                var targetXml = session.XEventSession.GetTargetXml();

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(targetXml);

                var nodes = xmlDoc.DocumentElement.GetElementsByTagName("event");
                foreach (XmlNode node in nodes)
                {
                    var profilerEvent = ParseProfilerEvent(node);
                    if (profilerEvent != null)
                    {
                        events.Add(profilerEvent);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Write(LogLevel.Warning, "Failed to pool session. error: " + ex.Message);
            }
            finally
            {
                session.IsPolling = false;
            }

            return(session.FilterProfilerEvents(
                       session.FilterOldEvents(events)
                       ));
        }