コード例 #1
0
        private void Details()
        {
            EventWindow ew = new EventWindow();

            ew.DataContext = this;

            ew.Show();
        }
コード例 #2
0
ファイル: EtwEventSource.cs プロジェクト: ivberg/perfview
        public static void X()
        {
            // Create a new session, turn on some events, and get the stream of events
            var session = new TraceEventSession("MySession");

            session.EnableProvider(TraceEventProviders.GetEventSourceGuidFromName("MyEventSource"));
            var eventStream = session.Source;

            // Create an in memory GENERIC list of parsed (basically string) records that can hold the results
            GenericEventSource eventSource = new GenericEventSource();

            // Hook up the ETW eventStream to the generic in memory event source.
            var dynamicParser = new DynamicTraceEventParser(eventStream);
            Action <TraceEvent> sendToEventStore = delegate(TraceEvent data)
            {
                var processName = data.ProcessName;
                if (!processName.StartsWith("("))
                {
                    processName += " (" + data.ProcessID + ")";
                }

                var fieldNames = data.PayloadNames;
                var fields     = new string[fieldNames.Length];
                for (int i = 0; i < fields.Length; i++)
                {
                    fields[i] = data.PayloadString(i);
                }

                var genericRecord = new GenericEventRecord(data.EventName, data.ProcessName, data.TimeStampRelativeMSec, fieldNames, fields);
                eventSource.Records.AddRecord(genericRecord);
            };

            dynamicParser.All += sendToEventStore;
            var registeredParser = new RegisteredTraceEventParser(eventStream);

            registeredParser.All        += sendToEventStore;
            eventStream.UnhandledEvents += sendToEventStore;

            // Start processing ETW events and filling the in-memory list (which the GUI is observing).
            var thread = new Thread(delegate()
            {
                session.Source.Process();
            });

            thread.Start();

            var window = new EventWindow(GuiApp.MainWindow, eventSource);

            window.Show();
        }
コード例 #3
0
        private void PushEvent(OperationItem operation)
        {
            lock (Lock)
            {
                Dispatcher.Invoke((Action)(() =>
                {
                    if (_eventWindow == null)
                    {
                        _eventWindow = new EventWindow();
                        _eventWindow.Closed += EventWindow_Closed;
                        _eventWindow.Show();
                    }

                    // Call the event window on this operation
                    _eventWindow.PushEvent(operation.ToOperation());
                }));
            }
        }
コード例 #4
0
        private void OpenEventWindow()
        {
            if (!_eventWindowOpened)
            {
                _eventWindowOpened = true;

                var eventWindow          = new EventWindow();
                var eventWindowViewModel = new EventWindowViewModel(_connectionHandler);

                eventWindowViewModel.ExitButtonClicked += (sender, args) =>
                {
                    eventWindow.Close();
                    _eventWindowOpened = false;
                };

                eventWindow.DataContext = eventWindowViewModel;
                eventWindow.Show();
            }
        }