sk.baka.webvm.analyzer
Class ProblemAnalyzer

java.lang.Object
  extended by sk.baka.webvm.analyzer.ProblemAnalyzer

public final class ProblemAnalyzer
extends Object

Analyzes VM problems.

Author:
Martin Vysny

Field Summary
static String CLASS_DEADLOCKED_THREADS
          The "Deadlocked threads" problem class.
static String CLASS_FREE_DISK_SPACE
          The "Free disk space" problem class.
static String CLASS_GC_CPU_USAGE
          The "GC CPU Usage" problem class.
static String CLASS_GC_MEMORY_CLEANUP
          The "GC Memory cleanup" problem class.
static String CLASS_HOST_MEMORY_USAGE
          The "Host Memory" problem class.
static String CLASS_MEMORY_USAGE
          The "Memory status" problem class.
 
Constructor Summary
ProblemAnalyzer()
           
 
Method Summary
 void configure(Config config)
          Parses init values from given application.
static long[] findDeadlockedThreads(ThreadMXBean bean)
          Finds deadlocked threads.
static ProblemReport getDeadlockReport()
          Prepares the CLASS_DEADLOCKED_THREADS report.
 ProblemReport getFreeDiskspaceReport()
          Analyzes free disk space.
 ProblemReport getGCCPUUsageReport(List<HistorySample> history)
          Prepares the CLASS_GC_CPU_USAGE report.
 ProblemReport getGCMemUsageReport()
          Prepares the CLASS_GC_MEMORY_CLEANUP report.
 ProblemReport getHostVirtMemReport()
          Prepares the CLASS_HOST_MEMORY_USAGE report.
 ProblemReport getMemStatReport()
          Prepares the #CLASS_MEMORY_STATUS report.
 List<ProblemReport> getProblems(List<HistorySample> history)
          Diagnose the VM and returns a list of problem reports.
static int parse(Properties props, String propName, int defaultValue)
          Parses given property and returns it as an integer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_FREE_DISK_SPACE

public static final String CLASS_FREE_DISK_SPACE
The "Free disk space" problem class.

See Also:
Constant Field Values

CLASS_DEADLOCKED_THREADS

public static final String CLASS_DEADLOCKED_THREADS
The "Deadlocked threads" problem class.

See Also:
Constant Field Values

CLASS_GC_CPU_USAGE

public static final String CLASS_GC_CPU_USAGE
The "GC CPU Usage" problem class.

See Also:
Constant Field Values

CLASS_GC_MEMORY_CLEANUP

public static final String CLASS_GC_MEMORY_CLEANUP
The "GC Memory cleanup" problem class.

See Also:
Constant Field Values

CLASS_MEMORY_USAGE

public static final String CLASS_MEMORY_USAGE
The "Memory status" problem class.

See Also:
Constant Field Values

CLASS_HOST_MEMORY_USAGE

public static final String CLASS_HOST_MEMORY_USAGE
The "Host Memory" problem class.

See Also:
Constant Field Values
Constructor Detail

ProblemAnalyzer

public ProblemAnalyzer()
Method Detail

findDeadlockedThreads

public static long[] findDeadlockedThreads(ThreadMXBean bean)
Finds deadlocked threads. Uses ThreadMXBean.findDeadlockedThreads() on 1.6, falls back to ThreadMXBean.findMonitorDeadlockedThreads() on 1.5.

Parameters:
bean - the thread mx bean
Returns:
ids of deadlocked threads, null if no threads are deadlocked.

configure

public void configure(Config config)
Parses init values from given application.

Parameters:
config -

parse

public static int parse(Properties props,
                        String propName,
                        int defaultValue)
Parses given property and returns it as an integer. Allows default value to be returned in case of null.

Parameters:
props - the properties
propName - the property name
defaultValue - returned when given property is not specified.
Returns:
parsed property value

getProblems

public List<ProblemReport> getProblems(List<HistorySample> history)
Diagnose the VM and returns a list of problem reports.

Parameters:
history - current history.
Returns:
the list of reports.

getHostVirtMemReport

public ProblemReport getHostVirtMemReport()
Prepares the CLASS_HOST_MEMORY_USAGE report.

Returns:
report

getGCCPUUsageReport

public ProblemReport getGCCPUUsageReport(List<HistorySample> history)
Prepares the CLASS_GC_CPU_USAGE report.

Parameters:
history - the history
Returns:
report

getMemStatReport

public ProblemReport getMemStatReport()
Prepares the #CLASS_MEMORY_STATUS report.

Returns:
report

getGCMemUsageReport

public ProblemReport getGCMemUsageReport()
Prepares the CLASS_GC_MEMORY_CLEANUP report.

Returns:
report

getDeadlockReport

public static ProblemReport getDeadlockReport()
Prepares the CLASS_DEADLOCKED_THREADS report.

Returns:
report

getFreeDiskspaceReport

public ProblemReport getFreeDiskspaceReport()
Analyzes free disk space.

Returns:
free disk space report.


Copyright © 2010 Baka. All Rights Reserved.