File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/source Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -181,16 +181,21 @@ private void getGcUsage(MetricsRecordBuilder rb) {
181
181
long count = 0 ;
182
182
long timeMillis = 0 ;
183
183
for (GarbageCollectorMXBean gcBean : gcBeans ) {
184
- if ( gcBean .getName () != null ) {
185
- String name = gcBean . getName ();
184
+ String gcBeanName = gcBean .getName ();
185
+ if ( gcBeanName == null || gcBeanName . startsWith ( "ZGC" ) && gcBeanName . endsWith ( "Cycles" )) {
186
186
// JDK-8265136 Skip concurrent phase
187
- if (name .startsWith ("ZGC" ) && name .endsWith ("Cycles" )) {
188
- continue ;
189
- }
187
+ continue ;
190
188
}
191
189
long c = gcBean .getCollectionCount ();
192
190
long t = gcBean .getCollectionTime ();
193
- MetricsInfo [] gcInfo = getGcInfo (gcBean .getName ());
191
+ if (gcBeanName .startsWith ("ZGC" )) {
192
+ if (gcBeanName .contains ("Minor" )) {
193
+ rb .addCounter (MinorGcCount , c ).addCounter (MinorGcTimeMillis , t );
194
+ } else {
195
+ rb .addCounter (MajorGcCount , c ).addCounter (MajorGcTimeMillis , t );
196
+ }
197
+ }
198
+ MetricsInfo [] gcInfo = getGcInfo (gcBeanName );
194
199
rb .addCounter (gcInfo [0 ], c ).addCounter (gcInfo [1 ], t );
195
200
count += c ;
196
201
timeMillis += t ;
Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ public enum JvmMetricsInfo implements MetricsInfo {
39
39
MemMaxM ("Max memory size in MB" ),
40
40
GcCount ("Total GC count" ),
41
41
GcTimeMillis ("Total GC time in milliseconds" ),
42
+ MinorGcCount ("Minor GC Count" ),
43
+ MajorGcCount ("Major GC Count" ),
44
+ MinorGcTimeMillis ("Minor GC time in milliseconds" ),
45
+ MajorGcTimeMillis ("Major GC time in milliseconds" ),
42
46
ThreadsNew ("Number of new threads" ),
43
47
ThreadsRunnable ("Number of runnable threads" ),
44
48
ThreadsBlocked ("Number of blocked threads" ),
You can’t perform that action at this time.
0 commit comments