[유치수] [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:
Chisu Yu
2012-08-06 07:17:17 +00:00
parent ca0fb89a43
commit a7de07464b
2 changed files with 24 additions and 25 deletions
@@ -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;
}
}