ariba.util.core
Class PerformanceState

java.lang.Object
  extended by ariba.util.core.PerformanceState

public class PerformanceState
extends java.lang.Object

This class maintains performance state for the current thread. It can be considered a specialized extension to ThreadDebugState (and, in fact, stores itself there).


Nested Class Summary
static class PerformanceState.Stats
           
 
Field Summary
static PerformanceStateTimedCounter DispatchTimer
           
static java.lang.String ParameterAllowRecordingSuspensions
           
static java.lang.String ParameterEnableLoadTestingMode
           
static PerformanceStateTimedCounter Search
          This perflog metric is for "user searches", both those done by the user in an explicit "search UI", and also searches done on the user's behalf in portlets and other contexts.
static PerformanceStateCounter SearchRows
          This perflog metric is for "user searches", and provides additional information for the "Search" metric.
static PerformanceStateTimedCounter SearchUpdate
          This perflog metric is for updates to the searchable source data for search items.
static PerformanceStateCounter SearchUpdateBytes
          This perflog metric is for updates to the searchable source data for search items, and provides additional information for the "SearchUpdate" metric.
static java.lang.String Status_Cancel
           
static java.lang.String Status_InternalError
           
static java.lang.String Status_Refresh
           
static java.lang.String Status_StoppedWaiting
           
static java.lang.String Status_Success
           
static java.lang.String Status_Timeout
           
static java.lang.String Status_ValidationError
           
static PerformanceStateCPUTimedCounter ThreadCPUTimer
           
static java.lang.String Type_Call
           
static java.lang.String Type_Task
           
static java.lang.String Type_User
           
static java.lang.String Type_Work
           
 
Constructor Summary
PerformanceState()
           
 
Method Summary
static void addObserver(PerformanceStateCore.MetricObserver observer)
           
static void archiveLogFile(Parameters params)
           
static void clear()
          Deprecated. Use ThreadDebugState.clear()
static java.lang.String fileHeaderString(java.lang.String prefix)
           
static int getCommunity()
           
static java.lang.String getNodeName()
           
static PerformanceState.Stats getThisThreadHashtable()
          If you need direct access to the hashtable, you can get it this way.
static boolean isLoggingEnabled()
           
static boolean isQualTest()
          Returns true if the current thread is running a qual test.
static boolean isRecordingSuspended()
           
static boolean isSuspendingAllowed()
          Performance recording should not be suspended if this method returns true.
static PerformanceStateCore[] logMetrics()
          Returns an array of the PerformanceStateCore objects to be used in logging.
static void logPlanFile(java.lang.String query, java.lang.String plan)
           
static void logToFile(PerformanceState.Stats stats)
           
static void registrationComplete()
          Must be called by app after all metrics have been registered.
static void restoreContinuedHashtable(PerformanceState.Stats stats)
           
static void restoreDefaultErrorRuntimeMillis()
           
static void setAllowRecordingSuspensions(boolean flag)
           
static void setCommunity(int communityId)
          Must be initialized prior to first log event
static void setNodeName(java.lang.String nodeName)
          Must be initialized by server prior to first log event
static void setPerformanceCheck(PerformanceCheck check)
           
static void setPerfTestMode(boolean flag)
          perfTestMode is a flag to indicate that the currently running instance is running performance related tests.
static void setStatus(java.lang.String status)
           
static boolean threadStateEnabled()
           
 java.lang.String toString()
           
static void updateErrorRuntimeMillis(long duration)
           
static void watchPerformance(PerformanceCheck checker)
          Set a thread to have its execution time monitored.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DispatchTimer

public static PerformanceStateTimedCounter DispatchTimer

Search

public static PerformanceStateTimedCounter Search
This perflog metric is for "user searches", both those done by the user in an explicit "search UI", and also searches done on the user's behalf in portlets and other contexts. It appends three columns to the perf csv file: (1) "Search" for the search count, (2) "SearchMillis" for the search elapsed time, and (3) "SearchEvents" for a categorization of the counts by event name. The stop method takes an event name, and can be used to subdivide the searches by event type, to provide more context about what is going on. In upstream, it is used for project searches, document searches, MyTasks searches, portlet task searches, supplier/SPQ searches, and message board / notes searches.


SearchRows

public static PerformanceStateCounter SearchRows
This perflog metric is for "user searches", and provides additional information for the "Search" metric. It appends one column to the perf csv file: "SearchRows" for the number of rows returned by the searches counted by the Search metric. In some contexts the row count is not available to set into this metric.


SearchUpdate

public static PerformanceStateTimedCounter SearchUpdate
This perflog metric is for updates to the searchable source data for search items. This is measuring changes to the searchable source data, which is usually a generated representation of transactional data for a searchable item. It appends three columns to the perf csv file: (1) "SearchUpdate" for the count of updates to searchable items, (2) "SearchUpdateMillis" for the elapsed time while updating searchable items, and (3) "SearchUpdateEvents" for a categorization of the counts by event name. The stop method takes an event name, and can be used to subdivide the search updates by event type, to provide more context about what is going on. In upstream, it is used for updates to AttrsBlob, FileBlob, and NotesBlob, and applies both before and after adoption of Arches for upstream search.


SearchUpdateBytes

public static PerformanceStateCounter SearchUpdateBytes
This perflog metric is for updates to the searchable source data for search items, and provides additional information for the "SearchUpdate" metric. It appends one column to the perf csv file: "SearchUpdateBytes" for the number of bytes of searchable source data generated by the search updates. In some contexts the byte count may not available to set into this metric.


ThreadCPUTimer

public static PerformanceStateCPUTimedCounter ThreadCPUTimer

ParameterAllowRecordingSuspensions

public static final java.lang.String ParameterAllowRecordingSuspensions
See Also:
Constant Field Values

ParameterEnableLoadTestingMode

public static final java.lang.String ParameterEnableLoadTestingMode
See Also:
Constant Field Values

Type_User

public static final java.lang.String Type_User
See Also:
Constant Field Values

Type_Task

public static final java.lang.String Type_Task
See Also:
Constant Field Values

Type_Work

public static final java.lang.String Type_Work
See Also:
Constant Field Values

Type_Call

public static final java.lang.String Type_Call
See Also:
Constant Field Values

Status_Success

public static final java.lang.String Status_Success
See Also:
Constant Field Values

Status_InternalError

public static final java.lang.String Status_InternalError
See Also:
Constant Field Values

Status_ValidationError

public static final java.lang.String Status_ValidationError
See Also:
Constant Field Values

Status_Timeout

public static final java.lang.String Status_Timeout
See Also:
Constant Field Values

Status_StoppedWaiting

public static final java.lang.String Status_StoppedWaiting
See Also:
Constant Field Values

Status_Refresh

public static final java.lang.String Status_Refresh
See Also:
Constant Field Values

Status_Cancel

public static final java.lang.String Status_Cancel
See Also:
Constant Field Values
Constructor Detail

PerformanceState

public PerformanceState()
Method Detail

registrationComplete

public static void registrationComplete()
Must be called by app after all metrics have been registered. At that point logging can begin (and no further registration should be performed)


threadStateEnabled

public static final boolean threadStateEnabled()

isQualTest

public static final boolean isQualTest()
Returns true if the current thread is running a qual test. The intent of this method is to return true when additional diagnostic information should be captured. There are 3 components to this determination: 1) threadStateEnabled() 2) qualMode - this is set at server startup indicating that thread state is enabled and it is possible that a qual (LQ/BQ) test could be running. (opposed to a performance test). 3) The testId property is non-null on the current thread.

Returns:

isLoggingEnabled

public static boolean isLoggingEnabled()

clear

public static void clear()
Deprecated. Use ThreadDebugState.clear()

Remove all values that are currently stored.


watchPerformance

public static void watchPerformance(PerformanceCheck checker)
Set a thread to have its execution time monitored. If clear() has not been called for this thread before the errorDuration has passed, then the thread debug state will be written to the error log.

Parameters:
checker - -- the performance check object. It's warningTimeMillis determines the logging period

restoreDefaultErrorRuntimeMillis

public static void restoreDefaultErrorRuntimeMillis()

updateErrorRuntimeMillis

public static void updateErrorRuntimeMillis(long duration)

setPerformanceCheck

public static void setPerformanceCheck(PerformanceCheck check)

addObserver

public static void addObserver(PerformanceStateCore.MetricObserver observer)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getThisThreadHashtable

public static PerformanceState.Stats getThisThreadHashtable()
If you need direct access to the hashtable, you can get it this way. If you intend to save the object for later use (past the bounds of the current ui boundary, you should call clone on the data so that when this object is cleared, your shared copy of the hashtable is not also cleared.


restoreContinuedHashtable

public static void restoreContinuedHashtable(PerformanceState.Stats stats)

setStatus

public static void setStatus(java.lang.String status)

isRecordingSuspended

public static boolean isRecordingSuspended()

isSuspendingAllowed

public static boolean isSuspendingAllowed()
Performance recording should not be suspended if this method returns true. this is done during performance testing so the perf logs more accurately reflect the true load on the system.

Returns:

setAllowRecordingSuspensions

public static void setAllowRecordingSuspensions(boolean flag)

setPerfTestMode

public static void setPerfTestMode(boolean flag)
perfTestMode is a flag to indicate that the currently running instance is running performance related tests. This flag is intended to be used to determine if the gathering of additional diagnostic information should be turned off. It is *not* intended to affect functionality in the application. The default value is false, performance testing installations should set this value to true.

Parameters:
flag -

setNodeName

public static void setNodeName(java.lang.String nodeName)
Must be initialized by server prior to first log event


getNodeName

public static java.lang.String getNodeName()

setCommunity

public static void setCommunity(int communityId)
Must be initialized prior to first log event


getCommunity

public static int getCommunity()

logMetrics

public static PerformanceStateCore[] logMetrics()
Returns an array of the PerformanceStateCore objects to be used in logging.


fileHeaderString

public static java.lang.String fileHeaderString(java.lang.String prefix)

logToFile

public static void logToFile(PerformanceState.Stats stats)

logPlanFile

public static void logPlanFile(java.lang.String query,
                               java.lang.String plan)

archiveLogFile

public static void archiveLogFile(Parameters params)


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.