|
Project Wonder 5.0.0.8794 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecter.extensions.statistics.ERXStats
public class ERXStats
ERXStats provides a simple interface for logging statistics information like WOEvent, but also tracked on a per-thread basis (so you can dump stats just for a particular thread). DO PROBABLY DO NOT WANT TO TURN THIS ON IN PRODUCTION.
As an example, you may want to track stats on keypaths in your components. In your base components, you could add:
public Object valueForKeyPath(String keyPath) {
Object value;
if (_shouldTrackStats) {
String logName = ERXStringUtilities.getSimpleClassName(getClass()) + ": " + keyPath;
ERXStats.markStart(logName);
try {
value = super.valueForKeyPath(keyPath);
}
finally {
ERXStats.markEnd(logName);
}
}
else {
value = super.valueForKeyPath(keyPath);
}
return value;
}
| Properties | |
er.extensions.erxStats.enabled | if true, stats will be initialized on each for each request |
er.extensions.erxStats.max | the maximum historical stats to collect (defaults to 1000) |
| Nested Class Summary | |
|---|---|
static class |
ERXStats.LogEntry
|
| Field Summary | |
|---|---|
static Logger |
log
|
| Constructor Summary | |
|---|---|
ERXStats()
|
|
| Method Summary | |
|---|---|
static void |
addDurationForKey(long duration,
String key)
Adds the specified duration in milliseconds for the given key. |
static NSSet<String> |
aggregateKeys()
Returns the aggregate key names for all of the threads that have been recorded. |
static NSArray<ERXStats.LogEntry> |
aggregateLogEntries()
Returns an array of LogEntries that represents the aggregate time for all of the tracked stats in the queue, uniqued on key. |
static ERXStats.LogEntry |
aggregateLogEntryForKey(String key)
Returns a LogEntry that represents the aggregate data collected for the given key in all of the recorded threads. |
static void |
initStatistics()
Initializes the logging stats manually. |
static void |
initStatisticsIfNecessary()
Initializes the logging system if the property er.extensions.erxStats.enabled is true. |
static boolean |
isTrackingStatistics()
Returns true if the current thread is tracking statistics. |
static ERXStats.LogEntry |
logEntryForKey(String key)
Returns the log entry for the given key. |
static void |
logStatisticsForOperation(Logger statsLog,
String operation)
Logs the messages since the last call to initStatistics() ordered by some key. |
static void |
logStatisticsForOperation(String operation)
Logs the messages since the last call to initStatistics() ordered by some key. |
static void |
markEnd(String key)
Marks the end of a process, and calls addDuration(..) with the time since markStart. |
static void |
markStart(String key)
Mark the start of a process, call markEnd when it is over to log the duration. |
static void |
reset()
Resets statistics for this thread AND the global queue. |
static NSMutableDictionary<String,ERXStats.LogEntry> |
statistics()
Returns the statistics for the current thread. |
static boolean |
traceCollectingEnabled()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Logger log
| Constructor Detail |
|---|
public ERXStats()
| Method Detail |
|---|
public static void initStatisticsIfNecessary()
public static boolean traceCollectingEnabled()
public static void initStatistics()
public static boolean isTrackingStatistics()
public static NSMutableDictionary<String,ERXStats.LogEntry> statistics()
public static ERXStats.LogEntry logEntryForKey(String key)
key - the key to lookup
public static NSSet<String> aggregateKeys()
public static ERXStats.LogEntry aggregateLogEntryForKey(String key)
key - the key to lookup aggregate stats for
public static NSArray<ERXStats.LogEntry> aggregateLogEntries()
public static void markStart(String key)
key - the key log to start loggingpublic static void markEnd(String key)
key - the key to log under
public static void addDurationForKey(long duration,
String key)
duration - the duration in milliseconds of the operationkey - the name to log the time underpublic static void reset()
public static void logStatisticsForOperation(String operation)
operation - operation to sort on ("sum", "count", "min", "max", "avg")
public static void logStatisticsForOperation(Logger statsLog,
String operation)
operation - operation to sort on ("sum", "count", "min", "max", "avg")
|
Last updated: Thu, Jan 8, 2009 12:32 PM EST | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||