From b903b25072a6e77ff66a3d669c71a0b0463a3f96 Mon Sep 17 00:00:00 2001 From: Christopher Douglas Date: Thu, 8 Oct 2009 18:54:04 +0000 Subject: [PATCH] HADOOP-6279. Add Runtime::maxMemory to JVM metrics. Contributed by Todd Lipcon git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@823271 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ src/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 85576033fe..cac18f5474 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -15,6 +15,9 @@ Trunk (unreleased changes) HADOOP-6283. Improve the exception messages thrown by FileUtil$HardLink.getLinkCount(..). (szetszwo) + HADOOP-6279. Add Runtime::maxMemory to JVM metrics. (Todd Lipcon via + cdouglas) + OPTIMIZATIONS BUG FIXES diff --git a/src/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java b/src/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java index c51916875b..24be21dc87 100644 --- a/src/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java +++ b/src/java/org/apache/hadoop/metrics/jvm/JvmMetrics.java @@ -104,10 +104,13 @@ private void doMemoryUpdates() { memoryMXBean.getNonHeapMemoryUsage(); MemoryUsage memHeap = memoryMXBean.getHeapMemoryUsage(); + Runtime runtime = Runtime.getRuntime(); + metrics.setMetric("memNonHeapUsedM", memNonHeap.getUsed()/M); metrics.setMetric("memNonHeapCommittedM", memNonHeap.getCommitted()/M); metrics.setMetric("memHeapUsedM", memHeap.getUsed()/M); metrics.setMetric("memHeapCommittedM", memHeap.getCommitted()/M); + metrics.setMetric("maxMemoryM", runtime.maxMemory()/M); } private void doGarbageCollectionUpdates() {