mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-08-26 06:32:58 +02:00
[#773] TPS mutation methods:
- Average free disk space - Max free disk space - Min free disk space
This commit is contained in:
parent
25342920e8
commit
12272f3d25
|
@ -24,7 +24,6 @@ import com.djrapitops.plan.utilities.html.graphs.line.Point;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.OptionalDouble;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -192,57 +191,58 @@ public class TPSMutator {
|
||||||
}
|
}
|
||||||
|
|
||||||
public double averageTPS() {
|
public double averageTPS() {
|
||||||
OptionalDouble average = tpsData.stream()
|
return tpsData.stream()
|
||||||
.mapToDouble(TPS::getTicksPerSecond)
|
.mapToDouble(TPS::getTicksPerSecond)
|
||||||
.filter(num -> num >= 0)
|
.filter(num -> num >= 0)
|
||||||
.average();
|
.average().orElse(-1);
|
||||||
if (average.isPresent()) {
|
|
||||||
return average.getAsDouble();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double averageCPU() {
|
public double averageCPU() {
|
||||||
OptionalDouble average = tpsData.stream()
|
return tpsData.stream()
|
||||||
.mapToDouble(TPS::getCPUUsage)
|
.mapToDouble(TPS::getCPUUsage)
|
||||||
.filter(num -> num >= 0)
|
.filter(num -> num >= 0)
|
||||||
.average();
|
.average().orElse(-1);
|
||||||
if (average.isPresent()) {
|
|
||||||
return average.getAsDouble();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double averageRAM() {
|
public double averageRAM() {
|
||||||
OptionalDouble average = tpsData.stream()
|
return tpsData.stream()
|
||||||
.mapToDouble(TPS::getUsedMemory)
|
.mapToDouble(TPS::getUsedMemory)
|
||||||
.filter(num -> num >= 0)
|
.filter(num -> num >= 0)
|
||||||
.average();
|
.average().orElse(-1);
|
||||||
if (average.isPresent()) {
|
|
||||||
return average.getAsDouble();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double averageEntities() {
|
public double averageEntities() {
|
||||||
OptionalDouble average = tpsData.stream()
|
return tpsData.stream()
|
||||||
.mapToDouble(TPS::getEntityCount)
|
.mapToDouble(TPS::getEntityCount)
|
||||||
.filter(num -> num >= 0)
|
.filter(num -> num >= 0)
|
||||||
.average();
|
.average().orElse(-1);
|
||||||
if (average.isPresent()) {
|
|
||||||
return average.getAsDouble();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double averageChunks() {
|
public double averageChunks() {
|
||||||
OptionalDouble average = tpsData.stream()
|
return tpsData.stream()
|
||||||
.mapToDouble(TPS::getChunksLoaded)
|
.mapToDouble(TPS::getChunksLoaded)
|
||||||
.filter(num -> num >= 0)
|
.filter(num -> num >= 0)
|
||||||
.average();
|
.average().orElse(-1);
|
||||||
if (average.isPresent()) {
|
|
||||||
return average.getAsDouble();
|
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
|
public double averageFreeDisk() {
|
||||||
|
return tpsData.stream()
|
||||||
|
.mapToDouble(TPS::getFreeDiskSpace)
|
||||||
|
.filter(num -> num >= 0)
|
||||||
|
.average().orElse(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long maxFreeDisk() {
|
||||||
|
return tpsData.stream()
|
||||||
|
.mapToLong(TPS::getFreeDiskSpace)
|
||||||
|
.filter(num -> num >= 0)
|
||||||
|
.max().orElse(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long minFreeDisk() {
|
||||||
|
return tpsData.stream()
|
||||||
|
.mapToLong(TPS::getFreeDiskSpace)
|
||||||
|
.filter(num -> num >= 0)
|
||||||
|
.min().orElse(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user