From 04a3f3d025b99184621910e2fc948ca3b200bfd5 Mon Sep 17 00:00:00 2001
From: Todd Lipcon <todd@cloudera.com>
Date: Tue, 22 Sep 2009 16:04:33 -0700
Subject: [PATCH] HADOOP-6279. Add JVM memory usage to JvmMetrics

---
 .../org/apache/hadoop/metrics/jvm/JvmMetrics.java  |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/core/org/apache/hadoop/metrics/jvm/JvmMetrics.java b/src/core/org/apache/hadoop/metrics/jvm/JvmMetrics.java
index c519168..24be21d 100644
--- a/src/core/org/apache/hadoop/metrics/jvm/JvmMetrics.java
+++ b/src/core/org/apache/hadoop/metrics/jvm/JvmMetrics.java
@@ -104,10 +104,13 @@ public class JvmMetrics implements Updater {
                 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() {
-- 
1.6.0.4

