patric-r / jvmtop

Java monitoring for the command-line, profiler included

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CPU/Memory Sampling?

tckb opened this issue · comments

Hey, this surely is a very handy tool. this essentially could be used for monitoring remote VMs. Is there any way for sampling like in JVisualVm? the current stats are "good to know" but, wouldn't help much in monitoring heap/CPU.

Hi, CPU sampling (sampling CPU profiler) is supported using the --profile argument.

A heap histogramm could be included, however, this would only work on hotspot vms.
Let's put this idea on the feature-request list. Thanks for your suggestion!

@patric-r Yeah I just learnt about the CPU sampling. But, a heap histogram would be a great addition! debugging in a remote vm could quite a challenging. let me know if i can contribute in anyway here.

Pull requests are always welcome ;)
As a hint, sun.tools.attach.HotSpotVirtualMachine.heapHisto() looks like a good place to start.

let me check it out as soon as I get time. 👍

@patric-r I prepared a basic functional version of this feature. You can open this view by passing the flag --profile-mem As soon as I clean up my code. I'll send a PR. Oh and I cleaned up the rest of the code, hope you don't mind. :)

./jvmtop.sh --profile-mem 51672

image

I have added another useful flag ( --enable-deltas). This comes quite handy while profile while profiling memory.

./jvmtop.sh --profile-mem 51672 --enable-deltas

image

commented

Nice! why is this not merged?

Nice! why is this not merged?

I can't tell you the reason why the original author didn't integrate it. But tckb unfortunately changed lots of formattings, which makes it very hard to review his commits. An integration is not possible, if the pull request doesn't only change the functionality.

@kant111 Yeh, so the issue was the original code's formatting made my eye's burn and also, I was following some standard formatting in my IDE and inadvertently that was also committed. Furthermore, I didn't want to switch back to original formatting. If you are still interested in it you can look at my fork (https://github.com/tckb/jvmtop). It's not maintained though.