You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/09/23 02:14:27 UTC

[GitHub] [geode] jinmeiliao commented on a change in pull request #5536: GEODE-8520: GCStatsMonitor should sum up all the GC stats to get the …

jinmeiliao commented on a change in pull request #5536:
URL: https://github.com/apache/geode/pull/5536#discussion_r493153715



##########
File path: geode-core/src/test/java/org/apache/geode/management/bean/stats/MemberLevelStatsTest.java
##########
@@ -339,6 +342,41 @@ public void testRegionCounters() {
     assertThat(memberMBeanBridge.getTotalPrimaryBucketCount()).isZero();
   }
 
+  @Test
+  public void testVMStats() {
+    Statistics[] realStats = statisticsManager.findStatisticsByType(VMStats50.getGCType());
+    long[] totals = modifyStatsAndReturnTotalCountAndTime(10, 2500, realStats);
+    memberMBeanBridge.addVMStats(statSampler.getVMStats());
+    assertThat(memberMBeanBridge.getGarbageCollectionCount()).isEqualTo(totals[0]);
+    assertThat(memberMBeanBridge.getGarbageCollectionTime()).isEqualTo(totals[1]);
+
+    long[] newTotals = modifyStatsAndReturnTotalCountAndTime(20, 3500, realStats);
+    sampleStats();
+    assertThat(memberMBeanBridge.getGarbageCollectionCount()).isEqualTo(newTotals[0]);
+    assertThat(memberMBeanBridge.getGarbageCollectionTime()).isEqualTo(newTotals[1]);
+  }
+
+  private long[] modifyStatsAndReturnTotalCountAndTime(
+      long baseCount, long baseTime,
+      Statistics[] modifiedStats) {
+    long[] totalCountAndTime = {0, 0};
+    for (Statistics gcStat : modifiedStats) {
+      StatisticDescriptor[] statistics = gcStat.getType().getStatistics();

Review comment:
       those two methods are removed from the GCMonitor. They were package protected anyway, no usage besides this tests. production code is using getStatistics method.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org