Formats the thread dump header for one thread. @param ti the ThreadInfo describing the thread @return the formatted thread dump header
(ThreadInfo ti)
| 276 | * @return the formatted thread dump header |
| 277 | */ |
| 278 | private static String getThreadDumpHeader(ThreadInfo ti) { |
| 279 | StringBuilder sb = new StringBuilder(); |
| 280 | sb.append("\"").append(ti.getThreadName()).append("\""); |
| 281 | sb.append(" Id=").append(ti.getThreadId()); |
| 282 | sb.append(" cpu=").append(threadMXBean.getThreadCpuTime(ti.getThreadId())).append(" ns"); |
| 283 | sb.append(" usr=").append(threadMXBean.getThreadUserTime(ti.getThreadId())).append(" ns"); |
| 284 | sb.append(" blocked ").append(ti.getBlockedCount()).append(" for ").append(ti.getBlockedTime()).append(" ms"); |
| 285 | sb.append(" waited ").append(ti.getWaitedCount()).append(" for ").append(ti.getWaitedTime()).append(" ms"); |
| 286 | |
| 287 | if (ti.isSuspended()) { |
| 288 | sb.append(" (suspended)"); |
| 289 | } |
| 290 | if (ti.isInNative()) { |
| 291 | sb.append(" (running in native)"); |
| 292 | } |
| 293 | sb.append(CRLF); |
| 294 | sb.append(INDENT3 + "java.lang.Thread.State: ").append(ti.getThreadState()); |
| 295 | sb.append(CRLF); |
| 296 | return sb.toString(); |
| 297 | } |
| 298 | |
| 299 | /** |
| 300 | * Formats the thread dump for one thread. |
no test coverage detected