Exemplo 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;
            }
        }
Exemplo n.º 2
0
 private void InsertViewEvent(ILStubEvent ilStubEvent)
 {
     lock (m_viewEventList)
     {
         if (m_filterList.Match(ilStubEvent))
         {
             m_viewEventList.Insert(0, ilStubEvent);
         }
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Only if the ILStubEvent satisfies all filter in the filter list, return true.
 /// </summary>
 public bool Match(ILStubEvent ilStubEvent)
 {
     for (int i = 0; i < m_filterList.Count; i++)
     {
         if (!m_filterList[i].Match(ilStubEvent))
         {
             return(false);
         }
     }
     return(true);
 }
        /// <summary>
        /// Get the list of ILStubEvents from the event list, which satisfy the filter.
        /// </summary>
        public List <ILStubEvent> Search(ILStubEventFilterList listFilter)
        {
            List <ILStubEvent> eventList = new List <ILStubEvent>();

            lock (m_eventList)
            {
                for (int i = 0; i < m_eventList.Count; i++)
                {
                    ILStubEvent ilStubEvent = m_eventList[i];
                    if (listFilter.Match(ilStubEvent))
                    {
                        eventList.Add(ilStubEvent);
                    }
                }
            }
            return(eventList);
        }
Exemplo n.º 5
0
 private void dataGridViewILStubEvents_SelectionChanged(object sender, EventArgs e)
 {
     if (dataGridViewILStubEvents.SelectedRows.Count > 0)
     {
         DataGridViewRow selectedRow = dataGridViewILStubEvents.SelectedRows[0];
         Debug.Assert(selectedRow.DataBoundItem is ILStubEvent);
         ILStubEvent   ilStubEvent = selectedRow.DataBoundItem as ILStubEvent;
         StringBuilder sb          = new StringBuilder();
         sb.Append("// Managed Signature: ");
         sb.Append(ilStubEvent.ManagedSignature);
         sb.Append("\n// Native Signature: ");
         sb.Append(ilStubEvent.NativeSignature);
         sb.Append("\n\n// IL Stub:\n");
         sb.Append(ilStubEvent.StubMethodILCode);
         richTextBoxILCode.Text = sb.ToString();
     }
     else
     {
         richTextBoxILCode.Text = string.Empty;
     }
 }
        /// <summary>
        /// Record both ILStub Generated Event and ILStub CacheHit Event into our own DataStructure
        /// </summary>
        /// <param name="data"> The data structure constructed by TraceEvent library
        /// which presents a ETW event</param>
        private void AcceptILStubEvent(TraceEvent data)
        {
            ILStubEvent ilStubEvent = null;
            ILStubGeneratedTraceData ilStubGeneratedTraceData = data as ILStubGeneratedTraceData;

            if (ilStubGeneratedTraceData != null)
            {
                // record the IL Stub Generated event
                ilStubEvent = new ILStubGeneratedEvent(ilStubGeneratedTraceData);
            }
            else
            {
                ILStubCacheHitTraceData ilStubCacheHitTraceData = data as ILStubCacheHitTraceData;
                if (ilStubCacheHitTraceData != null)
                {
                    ILStubCacheHitTraceData cacheHitTraceData = ilStubCacheHitTraceData;
                    ILStubGeneratedEvent    generatedEvent    =
                        GetGeneratedEvent(cacheHitTraceData);
                    ilStubEvent = new ILStubCacheHitEvent(
                        cacheHitTraceData, generatedEvent);
                }
            }
            if (ilStubEvent != null)
            {
                lock (m_eventList)
                {
                    m_eventList.Insert(0, ilStubEvent);
                    ILStubGeneratedEvent ilStubGeneratedEvent = ilStubEvent as ILStubGeneratedEvent;
                    if (ilStubGeneratedEvent != null)
                    {
                        int hashCode = GetGeneratedEventHashCode(ilStubEvent.ProcessId,
                                                                 ilStubEvent.StubMethodId);
                        m_ilStubGeneratedEventIndex[hashCode] = ilStubGeneratedEvent;
                    }
                }
                // Fire the ILStub Event.
                ILStubEventHandler(ilStubEvent);
            }
        }
        public override bool Match(ILStubEvent ilStubEvent)
        {
            string methodName = ilStubEvent.MethodName;

            return(base.IsTrue(methodName));
        }
        public override bool Match(ILStubEvent ilStubEvent)
        {
            string processName = ilStubEvent.ProcessName;

            return(base.IsTrue(processName));
        }
        public override bool Match(ILStubEvent ilStubEvent)
        {
            int pid = ilStubEvent.ProcessId;

            return(base.IsTrue(pid));
        }
 abstract public bool Match(ILStubEvent ilStubEvent);
Exemplo n.º 11
0
 private void ILStubEventListener(ILStubEvent ilStubEvent)
 {
     this.Invoke(new Action <ILStubEvent>(InsertViewEvent),
                 new object[] { ilStubEvent });
 }