Break out network monitor debug window
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
e20843d3f4
commit
e33706c21d
@ -1135,6 +1135,7 @@ Break out dependency documentation into a dedicated file
|
|||||||
Fix terrain editing
|
Fix terrain editing
|
||||||
Fix foliage not updating at edited chunk
|
Fix foliage not updating at edited chunk
|
||||||
Dedicated control for opening crafting
|
Dedicated control for opening crafting
|
||||||
|
Break out network imgui debug window
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
package electrosphere.client.ui.menu.debug;
|
package electrosphere.client.ui.menu.debug;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.renderer.ui.imgui.ImGuiLinePlot;
|
|
||||||
import electrosphere.renderer.ui.imgui.ImGuiLinePlot.ImGuiLinePlotDataset;
|
|
||||||
import electrosphere.renderer.ui.imgui.ImGuiWindow;
|
import electrosphere.renderer.ui.imgui.ImGuiWindow;
|
||||||
import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback;
|
import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback;
|
||||||
import imgui.ImGui;
|
import imgui.ImGui;
|
||||||
@ -32,52 +30,14 @@ public class ImGuiChunkMonitor {
|
|||||||
protected static void createChunkMonitorWindow(){
|
protected static void createChunkMonitorWindow(){
|
||||||
chunkMonitorWindow = new ImGuiWindow("Chunk Monitor");
|
chunkMonitorWindow = new ImGuiWindow("Chunk Monitor");
|
||||||
|
|
||||||
//client network pressure graph
|
|
||||||
ImGuiLinePlot clientNetworkBandwith = new ImGuiLinePlot("Client Network Pressure",400,400);
|
|
||||||
ImGuiLinePlotDataset clientPressureDataset = new ImGuiLinePlotDataset("Client bytes per frame", PRESSURE_GRAPH_POINT_COUNT);
|
|
||||||
clientPressureDataset.zeroOut();
|
|
||||||
clientNetworkBandwith.addDataset(clientPressureDataset);
|
|
||||||
|
|
||||||
//server network pressure graph
|
|
||||||
ImGuiLinePlot serverNetworkPressureGraph = new ImGuiLinePlot("Server Network Pressure",400,400);
|
|
||||||
ImGuiLinePlotDataset serverPressureDataset = new ImGuiLinePlotDataset("Server bytes per frame", PRESSURE_GRAPH_POINT_COUNT);
|
|
||||||
serverPressureDataset.zeroOut();
|
|
||||||
serverNetworkPressureGraph.addDataset(serverPressureDataset);
|
|
||||||
|
|
||||||
chunkMonitorWindow.setCallback(new ImGuiWindowCallback() {
|
chunkMonitorWindow.setCallback(new ImGuiWindowCallback() {
|
||||||
long clientPressureLastValue = 0;
|
|
||||||
long serverPressureLastValue = 0;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exec() {
|
public void exec() {
|
||||||
|
|
||||||
|
|
||||||
//ui framework text
|
//ui framework text
|
||||||
ImGui.text("Chunk Monitor");
|
ImGui.text("Chunk Monitor");
|
||||||
|
|
||||||
Globals.clientDrawCellManager.updateStatus();
|
Globals.clientDrawCellManager.updateStatus();
|
||||||
ImGui.text("Full res chunks: " + Globals.clientDrawCellManager.getMaxResCount());
|
ImGui.text("Full res chunks: " + Globals.clientDrawCellManager.getMaxResCount());
|
||||||
// ImGui.text("Garbage queue: " + Globals.clientDrawCellManager.getGarbageSize());
|
|
||||||
|
|
||||||
|
|
||||||
//client network pressure
|
|
||||||
if(Globals.clientConnection != null){
|
|
||||||
long clientPressureNewTotal = Globals.clientConnection.getNumBytesRead();
|
|
||||||
long clientPressureDelta = clientPressureNewTotal - clientPressureLastValue;
|
|
||||||
clientPressureDataset.addPoint(clientPressureDelta);
|
|
||||||
clientPressureLastValue = clientPressureNewTotal;
|
|
||||||
}
|
|
||||||
clientNetworkBandwith.draw();
|
|
||||||
|
|
||||||
//server network pressure
|
|
||||||
if(Globals.server != null && Globals.server.getFirstConnection() != null){
|
|
||||||
long serverPressureNewTotal = Globals.server.getFirstConnection().getNumBytesRead();
|
|
||||||
long serverPressureDelta = serverPressureNewTotal - serverPressureLastValue;
|
|
||||||
serverPressureDataset.addPoint(serverPressureDelta);
|
|
||||||
serverPressureLastValue = serverPressureNewTotal;
|
|
||||||
}
|
|
||||||
serverNetworkPressureGraph.draw();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
chunkMonitorWindow.setOpen(false);
|
chunkMonitorWindow.setOpen(false);
|
||||||
|
|||||||
@ -0,0 +1,78 @@
|
|||||||
|
package electrosphere.client.ui.menu.debug;
|
||||||
|
|
||||||
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.renderer.ui.imgui.ImGuiLinePlot;
|
||||||
|
import electrosphere.renderer.ui.imgui.ImGuiLinePlot.ImGuiLinePlotDataset;
|
||||||
|
import electrosphere.renderer.ui.imgui.ImGuiWindow;
|
||||||
|
import electrosphere.renderer.ui.imgui.ImGuiWindow.ImGuiWindowCallback;
|
||||||
|
|
||||||
|
public class ImGuiNetworkMonitor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Num datapoints
|
||||||
|
*/
|
||||||
|
public static final int PRESSURE_GRAPH_POINT_COUNT = 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Window for viewing chunk status on server and client
|
||||||
|
*/
|
||||||
|
protected static ImGuiWindow netMonitorWindow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the windows in this file
|
||||||
|
*/
|
||||||
|
protected static void createNetworkMonitorWindows(){
|
||||||
|
createNetworkMonitorWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client scene entity view
|
||||||
|
*/
|
||||||
|
protected static void createNetworkMonitorWindow(){
|
||||||
|
netMonitorWindow = new ImGuiWindow("Network Monitor");
|
||||||
|
|
||||||
|
//client network pressure graph
|
||||||
|
ImGuiLinePlot clientNetworkBandwith = new ImGuiLinePlot("Client Network Pressure",400,400);
|
||||||
|
ImGuiLinePlotDataset clientPressureDataset = new ImGuiLinePlotDataset("Client bytes per frame", PRESSURE_GRAPH_POINT_COUNT);
|
||||||
|
clientPressureDataset.zeroOut();
|
||||||
|
clientNetworkBandwith.addDataset(clientPressureDataset);
|
||||||
|
|
||||||
|
//server network pressure graph
|
||||||
|
ImGuiLinePlot serverNetworkPressureGraph = new ImGuiLinePlot("Server Network Pressure",400,400);
|
||||||
|
ImGuiLinePlotDataset serverPressureDataset = new ImGuiLinePlotDataset("Server bytes per frame", PRESSURE_GRAPH_POINT_COUNT);
|
||||||
|
serverPressureDataset.zeroOut();
|
||||||
|
serverNetworkPressureGraph.addDataset(serverPressureDataset);
|
||||||
|
|
||||||
|
netMonitorWindow.setCallback(new ImGuiWindowCallback() {
|
||||||
|
long clientPressureLastValue = 0;
|
||||||
|
long serverPressureLastValue = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exec() {
|
||||||
|
|
||||||
|
|
||||||
|
//client network pressure
|
||||||
|
if(Globals.clientConnection != null){
|
||||||
|
long clientPressureNewTotal = Globals.clientConnection.getNumBytesRead();
|
||||||
|
long clientPressureDelta = clientPressureNewTotal - clientPressureLastValue;
|
||||||
|
clientPressureDataset.addPoint(clientPressureDelta);
|
||||||
|
clientPressureLastValue = clientPressureNewTotal;
|
||||||
|
}
|
||||||
|
clientNetworkBandwith.draw();
|
||||||
|
|
||||||
|
//server network pressure
|
||||||
|
if(Globals.server != null && Globals.server.getFirstConnection() != null){
|
||||||
|
long serverPressureNewTotal = Globals.server.getFirstConnection().getNumBytesRead();
|
||||||
|
long serverPressureDelta = serverPressureNewTotal - serverPressureLastValue;
|
||||||
|
serverPressureDataset.addPoint(serverPressureDelta);
|
||||||
|
serverPressureLastValue = serverPressureNewTotal;
|
||||||
|
}
|
||||||
|
serverNetworkPressureGraph.draw();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
netMonitorWindow.setOpen(false);
|
||||||
|
Globals.renderingEngine.getImGuiPipeline().addImGuiWindow(netMonitorWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -52,6 +52,7 @@ public class ImGuiWindowMacros {
|
|||||||
ImGuiRenderer.createRendererWindows();
|
ImGuiRenderer.createRendererWindows();
|
||||||
ImGuiTestGen.createTestGenWindows();
|
ImGuiTestGen.createTestGenWindows();
|
||||||
ImGuiChunkMonitor.createChunkMonitorWindows();
|
ImGuiChunkMonitor.createChunkMonitorWindows();
|
||||||
|
ImGuiNetworkMonitor.createNetworkMonitorWindows();
|
||||||
ImGuiGriddedManager.createGriddedManagerWindows();
|
ImGuiGriddedManager.createGriddedManagerWindows();
|
||||||
ImGuiMemory.createMemoryWindows();
|
ImGuiMemory.createMemoryWindows();
|
||||||
}
|
}
|
||||||
@ -199,6 +200,9 @@ public class ImGuiWindowMacros {
|
|||||||
if(ImGui.button("Memory Usage")){
|
if(ImGui.button("Memory Usage")){
|
||||||
ImGuiMemory.memoryWindow.setOpen(!ImGuiMemory.memoryWindow.isOpen());
|
ImGuiMemory.memoryWindow.setOpen(!ImGuiMemory.memoryWindow.isOpen());
|
||||||
}
|
}
|
||||||
|
if(ImGui.button("Network Monitor")){
|
||||||
|
ImGuiNetworkMonitor.netMonitorWindow.setOpen(true);
|
||||||
|
}
|
||||||
//close button
|
//close button
|
||||||
if(ImGui.button("Close")){
|
if(ImGui.button("Close")){
|
||||||
mainDebugWindow.setOpen(false);
|
mainDebugWindow.setOpen(false);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user