Beispiel #1
0
        public static int AddEvent(TimingMeter meter, short eventKind, string info)
        {
            long  time       = CaptureCurrentTime();
            short meterId    = (meter == null) ? (short)0 : meter.meterId;
            var   meterEvent = new MeterEvent(meterId, eventKind, time, info);

#if DEBUG
            DebugAddEvent(meter, meterEvent);
#endif
            instance.eventTrace.Add(meterEvent);
            return(instance.eventTrace.Count);
        }
Beispiel #2
0
 private static void DebugAddEvent(TimingMeter meter, MeterEvent evt)
 {
     if (evt.eventKind == ekEnter)
     {
         debugMeterStack.Add(new MeterStackEntry(meter, 0));
     }
     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);
     }
 }
Beispiel #3
0
		private static void DebugAddEvent( TimingMeter meter, MeterEvent evt )
		{
			if ( evt.eventKind == ekEnter )
			{
				debugMeterStack.Add( new MeterStackEntry( meter, 0 ) );
			}
			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 );
			}
		}
Beispiel #4
0
		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;
		}