[jboss-cvs] JBoss Profiler SVN: r527 - trunk/jvmti-lib/java-src/org/jboss/profiler/jvmti.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri May 1 12:06:38 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-05-01 12:06:38 -0400 (Fri, 01 May 2009)
New Revision: 527

Modified:
   trunk/jvmti-lib/java-src/org/jboss/profiler/jvmti/JVMTIInterface.java
Log:
Little tweak done during a JBM debug

Modified: trunk/jvmti-lib/java-src/org/jboss/profiler/jvmti/JVMTIInterface.java
===================================================================
--- trunk/jvmti-lib/java-src/org/jboss/profiler/jvmti/JVMTIInterface.java	2009-04-26 17:50:53 UTC (rev 526)
+++ trunk/jvmti-lib/java-src/org/jboss/profiler/jvmti/JVMTIInterface.java	2009-05-01 16:06:38 UTC (rev 527)
@@ -542,6 +542,7 @@
      *  */
     public Map createIndexMatrix() throws IOException
     {
+    	releaseTags();
     	final HashMap referencesMap = new HashMap();
 	    	File tmpFile = File.createTempFile("tmpRefs",".tmp");
 	    	this.notifyOnReferences(tmpFile.getAbsolutePath(),new JVMTICallBack()
@@ -705,6 +706,10 @@
     	this.forceGC();
 
     	Object obj[] = this.getAllObjects(className);
+    	
+    	
+    	System.out.println("Obj.length = " + obj.length);
+    	
 
     	Map referencesMap = null;
     	try
@@ -724,13 +729,8 @@
 
 		try
 		{
-			if (obj.length>100)
+			for (int i=0; i < Math.min(50, obj.length) ;i++)
 			{
-				out.println("obj List too big (>100)=" + obj.length);
-				return charArray.toString();
-			}
-			for (int i=0;i<obj.length;i++)
-			{
 				out.println("<br><b>References to obj["+i+"]=" + (useToString?obj[i].toString():obj[i].getClass().getName()));
 				out.println(exploreObjectReferences(referencesMap,obj[i],maxLevel,useToString));
 			}
@@ -1119,8 +1119,14 @@
 		return callBack.maps;
 	}
 
+	
+	public String inventoryReport() throws Exception 
+	{
+		return inventoryReport(true);
+	}
+
 	/** Will list the current memory inventory. Exposed through JMX.  */
-	public String inventoryReport() throws Exception {
+	public String inventoryReport(boolean html) throws Exception {
 		Map map = produceInventory();
 		
 		TreeSet valuesSet = new TreeSet(map.values());
@@ -1128,14 +1134,30 @@
     	CharArrayWriter charArray = new CharArrayWriter();
     	PrintWriter out = new PrintWriter(charArray);
 
-		out.println("<table><tr><td>Class</td><td>#Instances</td><td>#Bytes</td></tr>");
+		if (html)
+		{
+			out.println("<table><tr><td>Class</td><td>#Instances</td><td>#Bytes</td></tr>");
+		}
+		else
+		{
+			out.println(String.format("|%1$-100s|%2$10s|%3$10s|", "Class", "Instances", "Bytes"));
+		}
 
+		
     	while (iterDataPoints.hasNext())
 		{
 			InventoryDataPoint point = (InventoryDataPoint)iterDataPoints.next();
-			out.println("<tr><td>" + point.getClazz().getName() + "</td><td>" + point.getInstances() + "</td><td>" + point.getBytes() + "</td></tr>");
+			if (html)
+			{
+				out.println("<tr><td>" + point.getClazz().getName() + "</td><td>" + point.getInstances() + "</td><td>" + point.getBytes() + "</td></tr>");
+			}
+			else
+			{
+				out.println(String.format("|%1$-100s|%2$10d|%3$10d|", point.getClazz().getName(), point.getInstances(), point.getBytes()));
+			}
 		}
-    	out.println("</table>");
+    	
+    	if (html) out.println("</table>");
 		
 		return charArray.toString();
 	}




More information about the jboss-cvs-commits mailing list