Proper total geodata file size information.

This commit is contained in:
MobiusDevelopment
2019-04-05 06:00:11 +00:00
parent 67cc5e1e45
commit c1d471dca8
25 changed files with 195 additions and 201 deletions

View File

@ -312,13 +312,7 @@ public class GameServer
ClanShopData.getInstance();
printSection("Geodata");
long geodataMemory = getUsedMemoryMB();
GeoEngine.getInstance();
geodataMemory = getUsedMemoryMB() - geodataMemory;
if (geodataMemory < 0)
{
geodataMemory = 0;
}
printSection("NPCs");
NpcData.getInstance();
@ -456,7 +450,6 @@ public class GameServer
System.gc();
final long totalMem = Runtime.getRuntime().maxMemory() / 1048576;
LOGGER.info(getClass().getSimpleName() + ": Started, using " + getUsedMemoryMB() + " of " + totalMem + " MB total memory.");
LOGGER.info(getClass().getSimpleName() + ": Geodata use " + geodataMemory + " MB of memory.");
LOGGER.info(getClass().getSimpleName() + ": Maximum number of connected players is " + Config.MAXIMUM_ONLINE_USERS + ".");
LOGGER.info(getClass().getSimpleName() + ": Server loaded in " + ((System.currentTimeMillis() - serverLoadStart) / 1000) + " seconds.");

View File

@ -53,15 +53,6 @@ public class GeoEngine
private final ABlock[][] _blocks;
private final BlockNull _nullBlock;
/**
* Returns the instance of the {@link GeoEngine}.
* @return {@link GeoEngine} : The instance.
*/
public static GeoEngine getInstance()
{
return SingletonHolder._instance;
}
/**
* GeoEngine constructor. Loads all geodata files of chosen geodata format.
*/
@ -80,6 +71,7 @@ public class GeoEngine
// load geo files according to geoengine config setup
int loaded = 0;
long _fileSize = 0;
for (int rx = World.TILE_X_MIN; rx <= World.TILE_X_MAX; rx++)
{
for (int ry = World.TILE_Y_MIN; ry <= World.TILE_Y_MAX; ry++)
@ -91,6 +83,7 @@ public class GeoEngine
if (loadGeoBlocks(rx, ry))
{
loaded++;
_fileSize += f.length();
}
}
else
@ -102,6 +95,10 @@ public class GeoEngine
}
LOGGER.info("GeoEngine: Loaded " + loaded + " geodata files.");
if (loaded > 0)
{
LOGGER.info("GeoEngine: Total geodata file size " + (_fileSize / 1024 / 1024) + " MB.");
}
// avoid wrong configs when no files are loaded
if (loaded == 0)
@ -940,6 +937,15 @@ public class GeoEngine
return null;
}
/**
* Returns the instance of the {@link GeoEngine}.
* @return {@link GeoEngine} : The instance.
*/
public static GeoEngine getInstance()
{
return SingletonHolder._instance;
}
private static class SingletonHolder
{
protected static final GeoEngine _instance = Config.PATHFINDING ? new GeoEnginePathfinding() : new GeoEngine();