public class ProfilerSystem extends Object implements ReadableProfiler
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ProfilerSystem.LocatedInfo |
Modifier and Type | Field and Description |
---|---|
private boolean |
checkTimeout |
private ProfilerSystem.LocatedInfo |
currentInfo |
private IntSupplier |
endTickGetter |
private String |
location |
private Map<String,ProfilerSystem.LocatedInfo> |
locationInfos |
private static Logger |
LOGGER |
private List<String> |
path |
private int |
startTick |
private long |
startTime |
private boolean |
tickStarted |
private LongSupplier |
timeGetter |
private it.unimi.dsi.fastutil.longs.LongList |
timeList |
private static long |
TIMEOUT_NANOSECONDS |
Constructor and Description |
---|
ProfilerSystem(LongSupplier timeGetter,
IntSupplier tickGetter,
boolean checkTimeout) |
Modifier and Type | Method and Description |
---|---|
void |
endTick() |
private ProfilerSystem.LocatedInfo |
getCurrentInfo() |
ProfileResult |
getResult() |
void |
pop() |
void |
push(String location) |
void |
push(Supplier<String> locationGetter) |
void |
startTick() |
void |
swap(String location) |
void |
swap(Supplier<String> locationGetter) |
void |
visit(String marker)
Increment the visit count for a marker.
|
void |
visit(Supplier<String> markerGetter)
Increment the visit count for a marker.
|
private static final long TIMEOUT_NANOSECONDS
private static final Logger LOGGER
private final it.unimi.dsi.fastutil.longs.LongList timeList
private final Map<String,ProfilerSystem.LocatedInfo> locationInfos
private final IntSupplier endTickGetter
private final LongSupplier timeGetter
private final long startTime
private final int startTick
private String location
private boolean tickStarted
@Nullable private ProfilerSystem.LocatedInfo currentInfo
private final boolean checkTimeout
public ProfilerSystem(LongSupplier timeGetter, IntSupplier tickGetter, boolean checkTimeout)
private ProfilerSystem.LocatedInfo getCurrentInfo()
public void visit(String marker)
This is useful to keep track of number of calls made to performance- wise expensive methods.
public void visit(Supplier<String> markerGetter)
This is useful to keep track of number of calls made to performance- wise expensive methods.
This method is preferred if getting the marker is costly; the supplier won't be called if the profiler is disabled.
public ProfileResult getResult()
getResult
in interface ReadableProfiler