add new files

This commit is contained in:
Sen 2025-03-11 14:09:49 +01:00
parent 4e90a93d68
commit 8038516a66
65 changed files with 7996 additions and 0 deletions

View file

@ -0,0 +1,56 @@
package game.util;
import game.window.WCF;
public enum PerfSection {
TIMING("Timing"),
INPUT("Input"),
TICK("Tick"),
UPDATE("Update"),
RENDER("Render"),
GUI("Gui"),
REST("Rest"),
SWAP("Swap"),
EVENTS("Events"),
WAIT("Wait");
private static PerfSection section;
private static int swap;
private static long start;
private static long total;
private final String name;
private long time;
private long[] last = new long[2];
private PerfSection(String name) {
this.name = name;
}
public void enter() {
this.time = WCF.getTime();
if(section != null)
section.last[swap] = section.time = this.time - section.time;
section = this;
}
public String getName() {
return this.name;
}
public long getLast() {
return this.last[swap ^ 1];
}
public static void swap() {
long current = WCF.getTime();
total = current - start;
start = current;
swap ^= 1;
}
public static long getTotal(boolean wait) {
return total - (wait ? 0L : WAIT.getLast());
}
}