private void RawDispatch(TraceEventNativeMethods.EVENT_RECORD *rawData) { if (stopProcessing) { return; } if (lockObj != null) { Monitor.Enter(lockObj); } Debug.Assert(rawData->EventHeader.HeaderType == 0); // if non-zero probably old-style ETW header TraceEvent anEvent = Lookup(rawData); #if DEBUG anEvent.DisallowEventIndexAccess = DisallowEventIndexAccess; #endif // Keep in mind that for UnhandledTraceEvent 'PrepForCallback' has NOT been called, which means the // opcode, guid and eventIds are not correct at this point. The ToString() routine WILL call // this so if that is in your debug window, it will have this side effect (which is good and bad) // Looking at rawData will give you the truth however. anEvent.DebugValidate(); if (anEvent.NeedsFixup) { anEvent.FixupData(); } Dispatch(anEvent); if (lockObj != null) { Monitor.Exit(lockObj); } }
private void RawDispatch(TraceEventNativeMethods.EVENT_RECORD *rawData) { Debug.Assert(rawData->EventHeader.HeaderType == 0); // if non-zero probably old-style ETW header TraceEvent anEvent = Lookup(rawData); // Keep in mind that for UnhandledTraceEvent 'PrepForCallback' has NOT been called, which means the // opcode, guid and eventIds are not correct at this point. The ToString() routine WILL call // this so if that is in your debug window, it will have this side effect (which is good and bad) // Looking at rawData will give you the truth however. anEvent.DebugValidate(); if (anEvent.FixupETLData != null) { anEvent.FixupETLData(); } Dispatch(anEvent); }
public void OnEvent(ITraceEvent eventData, CTraceRelogger relogger) { var rawData = (TraceEventNativeMethods.EVENT_RECORD *)eventData.GetEventRecord(); var source = m_source; if (source.stopProcessing) { return; } // is this the very first event? if so this could be the header event (for real time ETW) if (m_source._syncTimeQPC == 0) { Initialize(rawData); } Debug.Assert(rawData->EventHeader.HeaderType == 0); // if non-zero probably old-style ETW header // Give it an event ID if it does not have one. source.m_traceLoggingEventId.TestForTraceLoggingEventAndFixupIfNeeded(rawData); // Lookup the event; TraceEvent anEvent = source.Lookup(rawData); source.m_curITraceEvent = eventData; source.m_curTraceEventRecord = anEvent.eventRecord; // Keep in mind that for UnhandledTraceEvent 'PrepForCallback' has NOT been called, which means the // opcode, guid and eventIds are not correct at this point. The ToString() routine WILL call // this so if that is in your debug window, it will have this side effect (which is good and bad) // Looking at rawData will give you the truth however. anEvent.DebugValidate(); if (anEvent.NeedsFixup) { anEvent.FixupData(); } source.Dispatch(anEvent); // Release the COM object aggressively Otherwise you build up quite a few of these before // the GC kicks in and cleans them all up. Marshal.FinalReleaseComObject(source.m_curITraceEvent); source.m_curITraceEvent = null; }