mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-10-25 21:40:08 +00:00
document Profiler
This commit is contained in:
1 parent
632f898dc8
commit
9323abc788
1 file changed
+34
@@ -3,20 +3,54 @@ package com.dfsek.terra.profiler;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public interface Profiler {
|
public interface Profiler {
|
||||||
|
/**
|
||||||
|
* Push a frame to this profiler.
|
||||||
|
*
|
||||||
|
* @param frame ID of frame.
|
||||||
|
*/
|
||||||
void push(String frame);
|
void push(String frame);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pop a frame from this profiler.
|
||||||
|
*
|
||||||
|
* @param frame ID of frame. Must match ID
|
||||||
|
* at the top of the profiler stack.
|
||||||
|
*/
|
||||||
void pop(String frame);
|
void pop(String frame);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start profiling.
|
||||||
|
*/
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop profiling.
|
||||||
|
*/
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the profiler data.
|
||||||
|
*
|
||||||
|
* @return Profiler data.
|
||||||
|
*/
|
||||||
Map<String, Timings> getTimings();
|
Map<String, Timings> getTimings();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a {@link AutoCloseable} implementation that
|
||||||
|
* may be used in a try-with-resources statement for
|
||||||
|
* more intuitive profiling, with auto-push/pop.
|
||||||
|
*
|
||||||
|
* @param frame ID of frame.
|
||||||
|
* @return {@link AutoCloseable} implementation for use
|
||||||
|
* in try-with-resources.
|
||||||
|
*/
|
||||||
default ProfileFrame profile(String frame) {
|
default ProfileFrame profile(String frame) {
|
||||||
push(frame);
|
push(frame);
|
||||||
return new ProfileFrame(() -> pop(frame));
|
return new ProfileFrame(() -> pop(frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the profiler data.
|
||||||
|
*/
|
||||||
void reset();
|
void reset();
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user