| Summary: | Implement spinning thread analyzer | ||
|---|---|---|---|
| Product: | [RT] Jetty | Reporter: | Michael Gorovoy <mgorovoy> |
| Component: | server | Assignee: | Michael Gorovoy <mgorovoy> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | jetty-inbox, simone.bordet |
| Version: | 7.5.0 | ||
| Target Milestone: | 7.5.x | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Michael Gorovoy
This has been committed for Jetty v7.5.0. Simone, I'm looking forward to your comments when you get back. Michael, I reopened this bug to suggest some feature that may make the tool more advanced.
I would like a feature to print, ordered by CPU time spent, the threads every N minutes where N is configurable (or perhaps N seconds).
Also, would it be possible to have a "profiler" mode that, when enabled, will analyze the top X threads like a profiler would (e.g. take a stack trace every M millis - by sampling, and derive a call tree statistics based on class and method names found in the stack traces.
For example:
Initial observation shows 3 threads consume most CPU. Start profile mode.
Sample1.thread1 = Thread.run() + Class1.m1() + Class2.m2()
Sample1.thread2 = Thread.run() + Class2.m2()
Sample1.thread3 = Thread.run() + Class2.m3()
So the call tree shows:
Thread.run() - 100%
Class1.m1() - 33%
Class2.m2() - 33%
Class2.m2() - 33%
Class2.m3() - 33%
However, please try to see if the profile mode is too heavy (you have to finish computation before the next sample).
It's a simplified version of a real profiler, but has the benefit of sampling only few threads (and not all of them) and avoids bytecode manipulation that normally real profilers do which may slow down the application a lot.
Simone, I've implemented dumping of the thread CPU utilization as you requested. In regard to "profiler" mode, I am not sure it is valid to assert that if the stack traces in consecutive samples are the same, then the entire time between the two samples were taken was spent inside the same method. We will need to discuss this some more tomorrow. -Michael Resolving this ticket Resolved -> Closed |