MCPcopy Create free account
hub / github.com/apache/tomcat / getThreadDumpHeader

Method getThreadDumpHeader

java/org/apache/tomcat/util/Diagnostics.java:278–297  ·  view source on GitHub ↗

Formats the thread dump header for one thread. @param ti the ThreadInfo describing the thread @return the formatted thread dump header

(ThreadInfo ti)

Source from the content-addressed store, hash-verified

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.

Callers 1

getThreadDumpMethod · 0.95

Calls 5

getThreadIdMethod · 0.80
toStringMethod · 0.65
appendMethod · 0.45
getThreadNameMethod · 0.45
isSuspendedMethod · 0.45

Tested by

no test coverage detected