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