/// <summary> /// Tracks when 'command' is started. /// </summary> public static void ExecuteStart(this SqlProfiler sqlProfiler, DbCommand command, ExecuteType type) { if (sqlProfiler == null) { return; } sqlProfiler.ExecuteStartImpl(command, type); }
/// <summary> /// Called when 'reader' finishes its iterations and is closed. /// </summary> public static void ReaderFinish(this SqlProfiler sqlProfiler, DbDataReader reader) { if (sqlProfiler == null) { return; } sqlProfiler.ReaderFinishedImpl(reader); }
/// <summary> /// Finishes profiling for 'command', recording durations. /// </summary> public static void ExecuteFinish(this SqlProfiler sqlProfiler, DbCommand command, ExecuteType type, DbDataReader reader = null) { if (sqlProfiler == null) { return; } sqlProfiler.ExecuteFinishImpl(command, type, reader); }
void IDbProfiler.ExecuteFinish(DbCommand profiledDbCommand, ExecuteType executeType, DbDataReader reader) { if (reader != null) { SqlProfiler.ExecuteFinish(profiledDbCommand, executeType, reader); } else { SqlProfiler.ExecuteFinish(profiledDbCommand, executeType); } }
/// <summary> /// Creates and starts a new MiniProfiler for the root <paramref name="url"/>, filtering <see cref="Timing"/> steps to <paramref name="level"/>. /// </summary> public Profiler(string url, ProfileLevel level = ProfileLevel.Info) { Id = Guid.NewGuid(); Level = level; SqlProfiler = new SqlProfiler(this); MachineName = Environment.MachineName; Started = DateTime.UtcNow; // stopwatch must start before any child Timings are instantiated _sw = Settings.StopwatchProvider(); Root = new Timing(this, parent: null, name: url); }
void IDbProfiler.ReaderFinish(DbDataReader reader) { SqlProfiler.ReaderFinish(reader); }
// IDbProfiler methods void IDbProfiler.ExecuteStart(DbCommand profiledDbCommand, ExecuteType executeType) { SqlProfiler.ExecuteStart(profiledDbCommand, executeType); }