[ 
https://issues.apache.org/jira/browse/GEODE-8520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17200470#comment-17200470
 ] 

ASF GitHub Bot commented on GEODE-8520:
---------------------------------------

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:
us...@infra.apache.org


> GarbageCollectionCount metric is showing negative values
> --------------------------------------------------------
>
>                 Key: GEODE-8520
>                 URL: https://issues.apache.org/jira/browse/GEODE-8520
>             Project: Geode
>          Issue Type: Bug
>          Components: management
>    Affects Versions: 1.13.0
>            Reporter: Jinmei Liao
>            Priority: Major
>              Labels: GeodeOperationAPI, pull-request-available
>
> sometimes the memberMBean's garbageCollectionCount and garbageCollectionTime 
> metriics are showing negative values.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to