/// <summary> /// Creates a new SqlTiming to profile 'command'. /// </summary> public SqlTiming(DbCommand command, ExecuteType type, MiniProfiler profiler) { Id = Guid.NewGuid(); CommandString = AddSpacesToParameters(command.CommandText); Parameters = GetCommandParameters(command); ExecuteType = type; if (!MiniProfiler.Settings.ExcludeStackTraceSnippetFromSqlTimings) { StackTraceSnippet = ServiceStack.MiniProfiler.Helpers.StackTraceSnippet.Get(); } _profiler = profiler; if (_profiler != null) { _profiler.AddSqlTiming(this); _startTicks = _profiler.ElapsedTicks; StartMilliseconds = _profiler.GetRoundedMilliseconds(_startTicks); } }