mss / jvmtop

Automatically exported from code.google.com/p/jvmtop
0 stars 0 forks source link

Support for wider terminals #26

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The output is getting truncated. How to increase the width of the name column.

Original issue reported on code.google.com by sivakish...@gmail.com on 7 Aug 2013 at 9:34

GoogleCodeExporter commented 9 years ago
jvmtop is currently using a fixed-terminal-width of 80 characters which is a 
simple and compatible approach which is also used by many unix tools.
Because of that some outputs which have a variable length (e.g. MAIN-CLASS 
value) might get truncated in order to not exceed their maximum column size.
This is expected and intentionally implemented.

It would be possible to detect the current terminal width in some environments 
(e.g. in an ANSI-Terminal) and hence having more space for variable-sized 
columns, however, currently jvmtop does not include such a functionality.

Original comment by patric.r...@gmail.com on 7 Aug 2013 at 10:20

GoogleCodeExporter commented 9 years ago

Original comment by patric.r...@gmail.com on 9 Aug 2013 at 8:18

GoogleCodeExporter commented 9 years ago
You may want to consider. regular top, for example, displays the command in the 
last column.  This is similar to your main-class column.  It's your only column 
that is subject to massive size variability.  By displaying the command in the 
last column, it's easy for top to allow the command to grow to fill the 
available space, even though the short name is the displayed by default.  For 
example:

Default top:
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
11905 jboss     20   0 1574m  60m  10m S  1.7  3.2   0:10.62 java
 8532 jboss     20   0 1573m  61m  10m S  0.3  3.3   1:04.26 java

After pressing 'c' to toggle the command name / full command line:
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
11905 jboss     20   0 1574m  60m  11m S  1.3  3.2   0:12.03 java -cp 
/home/jboss/bin/jvmtop.jar:/usr/lib/jvm/java-1.7
 3944 jboss     20   0 1613m 201m  18m S  1.0 10.7   2:59.73 java -D[Standalone] -server -XX:+UseCompressedOops -XX:+T
 8532 jboss     20   0 1573m  61m  10m S  0.7  3.3   1:04.63 java -cp /home/jboss/bin/jvmtop.jar:/usr/lib/jvm/java-1.7
    1 root      20   0 19228 1484 1212 S  0.0  0.1   0:01.38 /sbin/init

Consoles limited to 80 character width would simply truncate what they can't 
display (or you could do what the ps command does if -w is specified:

[jboss@testbox ~]$ ps -u jboss
  PID TTY          TIME CMD
 3891 ?        00:00:00 standalone.sh
 3944 ?        00:03:01 java
 5936 pts/1    00:00:00 bash
 6721 pts/2    00:00:00 bash
 8527 pts/2    00:00:00 jvmtop
 8532 pts/2    00:01:05 java
11882 pts/3    00:00:00 bash
11900 pts/3    00:00:00 jvmtop
11905 pts/3    00:00:16 java
12026 pts/1    00:00:00 ps

[jboss@testbox ~]$ ps -u jboss -f
UID        PID  PPID  C STIME TTY          TIME CMD
jboss     3891  3888  0 Aug08 ?        00:00:00 /bin/sh 
/home/jboss/jboss-as-7.1.1.Final/bin/standalone.sh -c standalo
jboss     3944  3891  0 Aug08 ?        00:03:01 java -D[Standalone] -server 
-XX:+UseCompressedOops -XX:+TieredCompilat
jboss     5936  5935  0 Aug08 pts/1    00:00:00 -bash
jboss     6721  6720  0 Aug08 pts/2    00:00:00 -bash
jboss     8527  6721  0 Aug08 pts/2    00:00:00 /bin/sh /home/jboss/bin/jvmtop 
-d 10 3944
jboss     8532  8527  0 Aug08 pts/2    00:01:05 java -cp 
/home/jboss/bin/jvmtop.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.
jboss    11882 11881  0 03:22 pts/3    00:00:00 -bash
jboss    11900 11882  0 03:22 pts/3    00:00:00 /bin/sh /home/jboss/bin/jvmtop
jboss    11905 11900  2 03:22 pts/3    00:00:17 java -cp 
/home/jboss/bin/jvmtop.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.
jboss    12034  5936  0 03:35 pts/1    00:00:00 ps -u jboss -f

ps -u jboss -fw
UID        PID  PPID  C STIME TTY          TIME CMD
jboss     3891  3888  0 Aug08 ?        00:00:00 /bin/sh 
/home/jboss/jboss-as-7.1.1.Final/bin/standalone.sh -c standalone.xml
jboss     3944  3891  0 Aug08 ?        00:03:01 java -D[Standalone] -server 
-XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -X
jboss     5936  5935  0 Aug08 pts/1    00:00:00 -bash
jboss     6721  6720  0 Aug08 pts/2    00:00:00 -bash
jboss     8527  6721  0 Aug08 pts/2    00:00:00 /bin/sh /home/jboss/bin/jvmtop 
-d 10 3944
jboss     8532  8527  0 Aug08 pts/2    00:01:05 java -cp 
/home/jboss/bin/jvmtop.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/
jboss    11882 11881  0 03:22 pts/3    00:00:00 -bash
jboss    11900 11882  0 03:22 pts/3    00:00:00 /bin/sh /home/jboss/bin/jvmtop
jboss    11905 11900  2 03:22 pts/3    00:00:17 java -cp 
/home/jboss/bin/jvmtop.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/
jboss    12033  5936  0 03:35 pts/1    00:00:00 ps -u jboss -fw

[jboss@testbox ~]$ ps -u jboss -fww
UID        PID  PPID  C STIME TTY          TIME CMD
jboss     3891  3888  0 Aug08 ?        00:00:00 /bin/sh 
/home/jboss/jboss-as-7.1.1.Final/bin/standalone.sh -c standalone.xml
jboss     3944  3891  0 Aug08 ?        00:03:01 java -D[Standalone] -server 
-XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -Xmx512m 
-XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true 
-Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 
-Dsun.rmi.dgc.server.gcInterval=3600000 
-Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true 
-Djboss.server.default.config=standalone.xml 
-Dorg.jboss.boot.log.file=/home/jboss/jboss-as-7.1.1.Final/standalone/log/boot.l
og 
-Dlogging.configuration=file:/home/jboss/jboss-as-7.1.1.Final/standalone/configu
ration/logging.properties -jar 
/home/jboss/jboss-as-7.1.1.Final/jboss-modules.jar -mp 
/home/jboss/jboss-as-7.1.1.Final/modules -jaxpmodule javax.xml.jaxp-provider 
org.jboss.as.standalone -Djboss.home.dir=/home/jboss/jboss-as-7.1.1.Final -c 
standalone.xml
jboss     5936  5935  0 Aug08 pts/1    00:00:00 -bash
jboss     6721  6720  0 Aug08 pts/2    00:00:00 -bash
jboss     8527  6721  0 Aug08 pts/2    00:00:00 /bin/sh /home/jboss/bin/jvmtop 
-d 10 3944
jboss     8532  8527  0 Aug08 pts/2    00:01:06 java -cp 
/home/jboss/bin/jvmtop.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/lib/t
ools.jar com.jvmtop.JvmTop --delay 10 3944
jboss    11882 11881  0 03:22 pts/3    00:00:00 -bash
jboss    11900 11882  0 03:22 pts/3    00:00:00 /bin/sh /home/jboss/bin/jvmtop
jboss    11905 11900  2 03:22 pts/3    00:00:17 java -cp 
/home/jboss/bin/jvmtop.jar:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/lib/t
ools.jar com.jvmtop.JvmTop
jboss    12039  5936  0 03:35 pts/1    00:00:00 ps -u jboss -fww

Original comment by DaveParillo on 9 Aug 2013 at 10:36

GoogleCodeExporter commented 9 years ago
I've taken the liberty of coding a patch that adds a -w/--width flag to specify 
the width of the console, so those columns may be stretched. Nowadays most 
people use UI's with flexible console sizes, so this would accommodate those 
people.

Importantly, the default (also minimum accepted) size is still 80, but one can 
go as high as possible.  The patch only affects the profiler - I didn't take 
the time to work on the other screens, but that shouldn't be too much trouble.

Original comment by diego.ri...@gmail.com on 15 Oct 2014 at 6:13

Attachments:

GoogleCodeExporter commented 9 years ago
Diego,
thank you for your patch.
I'll have a look and try to reintegrate this within the code base.

Original comment by patric.r...@gmail.com on 16 Feb 2015 at 4:29