Esempio n. 1
0
        private void UpdateEventList()
        {
            ILStubEvent ilStubEventSelected = null;

            if (dataGridViewILStubEvents.SelectedRows.Count > 0)
            {
                DataGridViewRow selectedRow = dataGridViewILStubEvents.SelectedRows[0];
                ilStubEventSelected  = selectedRow.DataBoundItem as ILStubEvent;
                selectedRow.Selected = false;
            }
            int newIndexSelected = -1;

            lock (m_viewEventList)
            {
                m_viewEventList.Clear();
                List <ILStubEvent> eventList =
                    ILStubDiagnosticSessionController.GetInstance().Search(m_filterList);
                for (int i = 0; i < eventList.Count; i++)
                {
                    m_viewEventList.Add(eventList[i]);
                    if (ilStubEventSelected != null && ilStubEventSelected == eventList[i])
                    {
                        newIndexSelected = i;
                    }
                }
            }
            if (newIndexSelected != -1)
            {
                dataGridViewILStubEvents.Rows[newIndexSelected].Selected = true;
            }
        }
Esempio n. 2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            ILStubDiagnosticSessionController controller =
                ILStubDiagnosticSessionController.GetInstance();

            controller.EnableKernelSession();
            controller.ILStubEventHandler += ILStubEventListener;

            // For ILStubEvents DataGridView
            dataGridViewILStubEvents.AutoGenerateColumns = false;
            for (int i = 0; i < columnNames.Length; i++)
            {
                dataGridViewILStubEvents.Columns.Add(columnNames[i], columnNames[i]);
                dataGridViewILStubEvents.Columns[i].DataPropertyName = dataPropertyNames[i];
                dataGridViewILStubEvents.Columns[i].Visible          = false;
            }
            // Add the last padding column.
            dataGridViewILStubEvents.Columns.Add("", "");
            dataGridViewILStubEvents.Columns[columnNames.Length].Visible      = true;
            dataGridViewILStubEvents.Columns[columnNames.Length].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            // Bind to the event list.
            dataGridViewILStubEvents.DataSource = m_viewEventList;

            // For Filter DataGridView
            DataGridViewComboBoxColumn fieldColumn =
                dataGridViewFilter.Columns[0] as DataGridViewComboBoxColumn;

            fieldColumn.Items.Clear();
            List <IILStubEventFilterDef> filterDefList =
                ILStubEventFilterManager.GetInstance().FilterDefList;

            for (int i = 0; i < filterDefList.Count; i++)
            {
                fieldColumn.Items.Add(filterDefList[i].FilterName);
            }
            UpdateFilterMessage();

            // For contextMenuStripOnEventsColumnHeader
            for (int i = 0; i < columnNames.Length; i++)
            {
                ToolStripMenuItem item = new ToolStripMenuItem();
                item.Text         = columnNames[i];
                item.CheckOnClick = true;
                item.Click       += ItemOfContextMenuStripOnEventsColumnHeader_Click;
                contextMenuStripOnEventsColumnHeader.Items.Add(item);
                if (initialColumnCheckedStatus[i])
                {
                    item.PerformClick();
                }
            }
            // We can not hide the first column.
            contextMenuStripOnEventsColumnHeader.Items[0].Enabled = false;
        }
Esempio n. 3
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            ILStubDiagnosticSessionController controller =
                ILStubDiagnosticSessionController.GetInstance();

            if (controller.IsEnabled)
            {
                controller.DisableILStubSession();
            }

            // Force the Kernel Process Trace thread to exit.
            // We do not need to stop the "NT Kernel Logger" session.
            controller.ExitKernelTraceProcess();

            Environment.Exit(0);
        }
Esempio n. 4
0
        private void toolStripButtonControlSession_Click(object sender, EventArgs e)
        {
            ILStubDiagnosticSessionController controller =
                ILStubDiagnosticSessionController.GetInstance();

            if (controller.IsEnabled)
            {
                controller.DisableILStubSession();
                toolStripLabelRunning.Visible             = false;
                toolStripButtonControlSession.Image       = m_startButtonImage;
                toolStripButtonControlSession.Text        = ButtonControllerEnableText;
                toolStripButtonControlSession.ToolTipText = ButtonControllerEnableToolTipText;
            }
            else
            {
                controller.EnableILStubSession();
                toolStripLabelRunning.Visible             = true;
                toolStripButtonControlSession.Image       = m_stopButtonImage;
                toolStripButtonControlSession.Text        = ButtonControllerDisableText;
                toolStripButtonControlSession.ToolTipText = ButtonControllerDisableToolTipText;
            }
        }
Esempio n. 5
0
 /// <summary>
 /// CLR ETW event does not contain the process name. Therefore, we retrieve it by
 /// enabling kernel ETW session and maintain the mapping from process name to process name.
 /// Another option is to invoke the API Process.ProcessName. However, it only works when
 /// the process is alive. Our case cannot guarentee it so that we cannot opt in it.
 /// </summary>
 /// <param name="traceEvent">event data represent an ETW event</param>
 /// <returns>process name</returns>
 protected static string GetProcessName(TraceEvent traceEvent)
 {
     return(ILStubDiagnosticSessionController.GetInstance().GetProcessNameById(traceEvent.ProcessID));
 }