private void updateMemoryPoolMetrics ( ) { for ( MemoryPoolMXBean memoryPoolMXBean : memoryPoolMXBeanList ) { String normalizedKeyName = memoryPoolMXBean . getName ( ) . replaceAll ( "[^\\w]" , "-" ) ; MemoryUsage peakUsage = memoryPoolMXBean . getPeakUsage ( ) ; if ( peakUsage != null ) { jvmPeakUsagePerMemoryPool . safeScope ( normalizedKeyName + "-used" ) . setValue ( ByteAmount . fromBytes ( peakUsage . getUsed ( ) ) . asMegabytes ( ) ) ; jvmPeakUsagePerMemoryPool . safeScope ( normalizedKeyName + "-committed" ) . setValue ( ByteAmount . fromBytes ( peakUsage . getCommitted ( ) ) . asMegabytes ( ) ) ; jvmPeakUsagePerMemoryPool . safeScope ( normalizedKeyName + "-max" ) . setValue ( ByteAmount . fromBytes ( peakUsage . getMax ( ) ) . asMegabytes ( ) ) ; } MemoryUsage collectionUsage = memoryPoolMXBean . getCollectionUsage ( ) ; if ( collectionUsage != null ) { jvmCollectionUsagePerMemoryPool . safeScope ( normalizedKeyName + "-used" ) . setValue ( ByteAmount . fromBytes ( collectionUsage . getUsed ( ) ) . asMegabytes ( ) ) ; jvmCollectionUsagePerMemoryPool . safeScope ( normalizedKeyName + "-committed" ) . setValue ( ByteAmount . fromBytes ( collectionUsage . getCommitted ( ) ) . asMegabytes ( ) ) ; jvmCollectionUsagePerMemoryPool . safeScope ( normalizedKeyName + "-max" ) . setValue ( ByteAmount . fromBytes ( collectionUsage . getMax ( ) ) . asMegabytes ( ) ) ; } MemoryUsage estimatedUsage = memoryPoolMXBean . getUsage ( ) ; if ( estimatedUsage != null ) { jvmEstimatedUsagePerMemoryPool . safeScope ( normalizedKeyName + "-used" ) . setValue ( ByteAmount . fromBytes ( estimatedUsage . getUsed ( ) ) . asMegabytes ( ) ) ; jvmEstimatedUsagePerMemoryPool . safeScope ( normalizedKeyName + "-committed" ) . setValue ( ByteAmount . fromBytes ( estimatedUsage . getCommitted ( ) ) . asMegabytes ( ) ) ; jvmEstimatedUsagePerMemoryPool . safeScope ( normalizedKeyName + "-max" ) . setValue ( ByteAmount . fromBytes ( estimatedUsage . getMax ( ) ) . asMegabytes ( ) ) ; } } }
Par Eden Space Par Survivor Space CMS Old Gen CMS Perm Gen