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
This commit is contained in:
Christopher Douglas 2009-10-08 18:54:04 +00:00
parent 710d517768
commit b903b25072
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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() {