com.yammer.metrics.core
Class VirtualMachineMetrics

java.lang.Object
  extended by com.yammer.metrics.core.VirtualMachineMetrics

public class VirtualMachineMetrics
extends Object

A collection of Java Virtual Machine metrics.


Nested Class Summary
static class VirtualMachineMetrics.GarbageCollector
           
 
Method Summary
static long daemonThreadCount()
          Returns the number of live daemon threads.
static Set<String> deadlockedThreads()
          Returns a set of strings describing deadlocked threads, if any are deadlocked.
static double fileDescriptorUsage()
          Returns the percentage of available file descriptors which are currently in use.
static Map<String,VirtualMachineMetrics.GarbageCollector> garbageCollectors()
          Returns a map of garbage collector names to garbage collector information.
static double heapUsage()
          Returns the percentage of the JVM's heap which is being used.
static Map<String,Double> memoryPoolUsage()
          Returns a map of memory pool names to the percentage of that pool which is being used.
static double nonHeapUsage()
          Returns the percentage of the JVM's non-heap memory (e.g., direct buffers) which is being used.
static long threadCount()
          Returns the number of live threads (includes daemonThreadCount().
static void threadDump(OutputStream out)
          Dumps all of the threads' current information to an output stream.
static Map<Thread.State,Double> threadStatePercentages()
          Returns a map of thread states to the percentage of all threads which are in that state.
static long uptime()
          Returns the number of seconds the JVM process has been running.
static String vmName()
          Returns the name of the currently-running jvm.
static String vmVersion()
          Returns the version of the currently-running jvm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

heapUsage

public static double heapUsage()
Returns the percentage of the JVM's heap which is being used.

Returns:
the percentage of the JVM's heap which is being used

nonHeapUsage

public static double nonHeapUsage()
Returns the percentage of the JVM's non-heap memory (e.g., direct buffers) which is being used.

Returns:
the percentage of the JVM's non-heap memory which is being used

memoryPoolUsage

public static Map<String,Double> memoryPoolUsage()
Returns a map of memory pool names to the percentage of that pool which is being used.

Returns:
a map of memory pool names to the percentage of that pool which is being used

fileDescriptorUsage

public static double fileDescriptorUsage()
Returns the percentage of available file descriptors which are currently in use.

Returns:
the percentage of available file descriptors which are currently in use, or NaN if the running JVM does not have access to this information

vmVersion

public static String vmVersion()
Returns the version of the currently-running jvm.

Returns:
the version of the currently-running jvm, eg "1.6.0_24"
See Also:
J2SE SDK/JRE Version String Naming Convention

vmName

public static String vmName()
Returns the name of the currently-running jvm.

Returns:
the name of the currently-running jvm, eg "Java HotSpot(TM) Client VM"
See Also:
System.getProperties()

uptime

public static long uptime()
Returns the number of seconds the JVM process has been running.

Returns:
the number of seconds the JVM process has been running

threadCount

public static long threadCount()
Returns the number of live threads (includes daemonThreadCount().

Returns:
the number of live threads

daemonThreadCount

public static long daemonThreadCount()
Returns the number of live daemon threads.

Returns:
the number of live daemon threads

garbageCollectors

public static Map<String,VirtualMachineMetrics.GarbageCollector> garbageCollectors()
Returns a map of garbage collector names to garbage collector information.

Returns:
a map of garbage collector names to garbage collector information

deadlockedThreads

public static Set<String> deadlockedThreads()
Returns a set of strings describing deadlocked threads, if any are deadlocked.

Returns:
a set of any deadlocked threads

threadStatePercentages

public static Map<Thread.State,Double> threadStatePercentages()
Returns a map of thread states to the percentage of all threads which are in that state.

Returns:
a map of thread states to percentages

threadDump

public static void threadDump(OutputStream out)
                       throws IOException
Dumps all of the threads' current information to an output stream.

Parameters:
out - an output stream
Throws:
IOException - if something goes wrong


Copyright © 2011. All Rights Reserved.