public final class Performance extends Object
Constructor and Description |
---|
Performance() |
Modifier and Type | Method and Description |
---|---|
static String |
format(long size)
Returns a human-readable representation for the specified size value (b, kB, MB, ...).
|
static void |
gc(int count)
Performs some garbage collection.
|
static String |
getMemory()
Returns a formatted representation of the current memory consumption.
|
String |
getTime()
Returns the measured execution time in milliseconds and resets the timer.
|
String |
getTime(int runs)
Returns the measured execution time in milliseconds, divided by the number of runs,
and resets the timer.
|
static String |
getTime(long nano,
int runs)
Returns a string with the measured execution time in milliseconds.
|
static long |
memory()
Returns the current memory consumption in bytes.
|
static double |
ms(long nano,
int runs)
Returns the measured execution time in nanoseconds and resets the timer.
|
long |
ns()
Returns the measured execution time in nanoseconds and resets the timer.
|
long |
ns(boolean reset)
Returns the measured execution time in nanoseconds.
|
static void |
sleep(long ms)
Sleeps the specified number of milliseconds.
|
String |
toString() |
public long ns()
public long ns(boolean reset)
reset
- reset timerpublic String getTime()
public String getTime(int runs)
runs
- number of runspublic static double ms(long nano, int runs)
nano
- execution time in nanosecondsruns
- number of runspublic static String getTime(long nano, int runs)
nano
- measured time in nanosecondsruns
- number of runspublic static String getMemory()
public static String format(long size)
size
- value to be formattedpublic static void sleep(long ms)
ms
- time in milliseconds to waitpublic static void gc(int count)
count
- number of times to execute garbage collectionpublic static long memory()
Copyright © 2005–2023 BaseX Team. All rights reserved.