类 SqlServerProfiler
- java.lang.Object
-
- com.gdxsoft.sqlProfiler.SqlServerProfiler
-
public class SqlServerProfiler extends Object
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classSqlServerProfiler.IntFilterConditionstatic classSqlServerProfiler.StringFilterCondition
-
字段概要
字段 修饰符和类型 字段 说明 static StringAPPNAMEprotected booleanconsoleModeprotected List<PerfColumn>m_columnsprotected com.gdxsoft.easyweb.datasource.DataConnectionm_Connprotected ProfilerEventm_EventPausedprotected ConcurrentLinkedQueue<ProfilerEvent>m_eventsprotected ProfilerEventm_EventStartedprotected ProfilerEventm_EventStoppedprotected booleanm_isWindowsprotected booleanm_NeedStopprotected ProfilingStateEnumm_ProfilingStateprotected RawTraceReaderm_Rdrprotected Threadm_Thrprotected Timerm_timerstatic StringSQL_LOG_NEW
-
构造器概要
构造器 构造器 说明 SqlServerProfiler()
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 voidclearProfilers()static StringcreateConnStr(String host, int port, String database)StringexportRecords()List<PerfColumn>getColumns()protected com.gdxsoft.easyweb.datasource.DataConnectiongetConnection()StringgetConnStr()StringgetDatabase()StringgetDdatabase()protected StringgetEventCaption(ProfilerEvent evt)ConcurrentLinkedQueue<ProfilerEvent>getEvents()static SqlServerProfilergetInstance(int tsId)static SqlServerProfilergetInstance(String host, int port, String database, String username, String password)static Map<Integer,SqlServerProfiler>getInstances()static org.slf4j.LoggergetLOGGER()StringgetPassword()intgetPort()ProfilingStateEnumgetProfilingState()RawTraceReadergetRdr()StringgetServer()ThreadgetThr()TimergetTimer()StringgetTraceFileName()org.json.JSONObjectgetTraceStatusFromSysTraces()从 sqlserver数据库的 sys.traces获取状态intgetTsId()StringgetUsername()voidinit(String server, int port, String database, String username, String password)booleanisConsoleMode()booleanisInitialized()是否初始化完毕booleanisNeedStop()booleanisWindows()protected voidnewEventArrived(ProfilerEvent evt, boolean last)voidpauseProfiling()Pause tracevoidrecordToDb(ProfilerEvent evt)static voidremoveInstance(int tsId)voidresumeProfiling()ResumevoidsetConsoleMode(boolean consoleMode)voidsetDatabase(String database)voidsetNeedStop(boolean m_NeedStop)voidsetPassword(String password)voidsetPort(int port)voidsetServer(String server)voidsetTsId(int tsId)voidsetUsername(String username)voidstartProfiling()Start tracevoidstopProfiling()Stop tracestatic org.json.JSONObjecttestConnection(int tsId)测试连接static org.json.JSONObjecttestConnection(String host, int port, String database, String username, String password)测试连接voidtruncateRecords()
-
-
-
字段详细资料
-
m_ProfilingState
protected ProfilingStateEnum m_ProfilingState
-
m_Conn
protected com.gdxsoft.easyweb.datasource.DataConnection m_Conn
-
m_Rdr
protected RawTraceReader m_Rdr
-
m_NeedStop
protected boolean m_NeedStop
-
m_timer
protected Timer m_timer
-
m_events
protected ConcurrentLinkedQueue<ProfilerEvent> m_events
-
m_columns
protected List<PerfColumn> m_columns
-
m_Thr
protected Thread m_Thr
-
m_isWindows
protected boolean m_isWindows
-
consoleMode
protected boolean consoleMode
-
m_EventStarted
protected ProfilerEvent m_EventStarted
-
m_EventStopped
protected ProfilerEvent m_EventStopped
-
m_EventPaused
protected ProfilerEvent m_EventPaused
-
-
方法详细资料
-
removeInstance
public static void removeInstance(int tsId)
-
getInstance
public static SqlServerProfiler getInstance(String host, int port, String database, String username, String password) throws Exception
- 参数:
host-port-database-username-password-- 返回:
- 抛出:
Exception
-
testConnection
public static org.json.JSONObject testConnection(String host, int port, String database, String username, String password)
测试连接- 参数:
host-port-database-username-password-- 返回:
-
testConnection
public static org.json.JSONObject testConnection(int tsId)
测试连接- 参数:
tsId-- 返回:
- 抛出:
Exception
-
getInstance
public static SqlServerProfiler getInstance(int tsId) throws Exception
- 参数:
tsId-- 返回:
- 抛出:
Exception
-
init
public void init(String server, int port, String database, String username, String password) throws Exception
- 抛出:
Exception
-
startProfiling
public void startProfiling() throws ExceptionStart trace
-
pauseProfiling
public void pauseProfiling()
Pause trace
-
resumeProfiling
public void resumeProfiling() throws ExceptionResume
-
stopProfiling
public void stopProfiling()
Stop trace
-
getTraceStatusFromSysTraces
public org.json.JSONObject getTraceStatusFromSysTraces()
从 sqlserver数据库的 sys.traces获取状态- 返回:
-
getEventCaption
protected String getEventCaption(ProfilerEvent evt)
-
exportRecords
public String exportRecords() throws org.json.JSONException, IOException
- 抛出:
org.json.JSONExceptionIOException
-
truncateRecords
public void truncateRecords() throws org.json.JSONException, IOException- 抛出:
org.json.JSONExceptionIOException
-
recordToDb
public void recordToDb(ProfilerEvent evt)
-
newEventArrived
protected void newEventArrived(ProfilerEvent evt, boolean last)
-
getConnection
protected com.gdxsoft.easyweb.datasource.DataConnection getConnection() throws Exception- 抛出:
Exception
-
clearProfilers
public void clearProfilers()
-
getServer
public String getServer()
- 返回:
- the server
-
setServer
public void setServer(String server)
- 参数:
server- the server to set
-
getUsername
public String getUsername()
- 返回:
- the username
-
setUsername
public void setUsername(String username)
- 参数:
username- the username to set
-
getPassword
public String getPassword()
- 返回:
- the password
-
setPassword
public void setPassword(String password)
- 参数:
password- the password to set
-
getDdatabase
public String getDdatabase()
- 返回:
- the database
-
setDatabase
public void setDatabase(String database)
- 参数:
database- the database to set
-
getPort
public int getPort()
- 返回:
- the port
-
setPort
public void setPort(int port)
- 参数:
port- the port to set
-
isInitialized
public boolean isInitialized()
是否初始化完毕- 返回:
- the initialized
-
getTsId
public int getTsId()
- 返回:
- the tsId
-
setTsId
public void setTsId(int tsId)
- 参数:
tsId- the tsId to set
-
getLOGGER
public static org.slf4j.Logger getLOGGER()
- 返回:
- the lOGGER
-
getInstances
public static Map<Integer,SqlServerProfiler> getInstances()
- 返回:
- the instances
-
getConnStr
public String getConnStr()
- 返回:
- the connStr
-
getProfilingState
public ProfilingStateEnum getProfilingState()
- 返回:
- the m_ProfilingState
-
getRdr
public RawTraceReader getRdr()
- 返回:
- the m_Rdr
-
isNeedStop
public boolean isNeedStop()
- 返回:
- the m_NeedStop
-
getTimer
public Timer getTimer()
- 返回:
- the m_timer
-
getEvents
public ConcurrentLinkedQueue<ProfilerEvent> getEvents()
- 返回:
- the m_events
-
getColumns
public List<PerfColumn> getColumns()
- 返回:
- the m_columns
-
getThr
public Thread getThr()
- 返回:
- the m_Thr
-
isWindows
public boolean isWindows()
- 返回:
- the m_isWindows
-
getDatabase
public String getDatabase()
- 返回:
- the database
-
setNeedStop
public void setNeedStop(boolean m_NeedStop)
- 参数:
m_NeedStop- the m_NeedStop to set
-
getTraceFileName
public String getTraceFileName()
- 返回:
- the traceFileName
-
isConsoleMode
public boolean isConsoleMode()
- 返回:
- the consoleMode
-
setConsoleMode
public void setConsoleMode(boolean consoleMode)
- 参数:
consoleMode- the consoleMode to set
-
-