net.bull.javamelody
Class VirtualMachine

java.lang.Object
  extended by net.bull.javamelody.VirtualMachine

public final class VirtualMachine
extends Object

Classe d'attachement dynamique utilisée ici pour obtenir l'histogramme de la mémoire.
Cette classe nécessite tools.jar du jdk pour être exécutée (ok dans tomcat), mais pas pour être compilée.
@see VirtualMachine

Author:
Emeric Vernat

Method Summary
static HeapHistogram createHeapHistogram()
           
static void detach()
          Détachement du singleton.
static Object getJvmVirtualMachine()
           
static InputStream heapHisto()
           
static boolean isEnabled()
           
static boolean isSupported()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isSupported

public static boolean isSupported()
Returns:
true si heapHisto supporté (jdk 1.6 de Sun ou de JRockit de BEA)

isEnabled

public static boolean isEnabled()
Returns:
false si non supporté ou si un attachement ou un histogramme a échoué, true si supporté et pas essayé ou si réussi

getJvmVirtualMachine

public static Object getJvmVirtualMachine()
                                   throws Exception
Returns:
Singleton initialisé à la demande de l'instance de com.sun.tools.attach.VirtualMachine, null si enabled est false
Throws:
Exception - e

detach

public static void detach()
                   throws Exception
Détachement du singleton.

Throws:
Exception - e

heapHisto

public static InputStream heapHisto()
                             throws Exception
Returns:
flux contenant l'histogramme mémoire comme retourné par jmap -histo
Throws:
Exception - e

createHeapHistogram

public static HeapHistogram createHeapHistogram()
                                         throws Exception
Returns:
l'histogramme mémoire
Throws:
Exception - e


Copyright © 2008-2009 Emeric Vernat. All Rights Reserved.