Add server side debug pie.

master
mckuhei 2 years ago
parent 69d65bf991
commit b378ab2ca4

@ -273,9 +273,6 @@ public abstract class Minecraft implements Runnable, IPlayerUsage
int fpsCounter = 0; int fpsCounter = 0;
long prevFrameTime = -1L; long prevFrameTime = -1L;
/** Profiler currently displayed in the debug screen pie chart */
private String debugProfilerName = "root";
public Minecraft(Canvas par1Canvas, MinecraftApplet par2MinecraftApplet, int par3, int par4, boolean par5) public Minecraft(Canvas par1Canvas, MinecraftApplet par2MinecraftApplet, int par3, int par4, boolean par5)
{ {
StatList.func_75919_a(); StatList.func_75919_a();
@ -877,7 +874,13 @@ public abstract class Minecraft implements Runnable, IPlayerUsage
} }
this.mcProfiler.profilingEnabled = true; this.mcProfiler.profilingEnabled = true;
this.displayDebugInfo(var7); this.displayDebugInfo(var7, this.mcProfiler, 0);
if(isIntegratedServerRunning()) {
Profiler pf = getIntegratedServer().theProfiler;
if(pf.profilingEnabled) {
this.displayDebugInfo(var7, pf, 1);
}
}
} }
else else
{ {
@ -928,7 +931,7 @@ public abstract class Minecraft implements Runnable, IPlayerUsage
{ {
field_71470_ab = this.fpsCounter; field_71470_ab = this.fpsCounter;
this.debug = field_71470_ab + " fps, " + WorldRenderer.chunksUpdated + " chunk updates"; this.debug = field_71470_ab + " fps, " + WorldRenderer.chunksUpdated + " chunk updates";
this.extraDebug = String.format("BC: %d", BigInteger.getAndClearCreateCounter()); this.extraDebug = String.format("BC: %d, BR: %d", BigInteger.getAndClearCreateCounter(), BigInteger.getAndClearFreeCounter());
WorldRenderer.chunksUpdated = 0; WorldRenderer.chunksUpdated = 0;
this.debugUpdateTime += 1000L; this.debugUpdateTime += 1000L;
this.fpsCounter = 0; this.fpsCounter = 0;
@ -1010,7 +1013,15 @@ public abstract class Minecraft implements Runnable, IPlayerUsage
*/ */
private void updateDebugProfilerName(int par1) private void updateDebugProfilerName(int par1)
{ {
List var2 = this.mcProfiler.getProfilingData(this.debugProfilerName); Profiler currentProfiler = mcProfiler;
if(isIntegratedServerRunning()) {
Profiler pf = getIntegratedServer().theProfiler;
if(pf.profilingEnabled) {
currentProfiler = pf;
}
}
String debugProfilerName = currentProfiler.debugProfilerName;
List var2 = currentProfiler.getProfilingData(debugProfilerName);
if (var2 != null && !var2.isEmpty()) if (var2 != null && !var2.isEmpty())
{ {
@ -1020,11 +1031,11 @@ public abstract class Minecraft implements Runnable, IPlayerUsage
{ {
if (var3.field_76331_c.length() > 0) if (var3.field_76331_c.length() > 0)
{ {
int var4 = this.debugProfilerName.lastIndexOf("."); int var4 = debugProfilerName.lastIndexOf(".");
if (var4 >= 0) if (var4 >= 0)
{ {
this.debugProfilerName = this.debugProfilerName.substring(0, var4); debugProfilerName = debugProfilerName.substring(0, var4);
} }
} }
} }
@ -1034,22 +1045,23 @@ public abstract class Minecraft implements Runnable, IPlayerUsage
if (par1 < var2.size() && !((ProfilerResult)var2.get(par1)).field_76331_c.equals("unspecified")) if (par1 < var2.size() && !((ProfilerResult)var2.get(par1)).field_76331_c.equals("unspecified"))
{ {
if (this.debugProfilerName.length() > 0) if (debugProfilerName.length() > 0)
{ {
this.debugProfilerName = this.debugProfilerName + "."; debugProfilerName = debugProfilerName + ".";
} }
this.debugProfilerName = this.debugProfilerName + ((ProfilerResult)var2.get(par1)).field_76331_c; debugProfilerName = debugProfilerName + ((ProfilerResult)var2.get(par1)).field_76331_c;
} }
} }
} }
currentProfiler.debugProfilerName = debugProfilerName;
} }
private void displayDebugInfo(long par1) private void displayDebugInfo(long par1, Profiler pf, int offset)
{ {
if (this.mcProfiler.profilingEnabled) if (pf.profilingEnabled)
{ {
List var3 = this.mcProfiler.getProfilingData(this.debugProfilerName); List var3 = pf.getProfilingData(pf.debugProfilerName);
ProfilerResult var4 = (ProfilerResult)var3.remove(0); ProfilerResult var4 = (ProfilerResult)var3.remove(0);
GL11.glClear(256); GL11.glClear(256);
GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glMatrixMode(GL11.GL_PROJECTION);
@ -1062,9 +1074,10 @@ public abstract class Minecraft implements Runnable, IPlayerUsage
GL11.glLineWidth(1.0F); GL11.glLineWidth(1.0F);
GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_TEXTURE_2D);
Tessellator var5 = Tessellator.instance; Tessellator var5 = Tessellator.instance;
short var6 = 160; int var6 = 160;
int var7 = this.displayWidth - var6 - 10; int var7 = this.displayWidth - var6 - 10;
int var8 = this.displayHeight - var6 * 2; int var8 = this.displayHeight - var6 * 2;
GL11.glTranslated(-offset * var6 * 2 * 1.1 + 10, 0, 0);
GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_BLEND);
var5.startDrawingQuads(); var5.startDrawingQuads();
var5.setColorRGBA_I(0, 200); var5.setColorRGBA_I(0, 200);

@ -409,8 +409,8 @@ public class GuiIngame extends Gui
String var45 = "Used memory: " + var43 * 100L / var39 + "% (" + var43 / 1024L / 1024L + "MB) of " + var39 / 1024L / 1024L + "MB"; String var45 = "Used memory: " + var43 * 100L / var39 + "% (" + var43 / 1024L / 1024L + "MB) of " + var39 / 1024L / 1024L + "MB";
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 2, 14737632); this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 2, 14737632);
var45 = "Allocated memory: " + var36 * 100L / var39 + "% (" + var36 / 1024L / 1024L + "MB)"; var45 = "Allocated memory: " + var36 * 100L / var39 + "% (" + var36 / 1024L / 1024L + "MB)";
var8.drawStringWithShadow(this.mc.extraDebug, 2, 52, 16777215);
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 12, 14737632); this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, 12, 14737632);
var8.drawStringWithShadow(this.mc.extraDebug, 2, 52, 16777215);
GL11.glTranslated(0, var8.FONT_HEIGHT, 0); GL11.glTranslated(0, var8.FONT_HEIGHT, 0);
this.drawString(var8, String.format("x: %s", mc.thePlayer.posXBig.setScale(5, RoundingMode.HALF_DOWN).toPlainString()), 2, 64, 14737632); this.drawString(var8, String.format("x: %s", mc.thePlayer.posXBig.setScale(5, RoundingMode.HALF_DOWN).toPlainString()), 2, 64, 14737632);
this.drawString(var8, String.format("y: %.3f (feet pos, %.3f eyes pos)", new Object[] {Double.valueOf(this.mc.thePlayer.boundingBox.minY), Double.valueOf(this.mc.thePlayer.posY)}), 2, 72, 14737632); this.drawString(var8, String.format("y: %.3f (feet pos, %.3f eyes pos)", new Object[] {Double.valueOf(this.mc.thePlayer.boundingBox.minY), Double.valueOf(this.mc.thePlayer.posY)}), 2, 72, 14737632);

@ -23,6 +23,8 @@ public class Profiler
/** Profiling map */ /** Profiling map */
private final Map profilingMap = new HashMap(); private final Map profilingMap = new HashMap();
public String debugProfilerName = "root";
/** /**
* Clear profiling * Clear profiling

Loading…
Cancel
Save