public class CodePerfTracker
extends Object
Modifier and Type | Field and Description |
---|---|
static CodePerfTracker |
SILENT |
Constructor and Description |
---|
CodePerfTracker(String name) |
CodePerfTracker(String name,
boolean printProgress) |
CodePerfTracker(String name,
boolean printProgress,
boolean isVerbose) |
Modifier and Type | Method and Description |
---|---|
Long |
getMemUsage(String segmentName) |
Long |
getRuntime(String segmentName) |
void |
init(String name,
boolean printProgress) |
boolean |
isReportingCurrOSMemUsage()
Checks a flag that indicates current OS memory usage should be reported alongside peak OS
memory usage.
|
boolean |
isUsingGCCallsToTrackMemory()
Gets the flag that determines if System.gc() is called at beginning and end
of each segment to more accurately track memory usage.
|
boolean |
isVerbose() |
void |
printSummary() |
void |
setReportingCurrOSMemUsage(boolean reportCurrOSMemUsage)
Flag indicating if CodePerfTracker is running in Linux and is reporting memory usage, to also
report current OS memory usage alongside peak OS memory usage.
|
void |
setTrackOSMemUsage(boolean trackOSMemUsage)
Sets tracking of OS memory usage (in Linux only).
|
void |
setVerbose(boolean verbose) |
CodePerfTracker |
start(String segmentName) |
CodePerfTracker |
start(String segmentName,
boolean nested) |
CodePerfTracker |
stop() |
CodePerfTracker |
stop(String segmentName) |
void |
updateName(String name) |
void |
useGCToTrackMemory(boolean useGCCalls)
By setting this flag, more accurate memory usage numbers can be captured.
|
public static final CodePerfTracker SILENT
public CodePerfTracker(String name)
public CodePerfTracker(String name, boolean printProgress)
public CodePerfTracker(String name, boolean printProgress, boolean isVerbose)
public void init(String name, boolean printProgress)
public void updateName(String name)
public Long getRuntime(String segmentName)
public Long getMemUsage(String segmentName)
public boolean isVerbose()
public void setVerbose(boolean verbose)
public CodePerfTracker start(String segmentName)
public CodePerfTracker stop()
public CodePerfTracker start(String segmentName, boolean nested)
public CodePerfTracker stop(String segmentName)
public boolean isUsingGCCallsToTrackMemory()
public void useGCToTrackMemory(boolean useGCCalls)
CodePerfTracker.setTrackOSMemUsage(boolean)
as a convenience.useGCCalls
- Sets a flag that uses System.gc() calls at the beginning
and end of segments to obtain more accurate memory usages.public void setTrackOSMemUsage(boolean trackOSMemUsage)
trackOSMemUsage
- If true, will track curr and peak memory usage of the process as
reported by the OS.public boolean isReportingCurrOSMemUsage()
public void setReportingCurrOSMemUsage(boolean reportCurrOSMemUsage)
reportCurrOSMemUsage
- Flag to report current OS memory usage, default is false.public void printSummary()