Class TTop


  • public class TTop
    extends java.lang.Object
    Thread Top implementation. 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
      • columns

        private final java.util.Map<java.lang.String,​TTop.Column> columns
      • terminal

        private final Terminal terminal
      • display

        private final Display display
      • size

        private final Size size
      • comparator

        private java.util.Comparator<java.util.Map<java.lang.String,​java.lang.Comparable<?>>> comparator
      • previous

        private java.util.Map<java.lang.Long,​java.util.Map<java.lang.String,​java.lang.Object>> previous
      • changes

        private java.util.Map<java.lang.Long,​java.util.Map<java.lang.String,​java.lang.Long>> changes
      • widths

        private java.util.Map<java.lang.String,​java.lang.Integer> widths
    • 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
      • infos

        private java.util.List<java.util.Map<java.lang.String,​java.lang.Comparable<?>>> infos()
      • display

        private void display()
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • buildComparator

        private java.util.Comparator<java.util.Map<java.lang.String,​java.lang.Comparable<?>>> buildComparator​(java.util.List<java.lang.String> sort)
      • register

        private void register​(java.lang.String name,
                              TTop.Align align,
                              java.lang.String header,
                              java.util.function.Function<java.lang.Object,​java.lang.String> format)
      • nanos

        private static java.lang.String nanos​(long nanos)
      • millis

        private static java.lang.String millis​(long millis)
      • padcut

        private static java.util.function.Function<java.lang.Object,​java.lang.String> padcut​(int nb)
      • padcut

        private static java.lang.String padcut​(java.lang.String str,
                                               int nb)
      • memory

        private static java.lang.String memory​(long cur,
                                               long max)
      • humanReadableByteCount

        private static java.lang.String humanReadableByteCount​(long bytes,
                                                               boolean si)
      • checkInterrupted

        private void checkInterrupted()
                               throws java.lang.InterruptedException
        This is for long running commands to be interrupted by ctrl-c
        Throws:
        java.lang.InterruptedException