Made TPS Count Task use Peak Player count for minute instead of AVG

This commit is contained in:
Rsl1122 2018-02-02 13:23:07 +02:00
parent 70130f9629
commit a6b96009a0

View File

@ -28,13 +28,13 @@ public class TPSInsertProcessor extends ObjectProcessor<List<TPS>> {
List<TPS> history = object; List<TPS> history = object;
final long lastDate = history.get(history.size() - 1).getDate(); final long lastDate = history.get(history.size() - 1).getDate();
final double averageTPS = MathUtils.round(MathUtils.averageDouble(history.stream().map(TPS::getTicksPerSecond))); final double averageTPS = MathUtils.round(MathUtils.averageDouble(history.stream().map(TPS::getTicksPerSecond)));
final int averagePlayersOnline = (int) MathUtils.averageInt(history.stream().map(TPS::getPlayers)); final int peakPlayersOnline = history.stream().mapToInt(TPS::getPlayers).max().orElse(0);
final double averageCPUUsage = MathUtils.round(MathUtils.averageDouble(history.stream().map(TPS::getCPUUsage))); final double averageCPUUsage = MathUtils.round(MathUtils.averageDouble(history.stream().map(TPS::getCPUUsage)));
final long averageUsedMemory = MathUtils.averageLong(history.stream().map(TPS::getUsedMemory)); final long averageUsedMemory = MathUtils.averageLong(history.stream().map(TPS::getUsedMemory));
final int averageEntityCount = (int) MathUtils.averageInt(history.stream().map(TPS::getEntityCount)); final int averageEntityCount = (int) MathUtils.averageInt(history.stream().map(TPS::getEntityCount));
final int averageChunksLoaded = (int) MathUtils.averageInt(history.stream().map(TPS::getChunksLoaded)); final int averageChunksLoaded = (int) MathUtils.averageInt(history.stream().map(TPS::getChunksLoaded));
TPS tps = new TPS(lastDate, averageTPS, averagePlayersOnline, averageCPUUsage, averageUsedMemory, averageEntityCount, averageChunksLoaded); TPS tps = new TPS(lastDate, averageTPS, peakPlayersOnline, averageCPUUsage, averageUsedMemory, averageEntityCount, averageChunksLoaded);
try { try {
Database.getActive().save().insertTPSforThisServer(tps); Database.getActive().save().insertTPSforThisServer(tps);
} catch (DBException e) { } catch (DBException e) {