Exemplo n.º 1
0
        public static double GetPreciseElapsedTime(this Instrumentation instrumentation)
        {
            var fieldInfo = typeof(Instrumentation).GetField("_startedAt", BindingFlags.Instance | BindingFlags.NonPublic);
            var startedAt = (DateTime)fieldInfo.GetValue(instrumentation);

            return(new TimeSpan(DateTime.Now.Ticks - startedAt.Ticks).TotalSeconds);
        }
Exemplo n.º 2
0
 public static long GetReallyPreciseElapsedTime(this Instrumentation instrumentation)
 {
     Contract.Requires(instrumentation != null);
     return(_StopWatches[instrumentation.Id].ElapsedMilliseconds);
 }
Exemplo n.º 3
0
 public static void StartWithPrecision(this Instrumentation instrumentation)
 {
     Contract.Requires(instrumentation != null);
     _StopWatches[instrumentation.Id] = Stopwatch.StartNew();
 }