Skip to content

Commit

Permalink
[AMQ-8354] Fix TPS calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaShupletsov committed Aug 7, 2024
1 parent 0459be6 commit 8cd2a82
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

public class ReplicaStatistics {

private static final int TPS_UPDATE_PERIOD = 60;

private AtomicLong replicationTps;
private AtomicLong tpsCounter;
private AtomicLong lastTpsCounter;
Expand All @@ -47,12 +49,12 @@ public ReplicaStatistics() {
if (replicationTps == null) {
replicationTps = new AtomicLong();
}
replicationTps.set((c - lastTpsCounter.get()) / 10);
if (lastTpsCounter == null) {
lastTpsCounter = new AtomicLong();
}
replicationTps.set((c - lastTpsCounter.get()) / TPS_UPDATE_PERIOD);
lastTpsCounter.set(c);
}, 60, 60, TimeUnit.SECONDS);
}, TPS_UPDATE_PERIOD, TPS_UPDATE_PERIOD, TimeUnit.SECONDS);
}

public void reset() {
Expand Down

0 comments on commit 8cd2a82

Please sign in to comment.