From kato-commits-return-121-apmail-incubator-kato-commits-archive=incubator.apache.org@incubator.apache.org Wed May 20 12:21:07 2009 Return-Path: Delivered-To: apmail-incubator-kato-commits-archive@minotaur.apache.org Received: (qmail 79965 invoked from network); 20 May 2009 12:21:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 May 2009 12:21:07 -0000 Received: (qmail 32560 invoked by uid 500); 20 May 2009 12:21:20 -0000 Delivered-To: apmail-incubator-kato-commits-archive@incubator.apache.org Received: (qmail 32544 invoked by uid 500); 20 May 2009 12:21:20 -0000 Mailing-List: contact kato-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: kato-dev@incubator.apache.org Delivered-To: mailing list kato-commits@incubator.apache.org Received: (qmail 32534 invoked by uid 99); 20 May 2009 12:21:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 May 2009 12:21:20 +0000 X-ASF-Spam-Status: No, hits=-1997.2 required=10.0 tests=ALL_TRUSTED,WEIRD_QUOTING X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 May 2009 12:21:18 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7320F2388895; Wed, 20 May 2009 12:20:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r776674 - /incubator/kato/trunk/org.apache.kato.example.tomcat/WebContent/hprofDump.jsp Date: Wed, 20 May 2009 12:20:58 -0000 To: kato-commits@incubator.apache.org From: monteith@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090520122058.7320F2388895@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: monteith Date: Wed May 20 12:20:58 2009 New Revision: 776674 URL: http://svn.apache.org/viewvc?rev=776674&view=rev Log: Add hprofDump.jsp - generates HProf dumps. Added: incubator/kato/trunk/org.apache.kato.example.tomcat/WebContent/hprofDump.jsp (with props) Added: incubator/kato/trunk/org.apache.kato.example.tomcat/WebContent/hprofDump.jsp URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato.example.tomcat/WebContent/hprofDump.jsp?rev=776674&view=auto ============================================================================== --- incubator/kato/trunk/org.apache.kato.example.tomcat/WebContent/hprofDump.jsp (added) +++ incubator/kato/trunk/org.apache.kato.example.tomcat/WebContent/hprofDump.jsp Wed May 20 12:20:58 2009 @@ -0,0 +1,81 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + +HProf Dump + + +Generates an hprof file from the current heap state. +
+JVM:
+<%
+	out.write(System.getProperty("java.vm.vendor") + ", "
+			+ System.getProperty("java.vm.name") + ", "
+			+ System.getProperty("java.vm.version"));
+%>
+
+ +
+ +
+<%@page import="javax.management.*,java.lang.management.ManagementFactory,java.io.File" %> +<% + String dumpType = request.getParameter("Dump"); + + if ("hprof".equals(dumpType)) { + MBeanServer mbeanServer = ManagementFactory + .getPlatformMBeanServer(); + String fileName = System.getProperty("user.dir")+File.separatorChar+"hprofDump"+ + System.currentTimeMillis()+".hprof"; + + out.write("Generating hprof file \""+fileName+"\""); + out.flush(); + + try { + mbeanServer + .invoke( + ObjectName + .getInstance("com.sun.management:type=HotSpotDiagnostic"), + "dumpHeap", new Object[] { + fileName, true }, + new String[] { "java.lang.String", + "boolean" }); + } catch (InstanceNotFoundException e) { + e.printStackTrace(); + } catch (MalformedObjectNameException e) { + e.printStackTrace(); + } catch (MBeanException e) { + e.printStackTrace(); + } catch (ReflectionException e) { + e.printStackTrace(); + } catch (NullPointerException e) { + e.printStackTrace(); + } + } +%> + + \ No newline at end of file Propchange: incubator/kato/trunk/org.apache.kato.example.tomcat/WebContent/hprofDump.jsp ------------------------------------------------------------------------------ svn:mime-type = text/plain