Add BigInteger statistics.

master
mckuhei 2 years ago
parent 0cab667816
commit 682bbee3a3

@ -262,7 +262,7 @@ public abstract class Minecraft implements Runnable, IPlayerUsage
public volatile boolean running = true; public volatile boolean running = true;
/** String that shows the debug information */ /** String that shows the debug information */
public String debug = ""; public String debug = "", extraDebug = "";
/** Approximate time (in ms) of last update to debug string */ /** Approximate time (in ms) of last update to debug string */
long debugUpdateTime = getSystemTime(); long debugUpdateTime = getSystemTime();
@ -926,6 +926,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());
WorldRenderer.chunksUpdated = 0; WorldRenderer.chunksUpdated = 0;
this.debugUpdateTime += 1000L; this.debugUpdateTime += 1000L;
this.fpsCounter = 0; this.fpsCounter = 0;

@ -402,7 +402,9 @@ 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);
GL11.glTranslated(0, var8.FONT_HEIGHT, 0);
this.drawString(var8, String.format("x: %.5f", new Object[] {Double.valueOf(this.mc.thePlayer.posX)}), 2, 64, 14737632); this.drawString(var8, String.format("x: %.5f", new Object[] {Double.valueOf(this.mc.thePlayer.posX)}), 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);
this.drawString(var8, String.format("z: %.5f", new Object[] {Double.valueOf(this.mc.thePlayer.posZ)}), 2, 80, 14737632); this.drawString(var8, String.format("z: %.5f", new Object[] {Double.valueOf(this.mc.thePlayer.posZ)}), 2, 80, 14737632);

@ -38,6 +38,7 @@ import java.io.ObjectStreamException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Random; import java.util.Random;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicLong;
import org.mcmodule.util.IntArrayAllcator; import org.mcmodule.util.IntArrayAllcator;
import org.mcmodule.util.ObjectAllocator; import org.mcmodule.util.ObjectAllocator;
@ -218,6 +219,21 @@ public class BigInteger extends Number implements Comparable<BigInteger>, Recycl
private float cachedFloat; private float cachedFloat;
private double cachedDouble; private double cachedDouble;
private static final AtomicLong createCounter = new AtomicLong(),
freeCounter = new AtomicLong();
public static long getAndClearCreateCounter() {
return createCounter.getAndSet(0);
}
public static long getAndClearFreeCounter() {
return freeCounter.getAndSet(0);
}
// Stupid lags.
// protected void finalize() {
// freeCounter.incrementAndGet();
// }
/** /**
* This mask is used to obtain the value of an int as if it were unsigned. * This mask is used to obtain the value of an int as if it were unsigned.
*/ */
@ -331,6 +347,10 @@ public class BigInteger extends Number implements Comparable<BigInteger>, Recycl
private BigInteger(ObjectAllocator<BigInteger> allocator) { private BigInteger(ObjectAllocator<BigInteger> allocator) {
this.currentAllocator = allocator; this.currentAllocator = allocator;
} }
{
createCounter.incrementAndGet();
}
/** /**
* Translates a byte array containing the two's-complement binary * Translates a byte array containing the two's-complement binary

Loading…
Cancel
Save