Class TTop


  • public class TTop
    extends java.lang.Object
    A terminal-based thread monitoring tool similar to the 'top' Unix command.

    This class provides a real-time view of thread activity in the JVM, displaying information such as thread states, CPU usage, blocking, and waiting statistics. Features include:

    • Sortable thread list with multiple metrics
    • Customizable display columns
    • Interactive navigation and filtering
    • System resource statistics
    • Thread state visualization

    The implementation provides a terminal UI for monitoring thread activity, which can be useful for diagnosing performance issues and thread contention.

    TODO: option modification at runtime (such as implemented in less) is not currently supported TODO: one possible addition would be to detect deadlock threads and display them in a specific way

    • Field Detail

      • STAT_BLOCKED_TIME

        public static final java.lang.String STAT_BLOCKED_TIME
        See Also:
        Constant Field Values
      • STAT_BLOCKED_COUNT

        public static final java.lang.String STAT_BLOCKED_COUNT
        See Also:
        Constant Field Values
      • STAT_WAITED_TIME

        public static final java.lang.String STAT_WAITED_TIME
        See Also:
        Constant Field Values
      • STAT_WAITED_COUNT

        public static final java.lang.String STAT_WAITED_COUNT
        See Also:
        Constant Field Values
      • STAT_LOCK_OWNER_ID

        public static final java.lang.String STAT_LOCK_OWNER_ID
        See Also:
        Constant Field Values
      • STAT_LOCK_OWNER_NAME

        public static final java.lang.String STAT_LOCK_OWNER_NAME
        See Also:
        Constant Field Values
      • STAT_USER_TIME_PERC

        public static final java.lang.String STAT_USER_TIME_PERC
        See Also:
        Constant Field Values
      • STAT_CPU_TIME_PERC

        public static final java.lang.String STAT_CPU_TIME_PERC
        See Also:
        Constant Field Values
      • sort

        public java.util.List<java.lang.String> sort
      • delay

        public long delay
      • stats

        public java.util.List<java.lang.String> stats
      • nthreads

        public int nthreads
    • Constructor Detail

      • TTop

        public TTop​(Terminal terminal)
    • Method Detail

      • ttop

        public static void ttop​(Terminal terminal,
                                java.io.PrintStream out,
                                java.io.PrintStream err,
                                java.lang.String[] argv)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • run

        public void run()
                 throws java.io.IOException,
                        java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException