Class GridDebug

  • Direct Known Subclasses:
    D

    public class GridDebug
    extends Object
    Utility class for debugging.
    • Constructor Detail

      • GridDebug

        public GridDebug()
    • Method Detail

      • allowWriteLog

        public static void allowWriteLog​(boolean allow)
        Parameters:
        allow - Write log.
      • write

        public static void write​(Object... x)
        Writes to log file which should reside on ram disk.
        Parameters:
        x - Data to log.
      • debug

        public static void debug​(Object... x)
        Add the data to debug queue.
        Parameters:
        x - Debugging data.
      • hangIfStopped

        public static void hangIfStopped()
        Hangs for 5 minutes if stopped.
      • start

        public static void start()
        Sets starting time after which timing(String) measurements can be done.
      • timing

        public static void timing​(String label)
        Print timing after the start() call.
        Parameters:
        label - Label.
      • dumpStack

        public static Object dumpStack()
        Returns:
        Object which will dump thread stack on toString call.
      • dumpLastAndStop

        public static void dumpLastAndStop​(int n)
        Dumps given number of last events.
        Parameters:
        n - Number of last elements to dump.
      • dump

        public static void dump​(Collection<GridDebug.Item> que)
        Dump given queue to stdout.
        Parameters:
        que - Queue.
      • dumpWithStop

        public static String dumpWithStop​(Object... x)
        Dump existing queue to stdout and atomically replace it with null so that no subsequent logging is possible.
        Parameters:
        x - Parameters.
        Returns:
        Empty string (useful for assertions like assert x == 0 : D.dumpWithStop(); ).
      • dumpWithReset

        public static String dumpWithReset()
        Dump existing queue to stdout and atomically replace it with new queue.
        Returns:
        Empty string (useful for assertions like assert x == 0 : D.dumpWithReset(); ).
      • reset

        public static void reset()
        Reset queue to empty one.
      • dumpHeap

        public static void dumpHeap​(String fileName,
                                    boolean live)
        Call this method from your application whenever you want to dump the heap snapshot into a file.
        Parameters:
        fileName - name of the heap dump file
        live - flag that tells whether to dump only the live objects
      • getCommittedVirtualMemorySize

        public static long getCommittedVirtualMemorySize()
        Returns:
        Committed VM size in bits.