Esempio n. 1
0
 public ILStubGeneratedEvent(ILStubGeneratedTraceData traceData)
     : base(traceData)
 {
     ClrInstanceId                 = traceData.ClrInstanceID;
     ManagedInteropMethodName      = traceData.ManagedInteropMethodName;
     ManagedInteropMethodNamespace = traceData.ManagedInteropMethodNamespace;
     ManagedSignature              = traceData.ManagedInteropMethodSignature;
     ManagedMethodToken            = traceData.ManagedInteropMethodToken;
     ModuleId            = traceData.ModuleID;
     NativeSignature     = traceData.NativeMethodSignature;
     StubGeneratedFlags  = traceData.StubFlags;
     StubMethodId        = traceData.StubMethodID;
     StubMethodILCode    = traceData.StubMethodILCode;
     StubMethodSignature = traceData.StubMethodSignature;
 }
        /// <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);
            }
        }