mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8185003: JMX: Add a version of ThreadMXBean.dumpAllThreads with a maxDepth argument
Added two new API's to limit the stack trace depth Reviewed-by: mchung, dfuchs, rriggs, egahlin
This commit is contained in:
parent
2990ce8012
commit
96d0817455
10 changed files with 317 additions and 80 deletions
|
@ -562,6 +562,10 @@ void ThreadStackTrace::dump_stack_at_safepoint(int maxDepth) {
|
|||
vframe* start_vf = _thread->last_java_vframe(®_map);
|
||||
int count = 0;
|
||||
for (vframe* f = start_vf; f; f = f->sender() ) {
|
||||
if (maxDepth >= 0 && count == maxDepth) {
|
||||
// Skip frames if more than maxDepth
|
||||
break;
|
||||
}
|
||||
if (f->is_java_frame()) {
|
||||
javaVFrame* jvf = javaVFrame::cast(f);
|
||||
add_stack_frame(jvf);
|
||||
|
@ -569,10 +573,6 @@ void ThreadStackTrace::dump_stack_at_safepoint(int maxDepth) {
|
|||
} else {
|
||||
// Ignore non-Java frames
|
||||
}
|
||||
if (maxDepth > 0 && count == maxDepth) {
|
||||
// Skip frames if more than maxDepth
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue