hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r947758 - in /hadoop/mapreduce/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/ClusterStatus.java src/webapps/job/jobtracker.jsp
Date Mon, 24 May 2010 18:45:21 GMT
Author: cdouglas
Date: Mon May 24 18:45:21 2010
New Revision: 947758

URL: http://svn.apache.org/viewvc?rev=947758&view=rev
Log:
MAPREDUCE-1683. Remove JNI calls from ClusterStatus cstr. Contributed by Arun Murthy and Luke
Lu

Modified:
    hadoop/mapreduce/trunk/CHANGES.txt
    hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/ClusterStatus.java
    hadoop/mapreduce/trunk/src/webapps/job/jobtracker.jsp

Modified: hadoop/mapreduce/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/CHANGES.txt?rev=947758&r1=947757&r2=947758&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/CHANGES.txt (original)
+++ hadoop/mapreduce/trunk/CHANGES.txt Mon May 24 18:45:21 2010
@@ -108,6 +108,9 @@ Release 0.21.0 - Unreleased
     MAPREDUCE-1607. Task controller may not set permissions for a
     task cleanup attempt's log directory (Amareshwari Sriramadasu via vinodkv)
 
+    MAPREDUCE-1683. Remove JNI calls from ClusterStatus cstr. (Arun Murthy and
+    Luke Lu via cdouglas)
+
   NEW FEATURES
 
     MAPREDUCE-706. Support for FIFO pools in the fair scheduler.

Modified: hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/ClusterStatus.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/ClusterStatus.java?rev=947758&r1=947757&r2=947758&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/ClusterStatus.java (original)
+++ hadoop/mapreduce/trunk/src/java/org/apache/hadoop/mapred/ClusterStatus.java Mon May 24
18:45:21 2010
@@ -185,8 +185,6 @@ public class ClusterStatus implements Wr
   private int max_map_tasks;
   private int max_reduce_tasks;
   private JobTracker.State state;
-  private long used_memory;
-  private long max_memory;
   private Collection<BlackListInfo> blacklistedTrackersInfo =
     new ArrayList<BlackListInfo>();
 
@@ -236,8 +234,6 @@ public class ClusterStatus implements Wr
     max_map_tasks = maxMaps;
     max_reduce_tasks = maxReduces;
     this.state = state;
-    used_memory = Runtime.getRuntime().totalMemory();
-    max_memory = Runtime.getRuntime().maxMemory();
   }
 
   /**
@@ -391,24 +387,6 @@ public class ClusterStatus implements Wr
   }
 
   /**
-   * Get the total heap memory used by the <code>JobTracker</code>
-   * 
-   * @return the size of heap memory used by the <code>JobTracker</code>
-   */
-  public long getUsedMemory() {
-    return used_memory;
-  }
-
-  /**
-   * Get the maximum configured heap memory that can be used by the <code>JobTracker</code>
-   * 
-   * @return the configured size of max heap memory that can be used by the <code>JobTracker</code>
-   */
-  public long getMaxMemory() {
-    return max_memory;
-  }
-  
-  /**
    * Gets the list of blacklisted trackers along with reasons for blacklisting.
    * 
    * @return the collection of {@link BlackListInfo} objects. 
@@ -445,8 +423,6 @@ public class ClusterStatus implements Wr
     out.writeInt(reduce_tasks);
     out.writeInt(max_map_tasks);
     out.writeInt(max_reduce_tasks);
-    out.writeLong(used_memory);
-    out.writeLong(max_memory);
     WritableUtils.writeEnum(out, state);
   }
 
@@ -474,8 +450,6 @@ public class ClusterStatus implements Wr
     reduce_tasks = in.readInt();
     max_map_tasks = in.readInt();
     max_reduce_tasks = in.readInt();
-    used_memory = in.readLong();
-    max_memory = in.readLong();
     state = WritableUtils.readEnum(in, JobTracker.State.class);
   }
 }

Modified: hadoop/mapreduce/trunk/src/webapps/job/jobtracker.jsp
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/trunk/src/webapps/job/jobtracker.jsp?rev=947758&r1=947757&r2=947758&view=diff
==============================================================================
--- hadoop/mapreduce/trunk/src/webapps/job/jobtracker.jsp (original)
+++ hadoop/mapreduce/trunk/src/webapps/job/jobtracker.jsp Mon May 24 18:45:21 2010
@@ -22,6 +22,9 @@
   import="javax.servlet.*"
   import="javax.servlet.http.*"
   import="java.io.*"
+  import="java.lang.management.MemoryUsage"
+  import="java.lang.management.MemoryMXBean"
+  import="java.lang.management.ManagementFactory"
   import="java.util.*"
   import="java.text.DecimalFormat"
   import="org.apache.hadoop.http.HtmlQuoting"
@@ -34,6 +37,7 @@
 <%
   JobTracker tracker = (JobTracker) application.getAttribute("job.tracker");
   ClusterStatus status = tracker.getClusterStatus();
+  MemoryMXBean mem = ManagementFactory.getMemoryMXBean();
   ClusterMetrics metrics = tracker.getClusterMetrics();
   String trackerName = 
            StringUtils.simpleHostname(tracker.getJobTrackerMachine());
@@ -130,7 +134,12 @@
 <b>Identifier:</b> <%= tracker.getTrackerIdentifier()%><br>     
           
                    
 <hr>
-<h2>Cluster Summary (Heap Size is <%= StringUtils.byteDesc(status.getUsedMemory())
%>/<%= StringUtils.byteDesc(status.getMaxMemory()) %>)</h2>
+<h2>Cluster Summary (Heap Size is
+    <% MemoryUsage heap = mem.getHeapMemoryUsage();
+       out.print(StringUtils.byteDesc(heap.getUsed()) + "/");
+       out.print(StringUtils.byteDesc(heap.getCommitted()) + "/");
+       out.print(StringUtils.byteDesc(heap.getMax()) + ")");
+    %>
 <% 
  generateSummaryTable(out, metrics, tracker); 
 %>



Mime
View raw message