コード例 #1
0
 /// <summary>
 /// Completes this Timing's duration and sets the MiniProfiler's Head up one level.
 /// </summary>
 public void Stop()
 {
     if (DurationMilliseconds == null)
     {
         DurationMilliseconds = Profiler.GetRoundedMilliseconds(Profiler.ElapsedTicks - _startTicks);
         Profiler.Head        = ParentTiming;
     }
 }
コード例 #2
0
        /// <summary>
        /// Creates a new Timing named 'name' in the 'profiler's session, with 'parent' as this Timing's immediate ancestor.
        /// </summary>
        public Timing(Profiler profiler, Timing parent, string name)
        {
            this.Id       = Guid.NewGuid();
            Profiler      = profiler;
            Profiler.Head = this;

            if (parent != null) // root will have no parent
            {
                parent.AddChild(this);
            }

            Name = name;

            _startTicks       = profiler.ElapsedTicks;
            StartMilliseconds = profiler.GetRoundedMilliseconds(_startTicks);
        }
コード例 #3
0
ファイル: Timing.cs プロジェクト: CLupica/ServiceStack
        /// <summary>
        /// Creates a new Timing named 'name' in the 'profiler's session, with 'parent' as this Timing's immediate ancestor.
        /// </summary>
        public Timing(Profiler profiler, Timing parent, string name)
        {
            this.Id = Guid.NewGuid();
            Profiler = profiler;
            Profiler.Head = this;

            if (parent != null) // root will have no parent
            {
                parent.AddChild(this);
            }

            Name = name;

            _startTicks = profiler.ElapsedTicks;
            StartMilliseconds = profiler.GetRoundedMilliseconds(_startTicks);
        }
コード例 #4
0
        /// <summary>
        /// Creates a new SqlTiming to profile 'command'.
        /// </summary>
        public SqlTiming(DbCommand command, ExecuteType type, Profiler profiler)
        {
            Id = Guid.NewGuid();

            CommandString = AddSpacesToParameters(command.CommandText);
            Parameters = GetCommandParameters(command);
            ExecuteType = type;

            if (!Profiler.Settings.ExcludeStackTraceSnippetFromSqlTimings)
                StackTraceSnippet = ServiceStack.MiniProfiler.Helpers.StackTraceSnippet.Get();

            _profiler = profiler;
            if (_profiler != null)
            {
                _profiler.AddSqlTiming(this);
                _startTicks = _profiler.ElapsedTicks;
                StartMilliseconds = _profiler.GetRoundedMilliseconds(_startTicks);
            }
        }
コード例 #5
0
        /// <summary>
        /// Creates a new SqlTiming to profile 'command'.
        /// </summary>
        public SqlTiming(DbCommand command, ExecuteType type, Profiler profiler)
        {
            Id = Guid.NewGuid();

            CommandString = AddSpacesToParameters(command.CommandText);
            Parameters    = GetCommandParameters(command);
            ExecuteType   = type;

            if (!Profiler.Settings.ExcludeStackTraceSnippetFromSqlTimings)
            {
                StackTraceSnippet = ServiceStack.MiniProfiler.Helpers.StackTraceSnippet.Get();
            }

            _profiler = profiler;
            if (_profiler != null)
            {
                _profiler.AddSqlTiming(this);
                _startTicks       = _profiler.ElapsedTicks;
                StartMilliseconds = _profiler.GetRoundedMilliseconds(_startTicks);
            }
        }
コード例 #6
0
 private decimal GetDurationMilliseconds()
 {
     return(_profiler.GetRoundedMilliseconds(_profiler.ElapsedTicks - _startTicks));
 }