Esempio n. 1
0
        public static IDisposable LogWaitCopyDurationOfScope(this StreamingEventSource log, ulong iteration)
        {
            var durationStopwatch = Stopwatch.StartNew();

            return(Disposable.Create(
                       () =>
            {
                durationStopwatch.Stop();

                StreamingEventSource.Log.WaitOnBufferCopyDuration(iteration, durationStopwatch.ElapsedTicks * NanoSecondsPerTick);
            }));
        }
Esempio n. 2
0
        public static IDisposable LogDurationOfScope(this StreamingEventSource log, Func <TimeSpan, string> logMessageFunc)
        {
            var durationStopwatch = Stopwatch.StartNew();

            return(Disposable.Create(
                       () =>
            {
                durationStopwatch.Stop();

                StreamingEventSource.Log.Duration(logMessageFunc(durationStopwatch.Elapsed), durationStopwatch.ElapsedTicks * NanoSecondsPerTick);
            }));
        }
Esempio n. 3
0
        public static IDisposable LogGrabDurationOfScope(this StreamingEventSource log, ulong iteration, uint bufferSize)
        {
            var durationStopwatch = Stopwatch.StartNew();

            StreamingEventSource.Log.StartGrabbing(iteration, bufferSize);

            return(Disposable.Create(
                       () =>
            {
                durationStopwatch.Stop();

                StreamingEventSource.Log.GrabDuration(iteration, durationStopwatch.ElapsedTicks * NanoSecondsPerTick);
            }));
        }
Esempio n. 4
0
        public static IDisposable LogDurationOfScope(this StreamingEventSource log, string messageFormat, params object[] options)
        {
            var message = string.Format(CultureInfo.InvariantCulture, messageFormat, options);

            return(LogDurationOfScope(log, _ => message));
        }
Esempio n. 5
0
 public static IDisposable LogDurationOfScope(this StreamingEventSource log, string message)
 {
     return(LogDurationOfScope(log, _ => message));
 }