예제 #1
0
        public static CustomTiming CustomTimingIf(string category, string commandString, decimal minSaveMs, string executeType = null)
        {
            var result = new CustomTiming(Current, commandString, minSaveMs)
            {
                ExecuteType = executeType,
                Category    = category
            };

            // THREADING: revisit
            Current.Head.AddCustomTiming(category, result);

            return(result);
        }
예제 #2
0
        /// <summary>
        /// Initialises a new instance of the <see cref="SqlTiming"/> class.
        /// Creates a new <c>SqlTiming</c> to profile 'command'.
        /// </summary>
        public SqlTiming(ProfiledDbCommand command, SqlExecuteType type, MiniProfiler profiler)
        {
            if (profiler == null)
            {
                throw new ArgumentNullException("profiler");
            }
            _profiler = profiler;

            var commandText = AddSpacesToParameters(command.CommandText);
            var parameters  = GetCommandParameters(command);

            Command       = command;
            commandText   = Settings.SqlFormatter.FormatSql(commandText, parameters);
            _customTiming = MiniProfiler.CustomTiming("sql", commandText, type.ToString());
            if (_customTiming == null)
            {
                throw new InvalidOperationException();
            }
        }
예제 #3
0
파일: Timing.cs 프로젝트: Diaver/EFlogger
 internal void RemoveCustomTiming(string category, CustomTiming customTiming)
 {
     GetCustomTimingList(category).Remove(customTiming);
 }
예제 #4
0
파일: Timing.cs 프로젝트: Diaver/EFlogger
 /// <summary>
 /// Adds <paramref name="customTiming"/> to this <see cref="Timing"/> step's dictionary of
 /// custom timings, <see cref="CustomTimings"/>.  Ensures that <see cref="CustomTimings"/> is created,
 /// as well as the <paramref name="category"/>'s list.
 /// </summary>
 /// <param name="category">The kind of custom timing, e.g. "http", "redis", "memcache"</param>
 /// <param name="customTiming">Duration and command information</param>
 public void AddCustomTiming(string category, CustomTiming customTiming)
 {
     GetCustomTimingList(category).Add(customTiming);
 }