[jboss-dev-forums] [Design of JBoss Profiler] - Re: Calculating the Percent CPU Utilization for a block of c

adrian@jboss.org do-not-reply at jboss.com
Wed Jul 12 08:44:37 EDT 2006


The ThreadMXBean doesn't work properly on Sun's JDK with a Linux 2.6 kernel
It reports the total process cpu time for each thread.

e.g. Try the following:

  |          ThreadMXBean threadMBean = ManagementFactory.getThreadMXBean();
  |          long[] threads = threadMBean.getAllThreadIds();
  |          for (int t = 0; t < threads.length; ++t)
  |             log(threadMBean.getThreadInfo(threads[t]).getThreadName() + " " + threadMBean.getThreadCpuTime(threads[t]) + "ms");
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957339#3957339

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3957339



More information about the jboss-dev-forums mailing list