stomp.util
Class Bench
java.lang.Object
|
+--stomp.util.Bench
- public class Bench
- extends java.lang.Object
utility class for benchmarking code. Use as storage for times of critical events,
and as a simple way to find out how many milliseconds passed between marked events.
This class is especially useful for marking points in a stack trace which happen to
exist in different objects.
- Author:
- Eric Lindauer
Constructor Summary |
Bench()
|
Method Summary |
static long |
diff(int key,
int key2)
|
static long |
diff(java.lang.String key,
java.lang.String key2)
|
static long |
difference(java.lang.String from,
java.lang.String to)
returns the difference, in milliseconds, between the times the two marks were
made in the bench. |
static long |
get(int key)
|
static long |
get(java.lang.String key)
returns the long in the bench under the given key. |
static java.lang.Object |
getKey()
|
static void |
main(java.lang.String[] args)
|
static java.lang.String |
mark()
marks the current time in the bench. |
static void |
mark(int key)
|
static void |
mark(java.lang.String key)
marks the current time in the bench, under the given key. |
static java.lang.String |
mprint(java.lang.String from,
java.lang.String to)
|
static java.lang.String |
print(int key)
|
static void |
print(int key,
int key2)
|
static java.lang.String |
print(java.lang.String key)
|
static void |
print(java.lang.String key,
java.lang.String key2)
calls Log.debug with the difference between the two keys given |
static void |
tab()
|
static void |
untab()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Bench
public Bench()
tab
public static void tab()
untab
public static void untab()
mark
public static java.lang.String mark()
- marks the current time in the bench. Returns the unique key used
to mark this time.
getKey
public static java.lang.Object getKey()
mark
public static void mark(java.lang.String key)
- marks the current time in the bench, under the given key.
NOTE: Overwrites any time that was already there.
get
public static long get(java.lang.String key)
- returns the long in the bench under the given key. Throws NullPointerException
if the given key was never set.
difference
public static long difference(java.lang.String from,
java.lang.String to)
- returns the difference, in milliseconds, between the times the two marks were
made in the bench. Throws NullPointerException if either of the two
marks was never made.
mprint
public static java.lang.String mprint(java.lang.String from,
java.lang.String to)
print
public static void print(java.lang.String key,
java.lang.String key2)
- calls Log.debug with the difference between the two keys given
print
public static java.lang.String print(java.lang.String key)
print
public static java.lang.String print(int key)
print
public static void print(int key,
int key2)
diff
public static long diff(java.lang.String key,
java.lang.String key2)
- See Also:
difference
mark
public static void mark(int key)
get
public static long get(int key)
diff
public static long diff(int key,
int key2)
main
public static void main(java.lang.String[] args)