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
WrapsAverageMinMax
and provides an impl ofDiagnosticsHandler.ProbeHandler
. Note that this class in unsynchronized and needs external synchronization.- Since:
- 4.0
- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected AverageMinMax
avg
protected java.lang.String
name
protected java.util.concurrent.TimeUnit
unit
-
Constructor Summary
Constructors Constructor Description Profiler(java.lang.String name, java.util.concurrent.TimeUnit unit)
Creates a Profiler instance which will reply to key 'name'.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Profiler
add(long time)
double
average()
Profiler
clear()
long
count()
java.util.Map<java.lang.String,java.lang.String>
handleProbe(java.lang.String... keys)
Handles a probe.long
max()
long
min()
java.lang.String[]
supportedKeys()
Returns a list of supported keysjava.lang.String
toString()
protected static java.lang.String
toString(java.util.concurrent.TimeUnit unit)
-
-
-
Field Detail
-
avg
protected final AverageMinMax avg
-
name
protected final java.lang.String name
-
unit
protected final java.util.concurrent.TimeUnit unit
-
-
Constructor Detail
-
Profiler
public 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 itselfunit
- The unit of measurement - only nanos, micros and millis are supported
-
-
Method Detail
-
add
public Profiler add(long time)
-
min
public long min()
-
max
public long max()
-
average
public double average()
-
count
public long count()
-
clear
public Profiler clear()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
handleProbe
public java.util.Map<java.lang.String,java.lang.String> handleProbe(java.lang.String... keys)
Description copied from interface:DiagnosticsHandler.ProbeHandler
Handles a probe. For each key that is handled, the key and its result should be in the returned map.- Specified by:
handleProbe
in interfaceDiagnosticsHandler.ProbeHandler
- Returns:
- Map
. A map of keys and values. A null return value is permissible.
-
supportedKeys
public java.lang.String[] supportedKeys()
Description copied from interface:DiagnosticsHandler.ProbeHandler
Returns a list of supported keys- Specified by:
supportedKeys
in interfaceDiagnosticsHandler.ProbeHandler
-
toString
protected static java.lang.String toString(java.util.concurrent.TimeUnit unit)
-
-