Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 5
0
 void IDbProfiler.ExecuteFinish(IDbCommand profiledDbCommand, ExecuteType executeType, DbDataReader reader)
 {
     if (reader != null)
     {
         SqlProfiler.ExecuteFinish(profiledDbCommand, executeType, reader);
     }
     else
     {
         SqlProfiler.ExecuteFinish(profiledDbCommand, executeType);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 10
0
 void IDbProfiler.ReaderFinish(IDataReader reader)
 {
     SqlProfiler.ReaderFinish(reader);
 }
Exemplo n.º 11
0
        // IDbProfiler methods

        void IDbProfiler.ExecuteStart(IDbCommand profiledDbCommand, ExecuteType executeType)
        {
            SqlProfiler.ExecuteStart(profiledDbCommand, executeType);
        }
Exemplo n.º 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);
 }
Exemplo n.º 13
0
 /// <summary>
 /// Tracks when 'command' is started.
 /// </summary>
 public static void ExecuteStart(this SqlProfiler sqlProfiler, IDbCommand command, SqlExecuteType type)
 {
     sqlProfiler?.ExecuteStartImpl(command, type);
 }