public static int AddEvent(TimingMeter meter, short eventKind, string info) { long time = CaptureCurrentTime(); short meterId = (meter == null) ? (short)0 : meter.meterId; MeterEvent meterEvent = new MeterEvent(meterId, eventKind, time, info); #if DEBUG // DebugAddEvent(meter, meterEvent); #endif instance.eventTrace.Add(meterEvent); return(instance.eventTrace.Count); }
private static void DebugAddEvent(TimingMeter meter, MeterEvent evt) { if (evt.eventKind == ekEnter) { debugMeterStack.Add(new MeterStackEntry(meter, 0, debugMeterStack.Count)); } else if (evt.eventKind == ekExit) { Debug.Assert(debugMeterStack.Count > 0, "Meter stack is empty during ekExit"); MeterStackEntry s = debugMeterStack[debugMeterStack.Count - 1]; Debug.Assert(s.meter == meter, "Entered " + s.meter.title + "; Exiting " + meter.title); debugMeterStack.RemoveAt(debugMeterStack.Count - 1); } else if (evt.eventKind == ekInfo) { // just ignore these } else { Debug.Assert(false); } }
public static int AddEvent(TimingMeter meter, short eventKind, string info) { long time = CaptureCurrentTime(); short meterId = (meter == null) ? (short)0 : meter.meterId; MeterEvent meterEvent = new MeterEvent(meterId, eventKind, time, info); #if DEBUG // DebugAddEvent(meter, meterEvent); #endif instance.eventTrace.Add(meterEvent); return instance.eventTrace.Count; }