visualvm
visualvm copied to clipboard
Ability to show only running or sleeping or waiting, threads
Describe the solution you'd like
In the Threads tab, you can show by:
- All threads
- Live threads
- Finished threads
- Selected thread
When we have hundreds of living threads, it could be useful to filter them more finely.
I would be interested in showing only:
- threads consuming CPU time
- threads blocked due to a synchronize or a lock
- threads waiting for a network response (DataBase, WebService....).
- threads sleeping due to Object.wait() or Thread.sleep()
Describe alternatives you've considered
This show drop down list could be improved like this:
- All threads
- Live threads
- -- Only running threads
- -- Only sleeping threads
- -- Only waiting threads
- -- Only parking threads
- -- Only monitoring threads
- Finished threads
- Selected thread
As an alternative, we could also make it possible to click on the elements of the legend at the bottom of the timeline to show and hide by type of thread. This latter would have the advantage of being able to display two or three thread types at the same time
I would just like to second this enhancement proposal and add to the request:
- in short, I think it would be very useful to have more filters in the "Threads" section. Not only when profiling a live app, but also when analysing an Heap Dump.
Please consider this. Thanks.
Ok, let me see what we can do to implement this enhancement.
That would be great!
It's good to know these enhancements have caught your interest.
Thank you for your time.
This show drop down list could be improved like this:
- All threads
- Live threads
- -- Only running threads
- -- Only sleeping threads
- -- Only waiting threads
- -- Only parking threads
- -- Only monitoring threads
- Finished threads
- Selected thread
We can extend the drop down list using above categories. However it is not clear to me how to apply this to the threads, which changes its state over time. Live thread can be in different states - running, sleeping, etc.
Well, allow me to suggest some possible changes that I think would be useful regarding this matter:
- When inspecting an heap/thread dump
This is likely a simpler case because no threads are running: there is only a snapshot of the moment it was taken.
Consider this common analysis issue: I want to understand why http-listener threads are BLOCKED and what they contain. The following screenshot was taken from a Glassfish application.
- I need only to look at http-listener(X) threads, so I need a filter by name, which hopefully filters out threads whose name is not the one selected.
- I need another filter to further trim down the results by thread status. Cumulative, as in "I might need to look at BLOCKED and TIMED_WAITING.
So my suggestion would be:
-
A new set of filters for this screen that apply to the table results - the threads.
-
A filter by name that would take text as input. Ideally a regex so that one could ask for something like "http-listener" and it would filter out all threads whose name did not comply to it.
-
A filter by thread status, maybe with a combobox-like appearance, so one could select BLOCKED and TIMED_WAITING
-
Ideally these filters should be cumulative, so one could do something like:
Name: "http-listener" OR "Finalizer"; Thread Status: "BLOCKED" OR "TIMED_WAITING" and it would show all threads whose name comply to regex http-listener OR Finalizer and whose status is BLOCKED OR TIMED_WAITING
- When performing real time analysis
This is likely a lot trickier because thread status is changing all the time.
In this case I would argue for:
- Same set of filters I described above.
- Either Thread Status is inactive because of these real time complications
- Or the filters are applied each time the app is snapshot, which looks like it happens every second. This might be complicated because while the results of the name filter are unlikely to change often (so we could just assume it doesn't need to be checked every second) the thread status results do change and so this could mean a slight overhead to calculate and change the view.
Also, related to this: the ORDER of the threads when we click the "Name" header might be broken. IT doesn't seem to be alphabetical. You can see from that screenshot that they are definitely not order by their name and I did click the Name header, multiple times actually.
Was this valuable for this discussion?
It would be useful to be able to group threads by name (excluding numbers) to sum times.
When they're executing the same code, it would give me a clearer picture of where it's spending most of its time.
@CarlosMOGoncalves
Was this valuable for this discussion?
Sure, the enhancement backed by actual use of VisualVM is always useful.
the ORDER of the threads when we click the "Name" header might be broken. IT doesn't seem to be alphabetical.
Please file separate issue for that problem.
For now, I would like to concentrate on the filtering of threads from heap dump, since it is more or less clear, how it should look like. Also it would be great if you could file separate enhancement for it, since this one was primarily filed for real-time threads view. Just copy-past above proposal.
Thanks.