Пример #1
0
        } // End Sub StartProfiling

        public void PauseProfiling()
        {
            if (this.m_ProfilingState != ProfilingStateEnum.psProfiling)
            {
                return;
            }

            using (System.Data.SqlClient.SqlConnection cn = GetConnection())
            {
                OpenConnection(cn);
                this.m_Rdr.StopTrace(cn);
                CloseConnection(cn);
            } // End Using cn

            this.m_ProfilingState = ProfilingStateEnum.psPaused;
            NewEventArrived(m_EventPaused, true);
        } // End Sub PauseProfiling
Пример #2
0
        } // End Sub PauseProfiling

        public void StopProfiling()
        {
            if (this.m_ProfilingState == ProfilingStateEnum.psStopped)
            {
                return;
            }

            using (System.Data.SqlClient.SqlConnection cn = GetConnection())
            {
                OpenConnection(cn);
                this.m_Rdr.StopTrace(cn);
                this.m_Rdr.CloseTrace(cn);
                CloseConnection(cn);
            } // End Using cn

            this.m_NeedStop       = true;
            this.m_ProfilingState = ProfilingStateEnum.psStopped;
            NewEventArrived(m_EventStopped, true);
        } // End Sub StopProfiling
Пример #3
0
        }     // End Sub SetStringFilter

        public void StartProfiling()
        {
            this.m_events.Clear();

            this.m_Conn = GetConnection();
            OpenConnection(this.m_Conn);

            this.m_Rdr = new RawTraceReader(m_Conn);
            this.m_Rdr.CreateTrace();

            //if (m_currentsettings.EventsColumns.BatchCompleted)
            {
                m_Rdr.SetEvent(ProfilerEvents.TSQL.SQLBatchCompleted,
                               ProfilerEventColumns.TextData,
                               ProfilerEventColumns.LoginName,
                               ProfilerEventColumns.CPU,
                               ProfilerEventColumns.Reads,
                               ProfilerEventColumns.Writes,
                               ProfilerEventColumns.Duration,
                               ProfilerEventColumns.SPID,
                               ProfilerEventColumns.StartTime,
                               ProfilerEventColumns.EndTime,
                               ProfilerEventColumns.DatabaseName,
                               ProfilerEventColumns.ApplicationName,
                               ProfilerEventColumns.HostName
                               );
            } // End if (m_currentsettings.EventsColumns.BatchCompleted)

            //if (m_currentsettings.EventsColumns.RPCCompleted)
            {
                m_Rdr.SetEvent(ProfilerEvents.StoredProcedures.RPCCompleted,
                               ProfilerEventColumns.TextData, ProfilerEventColumns.LoginName,
                               ProfilerEventColumns.CPU, ProfilerEventColumns.Reads,
                               ProfilerEventColumns.Writes, ProfilerEventColumns.Duration,
                               ProfilerEventColumns.SPID
                               , ProfilerEventColumns.StartTime, ProfilerEventColumns.EndTime
                               , ProfilerEventColumns.DatabaseName
                               , ProfilerEventColumns.ObjectName
                               , ProfilerEventColumns.ApplicationName
                               , ProfilerEventColumns.HostName

                               );
            } // End if (m_currentsettings.EventsColumns.RPCCompleted)


            if (!string.IsNullOrWhiteSpace(this.m_database))
            {
                SetStringFilter(this.m_database, StringFilterCondition.Like, ProfilerEventColumns.DatabaseName);
            }

            this.m_Rdr.SetFilter(ProfilerEventColumns.ApplicationName, LogicalOperators.AND
                                 , ComparisonOperators.NotLike, "Express Profiler");


            this.m_Rdr.StartTrace();
            this.m_NeedStop = false;
            this.m_Thr      = new System.Threading.Thread(ProfilerThread)
            {
                IsBackground = true,
                Priority     = System.Threading.ThreadPriority.Lowest
            };

            this.m_ProfilingState = ProfilingStateEnum.psProfiling;
            NewEventArrived(m_EventStarted, true);
            m_Thr.Start();
        } // End Sub StartProfiling
Пример #4
0
 private void StartProfilerThread()
 {
     if (m_Rdr != null)
     {
         m_Rdr.Close();
     }
     m_Rdr.StartTrace();
     m_Thr = new Thread(ProfilerThread) { IsBackground = true, Priority = ThreadPriority.Lowest };
     m_NeedStop = false;
     m_ProfilingState = ProfilingStateEnum.psProfiling;
     NewEventArrived(m_EventStarted, true);
     m_Thr.Start();
 }
Пример #5
0
 private void PauseProfiling()
 {
     using (SqlConnection cn = GetConnection())
     {
         cn.Open();
         m_Rdr.StopTrace(cn);
         cn.Close();
     }
     m_ProfilingState = ProfilingStateEnum.psPaused;
     NewEventArrived(m_EventPaused, true);
     UpdateButtons();
 }
Пример #6
0
 private void StopProfiling()
 {
     tbStop.Enabled = false;
     using (SqlConnection cn = GetConnection())
     {
         cn.Open();
         m_Rdr.StopTrace(cn);
         m_Rdr.CloseTrace(cn);
         cn.Close();
     }
     m_NeedStop = true;
     if (m_Thr.IsAlive)
     {
         m_Thr.Abort();
     }
     m_Thr.Join();
     m_ProfilingState = ProfilingStateEnum.psStopped;
     NewEventArrived(m_EventStopped, true);
     UpdateButtons();
 }
        private void StopProfiling()
        {
            tbStop.Enabled = false;
            cbbHost.Enabled = true;
            edDatabaseName.Enabled = true;
            edHostName.Enabled = true;
            btnSaveConfig.Enabled = true;
            //进程只能在运行时使用
            cbbSPID.Enabled = false;
            btnCurrentSPID.Enabled = false;

            using (SqlConnection cn = GetConnection())
            {
                cn.Open();
                m_Rdr.StopTrace(cn);
                m_Rdr.CloseTrace(cn);
                cn.Close();
            }
            m_NeedStop = true;
            if (m_Thr.IsAlive)
            {
                m_Thr.Abort();
            }
            m_Thr.Join();
            m_ProfilingState = ProfilingStateEnum.psStopped;
            NewEventArrived(m_EventStopped,true);
            UpdateButtons();
        }