frametime reporting work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
b11aa149d5
commit
028ac3ebb6
@ -2139,6 +2139,7 @@ Undo getPosition new alloc to lower memory footprint
|
||||
Work to reduce allocations
|
||||
Prevent mouse event re-allocation every frame
|
||||
More allocation work
|
||||
Frametime reporting work
|
||||
|
||||
|
||||
|
||||
|
||||
@ -80,12 +80,10 @@ public class ImGuiWindowMacros {
|
||||
globalFrametimePlot = new ImGuiLinePlot("Frametime plot");
|
||||
globalFrametimeDatasets = new HashMap<String,ImGuiLinePlotDataset>();
|
||||
ImGuiWindowMacros.initFramerateGraphSeries("totalframerate");
|
||||
ImGuiWindowMacros.initFramerateGraphSeries("serversim");
|
||||
ImGuiWindowMacros.initFramerateGraphSeries("clientsim");
|
||||
ImGuiWindowMacros.initFramerateGraphSeries("simframes");
|
||||
ImGuiWindowMacros.initFramerateGraphSeries("render");
|
||||
ImGuiWindowMacros.initFramerateGraphSeries("assetLoad");
|
||||
ImGuiWindowMacros.initFramerateGraphSeries("clientNetwork");
|
||||
ImGuiWindowMacros.initFramerateGraphSeries("controls");
|
||||
globalFrametimeWindow.addElement(globalFrametimePlot);
|
||||
globalFrametimeWindow.setOpen(false);
|
||||
Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(globalFrametimeWindow);
|
||||
|
||||
@ -205,6 +205,8 @@ public class Main {
|
||||
//resets running flag to that we can repeatedly loop (ie in tests)
|
||||
running = true;
|
||||
|
||||
double startTime, endTime;
|
||||
|
||||
//main loop
|
||||
while (running) {
|
||||
//enable profiler control
|
||||
@ -229,12 +231,15 @@ public class Main {
|
||||
/// A S S E T M A N A G E R S T U F F
|
||||
///
|
||||
if(EngineState.EngineFlags.RUN_CLIENT){
|
||||
startTime = Globals.engineState.timekeeper.getTime();
|
||||
Globals.profiler.beginCpuSample("Load Assets");
|
||||
LoggerInterface.loggerEngine.DEBUG_LOOP("Begin load assets");
|
||||
Globals.assetManager.loadAssetsInQueue();
|
||||
LoggerInterface.loggerEngine.DEBUG_LOOP("Begin delete assets");
|
||||
Globals.assetManager.handleDeleteQueue();
|
||||
Globals.profiler.endCpuSample();
|
||||
endTime = Globals.engineState.timekeeper.getTime();
|
||||
ImGuiWindowMacros.addGlobalFramerateDatapoint("assetLoad", endTime - startTime);
|
||||
}
|
||||
|
||||
|
||||
@ -245,10 +250,13 @@ public class Main {
|
||||
///
|
||||
//Why is this its own function? Just to get the networking code out of main()
|
||||
if(Globals.clientState.clientConnection != null){
|
||||
startTime = Globals.engineState.timekeeper.getTime();
|
||||
Globals.profiler.beginCpuSample("Client networking");
|
||||
LoggerInterface.loggerEngine.DEBUG_LOOP("Begin parse client messages");
|
||||
Globals.clientState.clientConnection.parseMessagesSynchronous();
|
||||
Globals.profiler.endCpuSample();
|
||||
endTime = Globals.engineState.timekeeper.getTime();
|
||||
ImGuiWindowMacros.addGlobalFramerateDatapoint("clientNetwork", endTime - startTime);
|
||||
}
|
||||
|
||||
|
||||
@ -288,6 +296,7 @@ public class Main {
|
||||
///
|
||||
|
||||
int simFrameHardcapCounter = 0;
|
||||
startTime = Globals.engineState.timekeeper.getTime();
|
||||
while(Globals.engineState.timekeeper.pullFromAccumulator() && framestep > 0 && simFrameHardcapCounter < Timekeeper.SIM_FRAME_HARDCAP){
|
||||
|
||||
//do not simulate extra frames if we're already behind schedule
|
||||
@ -331,6 +340,8 @@ public class Main {
|
||||
MainServerFunctions.simulate();
|
||||
Globals.profiler.endCpuSample();
|
||||
}
|
||||
endTime = Globals.engineState.timekeeper.getTime();
|
||||
ImGuiWindowMacros.addGlobalFramerateDatapoint("simframes", endTime - startTime);
|
||||
|
||||
|
||||
|
||||
@ -351,9 +362,12 @@ public class Main {
|
||||
///
|
||||
LoggerInterface.loggerEngine.DEBUG_LOOP("Begin rendering call");
|
||||
if(EngineState.EngineFlags.RUN_CLIENT && !EngineState.EngineFlags.HEADLESS){
|
||||
startTime = Globals.engineState.timekeeper.getTime();
|
||||
Globals.profiler.beginCpuSample("render");
|
||||
Globals.renderingEngine.drawScreen();
|
||||
Globals.profiler.endCpuSample();
|
||||
endTime = Globals.engineState.timekeeper.getTime();
|
||||
ImGuiWindowMacros.addGlobalFramerateDatapoint("render", endTime - startTime);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ public class Timekeeper {
|
||||
* Gets the time since the engine started from the system
|
||||
* @return The time (in seconds)
|
||||
*/
|
||||
private double getTime(){
|
||||
public double getTime(){
|
||||
if(EngineState.EngineFlags.HEADLESS){
|
||||
return System.currentTimeMillis() - engineStartTime;
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user