com.sun.management.ThreadMXBean.getCurrentThreadCpuTime()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中com.sun.management.ThreadMXBean.getCurrentThreadCpuTime()方法的一些代码示例,展示了ThreadMXBean.getCurrentThreadCpuTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadMXBean.getCurrentThreadCpuTime()方法的具体详情如下:
包路径:com.sun.management.ThreadMXBean
类名称:ThreadMXBean
方法名:getCurrentThreadCpuTime

ThreadMXBean.getCurrentThreadCpuTime介绍

暂无

代码示例

代码示例来源:origin: aragozin/jvm-tools

public long getCurrentThreadCpuTime() {
  return beanX.getCurrentThreadCpuTime();
}

代码示例来源:origin: org.gridkit.jvmtool/sjk-stacktrace

public long getCurrentThreadCpuTime() {
  return beanX.getCurrentThreadCpuTime();
}

代码示例来源:origin: org.graalvm.compiler/compiler

/**
 * Returns the total CPU time for the current thread in nanoseconds. The returned value is of
 * nanoseconds precision but not necessarily nanoseconds accuracy. If the implementation
 * distinguishes between user mode time and system mode time, the returned CPU time is the
 * amount of time that the current thread has executed in user mode or system mode.
 *
 * @return the total CPU time for the current thread if CPU time measurement is enabled;
 *         {@code -1} otherwise.
 *
 * @throws UnsupportedOperationException if the Java virtual machine does not
 *             {@linkplain #isCurrentThreadCpuTimeSupported() support} CPU time measurement for
 *             the current thread
 */
public static long getCurrentThreadCpuTime() {
  JMXService jmx = JMXService.instance;
  if (jmx == null) {
    throw new UnsupportedOperationException();
  }
  return jmx.getCurrentThreadCpuTime();
}

相关文章