Improved jump logs and file access profiling

This commit is contained in:
Unknown 2018-05-13 17:59:53 +02:00
parent 28d27ea663
commit 9d41d39a6c
3 changed files with 45 additions and 25 deletions

View file

@ -198,8 +198,13 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy implements ISta
if (logTicks <= 0) {
logTicks = LOG_INTERVAL_TICKS;
if (WarpDriveConfig.LOGGING_JUMP) {
WarpDrive.logger.info(this + " controller is " + tileEntityShipController + ", warmupTime " + warmupTime_ticks + ", stateCurrent " + stateCurrent + ", jumpFlag "
+ (tileEntityShipController == null ? "NA" : tileEntityShipController.isEnabled) + ", cooldownTime " + cooldownTime_ticks);
WarpDrive.logger.info(String.format("%s %s, jumpFlag %s from %s, warmup %d, cooldown %d",
this,
stateCurrent,
tileEntityShipController == null ? "NA" : tileEntityShipController.isEnabled,
tileEntityShipController,
warmupTime_ticks,
cooldownTime_ticks));
}
}

View file

@ -419,6 +419,7 @@ public class StarMapRegistry {
}
// do not call during tileEntity construction (readFromNBT and validate)
private static boolean isExceptionReported = false;
private void cleanup() {
LocalProfiler.start("Starmap registry cleanup");
@ -439,6 +440,12 @@ public class StarMapRegistry {
try {
isLoaded = chunkProviderServer.loadedChunkHashMap.containsItem(ChunkCoordIntPair.chunkXZ2Int(registryItem.x >> 4, registryItem.z >> 4));
} catch (final NoSuchFieldError exception) {
if (!isExceptionReported) {
WarpDrive.logger.info(String.format("Unable to check non-loaded chunks for star map entry %s",
registryItem));
exception.printStackTrace();
isExceptionReported = true;
}
isLoaded = chunkProviderServer.chunkExists(registryItem.x >> 4, registryItem.z >> 4);
}
} else {
@ -446,6 +453,8 @@ public class StarMapRegistry {
}
// skip unloaded chunks
if (!isLoaded) {
WarpDrive.logger.info(String.format("Skipping non-loaded star map entry %s",
registryItem));
continue;
}
@ -455,38 +464,41 @@ public class StarMapRegistry {
final TileEntity tileEntity = world.getTileEntity(registryItem.x, registryItem.y, registryItem.z);
isValid = true;
switch (registryItem.type) {
case UNDEFINED:
break;
case SHIP:
isValid = block == WarpDrive.blockShipCore && tileEntity != null && !tileEntity.isInvalid();
break;
case JUMPGATE:
break;
case PLANET:
break;
case STAR:
break;
case STRUCTURE:
break;
case WARP_ECHO:
break;
case ACCELERATOR:
isValid = block == WarpDrive.blockAcceleratorController && tileEntity != null && !tileEntity.isInvalid();
break;
default:
break;
case UNDEFINED:
break;
case SHIP:
isValid = block == WarpDrive.blockShipCore && tileEntity != null && !tileEntity.isInvalid();
break;
case JUMPGATE:
break;
case PLANET:
break;
case STAR:
break;
case STRUCTURE:
break;
case WARP_ECHO:
break;
case ACCELERATOR:
isValid = block == WarpDrive.blockAcceleratorController && tileEntity != null && !tileEntity.isInvalid();
break;
case TRANSPORTER:
isValid = block == WarpDrive.blockTransporterCore && tileEntity != null && !tileEntity.isInvalid();
break;
default:
break;
}
}
if (!isValid) {
if (WarpDriveConfig.LOGGING_STARMAP) {
// if (WarpDriveConfig.LOGGING_STARMAP) {
if (registryItem == null) {
WarpDrive.logger.info("Cleaning up starmap object ~null~");
} else {
WarpDrive.logger.info("Cleaning up starmap object " + registryItem.type + " at "
+ registryItem.dimensionId + " " + registryItem.x + " " + registryItem.y + " " + registryItem.z);
}
}
// }
countRemove++;
entryDimension.getValue().remove(registryItem);
}

View file

@ -448,7 +448,7 @@ public class JumpSequencer extends AbstractSequencer {
}
protected void state_borders() {
LocalProfiler.start("Jump.borders");
LocalProfiler.start("Jump.borders1");
if (WarpDriveConfig.LOGGING_JUMP) {
WarpDrive.logger.info(this + " Checking ship borders...");
@ -463,6 +463,9 @@ public class JumpSequencer extends AbstractSequencer {
LocalProfiler.stop();
return;
}
LocalProfiler.stop();
LocalProfiler.start("Jump.borders2");
final File file = new File(WarpDriveConfig.G_SCHEMALOCATION + "/auto");
if (!file.exists() || !file.isDirectory()) {