|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.nucleus.TimedOperationService atg.nucleus.servlet.ServletService atg.nucleus.servlet.HttpServletService atg.servlet.DynamoServlet atg.service.perfmonitor.PerformanceMonitor
public class PerformanceMonitor
The Performance Monitor servlet is responsible for gathering two types of performance data from different operations which occur in the server.
The first type of data which it gathers are the current execution stacks of all running threads. This allows users to see what operations a thread is currently doing.
The second type of data which is gathered is the time based performance data for an operation. This data is count, average, min, max, and total execution time for each operation. This also keeps track of parameters on the operations. These parameters are the objects which these operations are working on. The above stats are also kept for each parameter.
In order to use the performance monitor in your code, all you need to do is import atg.service.perfmonitor.* and add the following code snippets to your code. private final String RENDER_JHTML = "Render JHTML page"; private final String EXECUTE_SQL = "Execute SQL Query"; private String mPageName = "page.jhtml"; private String mSQLQuery = "select * from table"; PerformanceMonitor.startOperation(RENDER_JHTML, mPageName); ... source code to start render PerformanceMonitor.startOperation(EXECUTE_SQL, mSQLQuery); ... source code to read from table 1 in database PerformanceMonitor.startOperation(); ... source code to read from database PerformanceMonitor.endOperation(); ... more source code to read from table 1 in database PerformanceMonitor.endOperation(); ... more source code to finish render PerformanceMonitor.endOperation();
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
static int |
DISABLED
DISABLED mode turns the performance monitor off |
static int |
MEMORY
MEMORY mode runs the performance monitor with stack tracking, operation timestamping, and memory tracking on |
static int |
NORMAL
NORMAL mode runs the performance monitor with only stack tracking on |
static int |
TIME
TIME mode runs the performance monitor with stack tracking and operation timestamping on |
Fields inherited from class atg.servlet.DynamoServlet |
---|
mAllowCleanupRequest, mParameters |
Fields inherited from class atg.nucleus.servlet.ServletService |
---|
SERVLET_INFO_KEY |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
PerformanceMonitor()
Constructs a null Template. |
Method Summary | |
---|---|
static void |
cancelOperation(java.lang.String pOpName)
Cancels an operation |
static void |
cancelOperation(java.lang.String pOpName,
java.lang.String pParameter)
Cancels an operation and supplies a parameter |
protected void |
cancelOperationInternal(java.lang.String pOpName,
java.lang.String pParameter)
The cancelOperation which does the work for the performance monitor. |
protected void |
cleanMemoryPerformanceData()
This method resets the memory data from the PerformanceData objects in the mPerformanceHash table. |
protected void |
cleanPerformanceStructure()
This method cleans out the mPerformanceHash table so that there are no PerformanceHashTables in it and no PerformanceData objects within that table. |
protected void |
cleanStackStructure()
This method cleans out the mThreadStackHash table so that there are no Stack objects in it and no PerformanceStackData objects within that object. |
protected void |
cleanThreadStack(java.lang.Thread pThread)
This method cleans out the Stack in the mThreadStackHash table for the given thread so there are no PerformanceStackData objects within that object. |
void |
doStartService()
This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values. |
void |
doStopService()
This is called when a Service is required to shut down. |
static void |
endOperation()
Marks the end of the most recent operation in the code for which monitoring has been started, but not yet ended. |
static void |
endOperation(java.lang.String pOpName)
Marks the end of an operation in the code |
static void |
endOperation(java.lang.String pOpName,
java.lang.String pParameter)
Marks the end of an operation in the code and supplies a parameter |
static void |
endOperation(java.lang.String pOpName,
java.lang.String pParameter,
ApplicationLogging pLogger)
Marks the end of an operation in the code and supplies a parameter. |
protected void |
endOperationInternal(java.lang.String pOpName,
java.lang.String pParameter)
The endOperation which does the work for the performance monitor. |
java.lang.Thread[] |
getExcludedThreads()
Returns property excludedThreads |
java.lang.String[] |
getExcludeServers()
Returns property excludeServers |
boolean |
getIncludeNestedOperations()
Returns property includeNestedOperations |
int |
getInitialPerformanceDataPoolSize()
Returns property initialPerformanceDataPoolSize |
int |
getInitialStackDataPoolSize()
Returns property initialStackDataPoolSize |
int |
getInitialStackPoolSize()
Returns property initialStackPoolSize |
int |
getMode()
Returns property mode |
java.util.Hashtable |
getPerformanceHash()
Returns property performanceHash |
static PerformanceMonitor |
getPerformanceMonitor()
Returns the global PerformanceMonitor object |
java.util.Hashtable |
getThreadStackHash()
Returns property threadStackHash |
boolean |
getVerbose()
Returns property verbose |
boolean |
handleReset(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
This method handles the reset data button on the performance monitor page. |
static boolean |
isEnabled()
Returns whether the perf monitor is enabled or not |
protected boolean |
isExcludedThread(java.lang.Thread pThread)
This method determines if the given thread is in the excludedThreads list. |
void |
resetPerformanceData()
Resets all the time performance data back to 0 |
protected void |
setExcludedThreads(java.lang.Thread[] pExcludedThreads)
Sets property excludedThreads |
void |
setExcludeServers(java.lang.String[] pExcludeServers)
Sets property excludeServers |
void |
setIncludeNestedOperations(boolean pIncludeNestedOperations)
Sets property includeNestedOperations |
void |
setInitialPerformanceDataPoolSize(int pInitialPerformanceDataPoolSize)
Sets property initialPerformanceDataPoolSize |
void |
setInitialStackDataPoolSize(int pInitialStackDataPoolSize)
Sets property initialStackDataPoolSize |
void |
setInitialStackPoolSize(int pInitialStackPoolSize)
Sets property initialStackPoolSize |
void |
setMode(int pMode)
Sets property mode |
protected void |
setupExcludeServers()
This method takes the mExcludeServers list and adds all the threads from that component to the mExcludedThreads list. |
void |
setVerbose(boolean pVerbose)
Sets property verbose |
static void |
startOperation(java.lang.String pOpName)
Marks the beginning of an operation in the code |
static void |
startOperation(java.lang.String pOpName,
java.lang.String pParameter)
Marks the beginning of an operation in the code and supplies a parameter |
protected void |
startOperationInternal(java.lang.String pOpName,
java.lang.String pParameter)
The startOperation which does the work for the performance monitor. |
Methods inherited from class atg.servlet.DynamoServlet |
---|
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, service, service, service, setParameter |
Methods inherited from class atg.nucleus.servlet.ServletService |
---|
destroy, getServletConfig, getServletInfo, init, setServletInfo |
Methods inherited from class atg.nucleus.TimedOperationService |
---|
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
public static final int DISABLED
public static final int NORMAL
public static final int TIME
public static final int MEMORY
Constructor Detail |
---|
public PerformanceMonitor()
Method Detail |
---|
public void resetPerformanceData()
protected void startOperationInternal(java.lang.String pOpName, java.lang.String pParameter)
Starting an operation entails allocating a new Stack object if it does not exist and then pushing a PerformanceStackData object populated with the supplied data onto the stack and setting the start time.
pOpName
- the name of the operationpParameter
- the object or name of object which this operation is working onprotected void endOperationInternal(java.lang.String pOpName, java.lang.String pParameter) throws PerfStackMismatchException
Ending an operation entails getting the PerformanceStackData object from the top of the stack, comparing it for stack mismatch, getting the execution time for the operation and setting some stats based on that information.
pOpName
- the name of the operation; if null, then no stack mismatch check takes place.pParameter
- the object or name of object which this operation is working on
PerfStackMismatchException
- if the arguments do not match the operation in the top of the stackprotected void cancelOperationInternal(java.lang.String pOpName, java.lang.String pParameter) throws PerfStackMismatchException
pOpName
- the name of the operationpParameter
- the object or name of object which this operation is working on
PerfStackMismatchException
- if the arguments do not match the operation in the top of the stackprotected void cleanThreadStack(java.lang.Thread pThread)
protected void cleanStackStructure()
protected void cleanPerformanceStructure()
protected void cleanMemoryPerformanceData()
protected void setupExcludeServers()
protected boolean isExcludedThread(java.lang.Thread pThread)
pThread
- the thread to search for in the excludedThreads listpublic void setMode(int pMode)
public int getMode()
public void setVerbose(boolean pVerbose)
public boolean getVerbose()
public void setIncludeNestedOperations(boolean pIncludeNestedOperations)
public boolean getIncludeNestedOperations()
public void setExcludeServers(java.lang.String[] pExcludeServers)
public java.lang.String[] getExcludeServers()
protected void setExcludedThreads(java.lang.Thread[] pExcludedThreads)
public java.lang.Thread[] getExcludedThreads()
public void setInitialStackDataPoolSize(int pInitialStackDataPoolSize)
public int getInitialStackDataPoolSize()
public void setInitialPerformanceDataPoolSize(int pInitialPerformanceDataPoolSize)
public int getInitialPerformanceDataPoolSize()
public void setInitialStackPoolSize(int pInitialStackPoolSize)
public int getInitialStackPoolSize()
public java.util.Hashtable getThreadStackHash()
public java.util.Hashtable getPerformanceHash()
public static final PerformanceMonitor getPerformanceMonitor()
public static final void startOperation(java.lang.String pOpName)
pOpName
- the name of the operation which begins in the codepublic static final void startOperation(java.lang.String pOpName, java.lang.String pParameter)
pOpName
- the name of the operation which begins in the codepParameter
- the object or name of the object which the operation is executing onpublic static final void endOperation()
public static final void endOperation(java.lang.String pOpName) throws PerfStackMismatchException
pOpName
- the name of the operation which has completed in the code
PerfStackMismatchException
- if this call is called out of order in relation to the other endOperation calls.public static final void endOperation(java.lang.String pOpName, java.lang.String pParameter) throws PerfStackMismatchException
pOpName
- the name of the operation which has completed in the codepParameter
- the object or name of the object which the operation has completed executing on
PerfStackMismatchException
- if this call is called out of order in relation to the other endOperation calls.public static final void endOperation(java.lang.String pOpName, java.lang.String pParameter, ApplicationLogging pLogger)
pOpName
- the name of the operation which has completed in the codepParameter
- the object or name of the object which the operation has completed executing on
PerfStackMismatchException
- if this call is called out of order in relation to the other endOperation calls.public static final void cancelOperation(java.lang.String pOpName) throws PerfStackMismatchException
pOpName
- the name of the operation which is to be cancelled
PerfStackMismatchException
- if this call is called out of order in relation to the other endOperation calls.public static final void cancelOperation(java.lang.String pOpName, java.lang.String pParameter) throws PerfStackMismatchException
pOpName
- the name of the operation which is to be cancelledpParameter
- the object or name of the object which the operation is to be cancelled on
PerfStackMismatchException
- if this call is called out of order in relation to the other endOperation calls.public static final boolean isEnabled()
public void doStartService() throws ServiceException
GenericService
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting uppublic void doStopService() throws ServiceException
GenericService
doStopService
in class GenericService
ServiceException
- if the Service had a problem shutting downpublic boolean handleReset(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
req
- the request to be processedres
- the response object for this request
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |