mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-17 16:56:15 +10:00
[유치수] [NOBTS] extract 'getThreadTime' method from RequestTracer to SystemUtils.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-tomcat-profiler/trunk@501 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.profiler.util;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.ThreadMXBean;
|
||||
|
||||
public class SystemUtils {
|
||||
|
||||
public static long[] getThreadTime() {
|
||||
long result[] = new long[2];
|
||||
|
||||
ThreadMXBean bean = ManagementFactory.getThreadMXBean();
|
||||
|
||||
System.out.println(Thread.currentThread().getName() + " CPU:" + bean.getCurrentThreadCpuTime() + " User:" + bean.getCurrentThreadUserTime());
|
||||
|
||||
result[0] = bean.getCurrentThreadCpuTime();
|
||||
result[1] = bean.getCurrentThreadUserTime();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user