Пример #1
0
 /// <summary>
 /// Tracks when 'command' is started.
 /// </summary>
 public static void ExecuteStart(this SqlProfiler sqlProfiler, IDbCommand command, SqlExecuteType type)
 {
     if (sqlProfiler == null)
     {
         return;
     }
     sqlProfiler.ExecuteStartImpl(command, type);
 }
Пример #2
0
 /// <summary>
 /// Finishes profiling for 'command', recording durations.
 /// </summary>
 public static void ExecuteFinish(
     this SqlProfiler sqlProfiler,
     IDbCommand command,
     SqlExecuteType type,
     DbDataReader reader = null)
 {
     sqlProfiler?.ExecuteFinishImpl(command, type, reader);
 }
Пример #3
0
 /// <summary>
 /// Called when 'reader' finishes its iterations and is closed.
 /// </summary>
 public static void ReaderFinish(this SqlProfiler sqlProfiler, IDataReader reader)
 {
     if (sqlProfiler == null)
     {
         return;
     }
     sqlProfiler.ReaderFinishedImpl(reader);
 }
Пример #4
0
 /// <summary>
 /// Finishes profiling for 'command', recording durations.
 /// </summary>
 public static void ExecuteFinish(this SqlProfiler sqlProfiler, IDbCommand command, ExecuteType type, DbDataReader reader = null)
 {
     if (sqlProfiler == null)
     {
         return;
     }
     sqlProfiler.ExecuteFinishImpl(command, type, reader);
 }
Пример #5
0
 void IDbProfiler.ExecuteFinish(IDbCommand profiledDbCommand, ExecuteType executeType, DbDataReader reader)
 {
     if (reader != null)
     {
         SqlProfiler.ExecuteFinish(profiledDbCommand, executeType, reader);
     }
     else
     {
         SqlProfiler.ExecuteFinish(profiledDbCommand, executeType);
     }
 }
Пример #6
0
        /// <summary>
        /// Initialises a new instance of the <see cref="MiniProfiler"/> class. 
        /// Creates and starts a new MiniProfiler for the root <paramref name="url"/>, filtering <see cref="Timing"/> steps to <paramref name="level"/>.
        /// </summary>
        /// <param name="url">
        /// The URL.
        /// </param>
        /// <param name="level">
        /// The level.
        /// </param>
        public MiniProfiler(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, null, url);
        }
Пример #7
0
        /// <summary>
        /// Creates and starts a new MiniProfiler for the root <paramref name="url"/>, filtering <see cref="Timing"/> steps to <paramref name="level"/>.
        /// </summary>
        public MiniProfiler(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);
        }
Пример #8
0
        /// <summary>
        /// Initialises a new instance of the <see cref="MiniProfiler"/> class.  Creates and starts a new MiniProfiler 
        /// for the root <paramref name="url"/>.
        /// </summary>
        public MiniProfiler(string url)
        {
            Id = Guid.NewGuid();
#pragma warning disable 612,618
            Level = ProfileLevel.Info;
#pragma warning restore 612,618
            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, null, url);
        }
        /// <summary>
        /// Initialises a new instance of the <see cref="MiniProfiler"/> class.  Creates and starts a new MiniProfiler
        /// for the root <paramref name="url"/>.
        /// </summary>
        public MiniProfiler(string url)
        {
            Id = Guid.NewGuid();
#pragma warning disable 612,618
            Level = ProfileLevel.Info;
#pragma warning restore 612,618
            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, null, url);
        }
Пример #10
0
 void IDbProfiler.ReaderFinish(IDataReader reader)
 {
     SqlProfiler.ReaderFinish(reader);
 }
Пример #11
0
        // IDbProfiler methods

        void IDbProfiler.ExecuteStart(IDbCommand profiledDbCommand, ExecuteType executeType)
        {
            SqlProfiler.ExecuteStart(profiledDbCommand, executeType);
        }
Пример #12
0
 /// <summary>
 /// Called when 'reader' finishes its iterations and is closed.
 /// </summary>
 public static void ReaderFinish(this SqlProfiler sqlProfiler, IDataReader reader)
 {
     sqlProfiler?.ReaderFinishedImpl(reader);
 }
Пример #13
0
 /// <summary>
 /// Tracks when 'command' is started.
 /// </summary>
 public static void ExecuteStart(this SqlProfiler sqlProfiler, IDbCommand command, SqlExecuteType type)
 {
     sqlProfiler?.ExecuteStartImpl(command, type);
 }