public abstract class MemoryProfiler extends Object implements ComparableProfiler, InstantProfiler
Modifier and Type | Class and Description |
---|---|
static class |
MemoryProfiler.MemoryType
The type of memory.
|
Constructor and Description |
---|
MemoryProfiler() |
Modifier and Type | Method and Description |
---|---|
long |
compare(long start,
long end)
Compare two values, the value returned will then be used by
Profiler.printValue(long) . |
protected static long |
getMemory(long total,
long free,
boolean usedMemory)
Computes the used or free memory.
|
String |
getName()
Gets the profiler's name.
|
protected abstract long |
getTotal()
Gets the total memory available.
|
protected abstract String |
getType()
Gets the type of memory.
|
boolean |
isBiggerPrinted(long v1,
long v2)
Checks whether a value will appear bigger than another once printed.
|
protected static void |
printMemory(Logger logger,
long total,
long freeMemory,
boolean printUsedMemory,
boolean printTotal)
Prints the memory to logger.
|
protected static String |
printMemory(long total,
long memory,
boolean printTotal)
Gets the memory to a string.
|
String |
printValue(long value)
Prints a value with its unit.
|
static void |
setMemoryType(MemoryProfiler.MemoryType memoryType)
Sets the
MemoryProfiler.MemoryType to use. |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCurrentValue
public long compare(long start, long end)
ComparableProfiler
Profiler.printValue(long)
.compare
in interface ComparableProfiler
start
- the initial value.end
- the final value.protected static long getMemory(long total, long free, boolean usedMemory)
total
- the total memory available.free
- the free memory.usedMemory
- true
if the memory to print is the used memory.public String getName()
Profiler
protected abstract long getTotal()
protected abstract String getType()
public boolean isBiggerPrinted(long v1, long v2)
Profiler
isBiggerPrinted
in interface Profiler
v1
- the first valuev2
- the second valuetrue
if v1 will look > v2.Profiler.printValue(long)
protected static void printMemory(Logger logger, long total, long freeMemory, boolean printUsedMemory, boolean printTotal)
logger
- the logger to use.total
- the total memory.freeMemory
- the free memory.printUsedMemory
- true
if the memory to print is the used memory.printTotal
- true
to print the total memory.protected static String printMemory(long total, long memory, boolean printTotal)
total
- the total memory available.memory
- the memory to print.printTotal
- true
to print the total memory.public String printValue(long value)
Profiler
printValue
in interface Profiler
value
- the value received from Profiler.getCurrentValue()
.public static void setMemoryType(MemoryProfiler.MemoryType memoryType)
MemoryProfiler.MemoryType
to use.memoryType
- the MemoryProfiler.MemoryType
to use.