jetbrains.buildServer.util
Class DiagnosticUtil

java.lang.Object
  extended by jetbrains.buildServer.util.DiagnosticUtil

public class DiagnosticUtil
extends java.lang.Object


Field Summary
static java.lang.String THREAD_DUMP_PREFIX
           
 
Constructor Summary
DiagnosticUtil()
           
 
Method Summary
static java.lang.management.MemoryUsage getHeapMemoryUsage()
           
static java.util.List<java.lang.management.MemoryPoolMXBean> getMemoryUsageBeans()
           
static java.lang.management.MemoryUsage getPermGenPoolMemoryUsage()
           
static boolean isPermGenPool(java.lang.String name)
           
static java.io.File memoryDump(java.io.File hprofDir)
          Takes JVM memory dump
static boolean memoryDumpAvailable()
           
static java.io.File memoryDumpZipped(java.io.File dir)
          Takes hprof and than zipps it
static java.io.File threadDumpToDirectory(java.io.File dir, java.lang.String summary)
           
static void threadDumpToLog(java.util.concurrent.ExecutorService executorService)
           
static void threadDumpToLog(NamedThreadFactory threadFactory)
           
static void threadDumpToStream(java.io.PrintStream out)
           
static void threadDumpToStream(java.io.PrintWriter out)
           
static java.lang.String threadDumpToString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THREAD_DUMP_PREFIX

public static final java.lang.String THREAD_DUMP_PREFIX
See Also:
Constant Field Values
Constructor Detail

DiagnosticUtil

public DiagnosticUtil()
Method Detail

threadDumpToLog

public static void threadDumpToLog(java.util.concurrent.ExecutorService executorService)

threadDumpToLog

public static void threadDumpToLog(@NotNull
                                   NamedThreadFactory threadFactory)

threadDumpToStream

public static void threadDumpToStream(@NotNull
                                      java.io.PrintStream out)

threadDumpToStream

public static void threadDumpToStream(@NotNull
                                      java.io.PrintWriter out)

threadDumpToDirectory

public static java.io.File threadDumpToDirectory(@Nullable
                                                 java.io.File dir,
                                                 @Nullable
                                                 java.lang.String summary)

threadDumpToString

@NotNull
public static java.lang.String threadDumpToString()

getHeapMemoryUsage

@NotNull
public static java.lang.management.MemoryUsage getHeapMemoryUsage()

getPermGenPoolMemoryUsage

@Nullable
public static java.lang.management.MemoryUsage getPermGenPoolMemoryUsage()

isPermGenPool

public static boolean isPermGenPool(java.lang.String name)

getMemoryUsageBeans

public static java.util.List<java.lang.management.MemoryPoolMXBean> getMemoryUsageBeans()

memoryDumpAvailable

public static boolean memoryDumpAvailable()
Returns:
true iff JVM supports memory dump capture
Since:
8.0

memoryDump

@NotNull
public static java.io.File memoryDump(@Nullable
                                              java.io.File hprofDir)
                               throws java.lang.Exception
Takes JVM memory dump

Parameters:
hprofDir - directory to write dump. It's required ~ 2*heap-size of free space
Returns:
path to saved .hprof
Throws:
java.lang.Exception - on error or if memory dump is not supported
Since:
8.0

memoryDumpZipped

@NotNull
public static java.io.File memoryDumpZipped(@Nullable
                                                    java.io.File dir)
                                     throws java.lang.Exception
Takes hprof and than zipps it

Parameters:
dir - path to write file. It's required ~ 2*heap-size of free space
Returns:
path to created dump file
Throws:
java.lang.Exception - on error or if memory dump is not supported
Since:
8.0