Java examples for java.lang.management:MemoryMXBean
Get CPU time in nanoseconds via Management bean
//package com.java2s; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; public class Main { /** Get CPU time in nanoseconds. */ public static long getCpuTime() { ThreadMXBean bean = ManagementFactory.getThreadMXBean(); return bean.isCurrentThreadCpuTimeSupported() ? bean .getCurrentThreadCpuTime() : 0L; }/*w ww . ja v a2 s.c o m*/ }