StackExchange.Profiling.Timing.Stop C# (CSharp) Méthode

Stop() public méthode

Completes this Timing's duration and sets the MiniProfiler's Head up one level.
public Stop ( ) : void
Résultat void
        public void Stop()
        {
            if (DurationMilliseconds == null)
            {
                DurationMilliseconds = Profiler.GetRoundedMilliseconds(Profiler.ElapsedTicks - _startTicks);
                Profiler.Head = ParentTiming;

                if (HasChildren)
                {
                    decimal result = 0;
                    foreach (var child in Children)
                    {
                        result += child.DurationMilliseconds.GetValueOrDefault();
                    }

                    if (result.CompareTo(DurationMilliseconds.GetValueOrDefault()) > 0)
                    {
                        var delta = result - DurationMilliseconds;
                        string name1 = Name;
                        System.Diagnostics.Debug.WriteLine("Inside: " + delta + " -- "  + name1);
                        DurationMilliseconds = result + delta;
                    }
                }
            }
        }

Usage Example

Exemple #1
0
 protected override void OnAfterRender(bool firstRender)
 {
     _currentTiming?.Stop();
 }