public final class Performance
extends java.lang.Object
| Constructor and Description |
|---|
Performance() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
format(long size)
Formats a number according to the binary size orders (KB, MB, ...).
|
static java.lang.String |
format(long size,
boolean det)
Formats a file size according to the binary size orders (KB, MB, ...).
|
static void |
gc(int n)
Performs some garbage collection.
|
static java.lang.String |
getMemory()
Returns a formatted representation of the current memory consumption.
|
java.lang.String |
getTime()
Returns the measured execution time in milliseconds and reinitializes
the timer.
|
java.lang.String |
getTime(int runs)
Returns the measured execution time in milliseconds, divided by the
number of runs, and reinitializes the timer.
|
static java.lang.String |
getTime(long time,
int runs)
Returns a string with the measured execution time in milliseconds.
|
static long |
memory()
Returns the current memory consumption in bytes.
|
static void |
sleep(long ms)
Sleeps the specified number of milliseconds.
|
long |
time()
Returns the measured execution time in nanoseconds.
|
java.lang.String |
toString() |
public long time()
public java.lang.String getTime()
public java.lang.String getTime(int runs)
runs - number of runspublic static java.lang.String getTime(long time,
int runs)
time - measured time in nanosecondsruns - number of runspublic static java.lang.String getMemory()
public static java.lang.String format(long size)
size - value to be formattedpublic static java.lang.String format(long size,
boolean det)
size - file sizedet - detailed suffixpublic static void sleep(long ms)
ms - time in milliseconds to waitpublic static void gc(int n)
n - number of times to execute garbage collectionpublic static long memory()
public java.lang.String toString()
toString in class java.lang.Object