patric-r/jvmtop

A --help argument would help

GoogleCodeExporter opened this issue · 4 comments

What steps will reproduce the problem?
1. ./jvmtop.sh --help

jvmtop has several arguments that can only be learned through looking at a few 
different pages in the wiki - since there is no source code, hard to know if 
they are all documented anywhere.

What is the expected output? What do you see instead?

[me@localhost~]$ jvmtop --help

JvmTop 0.7.1 alpha, http://code.google.com/p/jvmtop
Usage: info [OPTIONS]... [PID]

Monitor JVM metrics on the command line

Options (only one can be specified):
  --help                this text
  --once  [PID]      Run jvmtop one time, then exit
  --delay N           Delay N seconds between updates
  --profile PID      Profile a specifc JVM instance

Examples:
   jvmtop             Summarize all currently running JVM's
   jvmtop 3944    Display detailed information for a single JVM (pid #3944)
   jvmtop --delay 3 --profile 3944
                           Profile process #3944, updating the display every 3 seconds

Plus appending what you currently have written up for the column definitions on 
the ExampleOutput wiki page would be a nice touch.  


or for an unknown argument:

[me@localhost~]$ jvmtop --foo
jvmtop: unrecognized option '--foo'
Try --help for more information.


Actual:
[me@localhost~]$ jvmtop --help
Exception in thread "main" java.lang.NumberFormatException: For input string: 
"--help"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:492)
    at java.lang.Integer.parseInt(Integer.java:527)
    at com.jvmtop.JvmTop.main(JvmTop.java:122)



Original issue reported on code.google.com by DaveParillo on 8 Aug 2013 at 11:49

For anyone interested, I created a modified jvmtop.sh that (sort of) does this 
- it uses getopts, so uses short instead of long args :(  

I've tested it some, but not a ton.

Original comment by DaveParillo on 9 Aug 2013 at 1:22

Attachments:

I totally agree, a --help argument should definitely be implemented. It's on my 
TODO-list since the first alpha release - but obviously not with the highest 
priority.
The same is true for argument parsing/short args support.

Thanks for sharing the shell script which adds these features right now.

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

  • Changed state: Accepted
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect
No prob.  In the spirit of full disclosure, I should mention that the first 
script uploaded has two lines that may be specific to my environment:  line 2 : 
. ~/.bash_profile  and the last line: java $JAVA_OPTS -cp 
/home/jboss/bin/jvmtop.jar ....

I am uploading a new script to add your $DIR back in, but not sure how to get 
the verify_java to use JAVA_HOME, even though it's in my environment.

Original comment by DaveParillo on 9 Aug 2013 at 11:40

Attachments:

added in 0.8.0

Original comment by patric.r...@gmail.com on 14 Aug 2013 at 2:47

  • Changed state: Resolved