diff options
author | Richard Hendricks <richardhendricks@pobox.com> | 2018-05-30 01:09:15 -0500 |
---|---|---|
committer | Richard Hendricks <richardhendricks@pobox.com> | 2018-05-30 01:09:15 -0500 |
commit | 032a77dac00ca4ec98a7af3f16d7f99191727d60 (patch) | |
tree | 56f3ebbd781cdfd5e1b440dc52eb6c26a02302ef /src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java | |
parent | 10f8628173a2888a12d3964db5dd4a22ac3c04da (diff) | |
download | GT5-Unofficial-032a77dac00ca4ec98a7af3f16d7f99191727d60.tar.gz GT5-Unofficial-032a77dac00ca4ec98a7af3f16d7f99191727d60.tar.bz2 GT5-Unofficial-032a77dac00ca4ec98a7af3f16d7f99191727d60.zip |
Branch to add in better debug output from GT cpu load. ns instead of ms.
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java')
-rw-r--r-- | src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java index a761afd5cb..0d06c4ec03 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java @@ -183,7 +183,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE mMetaTileEntity.setBaseMetaTileEntity(this);
}
- long tTime = System.currentTimeMillis();
+ long tTime = System.nanoTime();
int tCode = 0;
try { for (tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
@@ -298,11 +298,11 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE }
if (isServerSide() && hasValidMetaTileEntity()) {
- tTime = System.currentTimeMillis() - tTime;
+ tTime = System.nanoTime() - tTime;
if (mTimeStatistics.length > 0)
mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) % mTimeStatistics.length] = (int) tTime;
- if (tTime > 0 && tTime > GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING && mTickTimer > 1000 && getMetaTileEntity().doTickProfilingMessageDuringThisTick() && mLagWarningCount++ < 10)
- FMLLog.warning("WARNING: Possible Lag Source at [%s,%s,%s] in Dimension %s with %s ms caused by an instance of %s", xCoord, yCoord, zCoord, worldObj.provider.dimensionId, tTime, getMetaTileEntity().getClass());
+ if (tTime > 0 && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING*1000000) && mTickTimer > 1000 && getMetaTileEntity().doTickProfilingMessageDuringThisTick() && mLagWarningCount++ < 10)
+ FMLLog.warning("WARNING: Possible Lag Source at [%s,%s,%s] in Dimension %s with %s ns caused by an instance of %s", xCoord, yCoord, zCoord, worldObj.provider.dimensionId, tTime, getMetaTileEntity().getClass());
}
mWorkUpdate = mInventoryChanged = false;
@@ -395,8 +395,14 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE if (aLogLevel > 1) {
if (mTimeStatistics.length > 0) {
double tAverageTime = 0;
- for (int tTime : mTimeStatistics) tAverageTime += tTime;
- tList.add("Average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ms since " + mTimeStatistics.length + " ticks.");
+ double tWorstTime = 0;
+ for (int tTime : mTimeStatistics) {
+ tAverageTime += tTime;
+ if (tTime > tWorstTime) {
+ tWorstTime = tTime;
+ }
+ }
+ tList.add("Average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ns since " + mTimeStatistics.length + " ticks with worst time of " + tWorstTime + "ns.");
}
if (mLagWarningCount > 0) {
tList.add("Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server.");
|