minor RollingAverage refactor

This commit is contained in:
James Seibel
2025-11-22 08:16:11 -06:00
parent 25979d6a76
commit b74b6e8068
5 changed files with 5 additions and 5 deletions
@@ -111,7 +111,7 @@ public class PregenManager
}
long timeSincePreviousTaskFinish = System.currentTimeMillis() - this.lastTaskFinishTime.getAndSet(System.currentTimeMillis());
this.averageTaskCompletionIntervalMs.addValue(timeSincePreviousTaskFinish);
this.averageTaskCompletionIntervalMs.add(timeSincePreviousTaskFinish);
PregenState.this.fillPendingQueue();
})
@@ -69,7 +69,7 @@ public class RemoteWorldRetrievalQueue extends AbstractFullDataNetworkRequestQue
int chunkWidth = DhSectionPos.getChunkWidth(sectionPos);
int chunkCount = chunkWidth * chunkWidth;
double timePerChunk = (double)totalGenTimeInMs / (double)chunkCount;
this.rollingAverageChunkGenTimeInMs.addValue(timePerChunk);
this.rollingAverageChunkGenTimeInMs.add(timePerChunk);
switch (requestResult)
{
@@ -346,7 +346,7 @@ public class WorldGenerationQueue implements IFullDataSourceRetrievalQueue, IDeb
long totalGenTimeInMs = System.currentTimeMillis() - generationStartMsTime;
int chunkCount = generationRequestChunkWidthCount * generationRequestChunkWidthCount;
double timePerChunk = (double)totalGenTimeInMs / (double)chunkCount;
this.rollingAverageChunkGenTimeInMs.addValue(timePerChunk);
this.rollingAverageChunkGenTimeInMs.add(timePerChunk);
});
newTaskGroup.genFuture = generationFuture;
@@ -41,7 +41,7 @@ public class RollingAverage
// input //
//=======//
public void addValue(double value)
public void add(double value)
{
this.arrayLock.lock();
try
@@ -320,7 +320,7 @@ public class PriorityTaskPicker
finally
{
long timeElapsed = System.nanoTime() - startTime;
this.executor.runTimeInMsRollingAverage.addValue(TimeUnit.NANOSECONDS.toMillis(timeElapsed));
this.executor.runTimeInMsRollingAverage.add(TimeUnit.NANOSECONDS.toMillis(timeElapsed));
// Update variables related to task status
this.parentTaskPicker.occupiedThreadsRef.getAndDecrement();