dschneider-pivotal commented on a change in pull request #7358:
URL: https://github.com/apache/geode/pull/7358#discussion_r808337172



##########
File path: 
geode-for-redis/src/main/java/org/apache/geode/redis/internal/statistics/RedisStats.java
##########
@@ -222,28 +221,25 @@ private void stopRollingAverageUpdater() {
   }
 
   private void doRollingAverageUpdates() {
-    updateNetworkKilobytesReadLastSecond(rollingAverageTick);
-    updateOpsPerformedOverLastSecond(rollingAverageTick);
+    networkKiloBytesReadOverLastSecond = networkKiloBytesReadRollingAverageStat
+        .calculate(getTotalNetworkBytesRead(), rollingAverageTick) / 1024.0;
+    opsPerformedOverLastSecond =
+        opsPerformedRollingAverageStat.calculate(getCommandsProcessed(), 
rollingAverageTick);
     rollingAverageTick++;
-    if (rollingAverageTick >= rollingAverageSamplesPerSecond) {
+    if (rollingAverageTick >= ROLLING_AVERAGE_SAMPLES_PER_SECOND) {
       rollingAverageTick = 0;
     }
   }
 
-  private void updateNetworkKilobytesReadLastSecond(int tickNumber) {
-    final long totalNetworkBytesRead = getTotalNetworkBytesRead();
-    long deltaNetworkBytesRead = totalNetworkBytesRead - 
totalNetworkBytesReadLastTick;
-    networkBytesReadOverLastNSamples[tickNumber] = deltaNetworkBytesRead;
-    networkKiloBytesReadOverLastSecond =
-        Arrays.stream(networkBytesReadOverLastNSamples).sum() / 1024.0;
-    totalNetworkBytesReadLastTick = totalNetworkBytesRead;
-  }
+  private static class RollingUpgradeStat {

Review comment:
       should this be named "RollingAverageStat"?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to