Package org.jgroups.util
Class Profiler
- java.lang.Object
- 
- org.jgroups.util.Profiler
 
- 
- All Implemented Interfaces:
- DiagnosticsHandler.ProbeHandler
 
 public class Profiler extends java.lang.Object implements DiagnosticsHandler.ProbeHandler WrapsAverageMinMaxand provides an impl ofDiagnosticsHandler.ProbeHandler. Note that this class in unsynchronized and needs external synchronization.- Since:
- 4.0
- Author:
- Bela Ban
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected AverageMinMaxavgprotected java.lang.Stringnameprotected java.util.concurrent.TimeUnitunit
 - 
Constructor SummaryConstructors Constructor Description Profiler(java.lang.String name, java.util.concurrent.TimeUnit unit)Creates a Profiler instance which will reply to key 'name'.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Profileradd(long time)doubleaverage()Profilerclear()longcount()java.util.Map<java.lang.String,java.lang.String>handleProbe(java.lang.String... keys)Handles a probe.longmax()longmin()java.lang.String[]supportedKeys()Returns a list of supported keysjava.lang.StringtoString()protected static java.lang.StringtoString(java.util.concurrent.TimeUnit unit)
 
- 
- 
- 
Field Detail- 
avgprotected final AverageMinMax avg 
 - 
nameprotected final java.lang.String name 
 - 
unitprotected final java.util.concurrent.TimeUnit unit 
 
- 
 - 
Constructor Detail- 
Profilerpublic Profiler(java.lang.String name, java.util.concurrent.TimeUnit unit)Creates a Profiler instance which will reply to key 'name'.- Parameters:
- name- The name under which the profiler will register itself
- unit- The unit of measurement - only nanos, micros and millis are supported
 
 
- 
 - 
Method Detail- 
addpublic Profiler add(long time) 
 - 
minpublic long min() 
 - 
maxpublic long max() 
 - 
averagepublic double average() 
 - 
countpublic long count() 
 - 
clearpublic Profiler clear() 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
handleProbepublic java.util.Map<java.lang.String,java.lang.String> handleProbe(java.lang.String... keys) Description copied from interface:DiagnosticsHandler.ProbeHandlerHandles a probe. For each key that is handled, the key and its result should be in the returned map.- Specified by:
- handleProbein interface- DiagnosticsHandler.ProbeHandler
- Returns:
- Map. A map of keys and values. A null return value is permissible. 
 
 - 
supportedKeyspublic java.lang.String[] supportedKeys() Description copied from interface:DiagnosticsHandler.ProbeHandlerReturns a list of supported keys- Specified by:
- supportedKeysin interface- DiagnosticsHandler.ProbeHandler
 
 - 
toStringprotected static java.lang.String toString(java.util.concurrent.TimeUnit unit) 
 
- 
 
-