@@ -22,6 +22,9 @@ public final class ChunkFullTask extends ChunkProgressionTask implements Runnabl
protected final ChunkAccess fromChunk;
protected final PrioritisedExecutor.PrioritisedTask convertToFullTask;
+ public static final io.papermc.paper.util.IntervalledCounter chunkLoads = new io.papermc.paper.util.IntervalledCounter(java.util.concurrent.TimeUnit.SECONDS.toNanos(15L));
+ public static final io.papermc.paper.util.IntervalledCounter chunkGenerates = new io.papermc.paper.util.IntervalledCounter(java.util.concurrent.TimeUnit.SECONDS.toNanos(15L));
+
public ChunkFullTask(final ChunkTaskScheduler scheduler, final ServerLevel world, final int chunkX, final int chunkZ,
final NewChunkHolder chunkHolder, final ChunkAccess fromChunk, final PrioritisedExecutor.Priority priority) {
super(scheduler, world, chunkX, chunkZ);
@@ -35,6 +38,20 @@ public final class ChunkFullTask extends ChunkProgressionTask implements Runnabl
return ChunkStatus.FULL;
}
+ public static double genRate(final long time) {
+ synchronized (chunkGenerates) {
+ chunkGenerates.updateCurrentTime(time);
+ return chunkGenerates.getRate();
+ }
+ }
+
+ public static double loadRate(final long time) {
+ synchronized (chunkLoads) {
+ chunkLoads.updateCurrentTime(time);
+ return chunkLoads.getRate();
+ }
+ }
+
@Override
public void run() {
// See Vanilla protoChunkToFullChunk for what this function should be doing
@@ -49,6 +66,17 @@ public final class ChunkFullTask extends ChunkProgressionTask implements Runnabl