Example usage for java.lang.management ThreadMXBean isCurrentThreadCpuTimeSupported

List of usage examples for java.lang.management ThreadMXBean isCurrentThreadCpuTimeSupported

Introduction

In this page you can find the example usage for java.lang.management ThreadMXBean isCurrentThreadCpuTimeSupported.

Prototype

public boolean isCurrentThreadCpuTimeSupported();

Source Link

Document

Tests if the Java virtual machine supports CPU time measurement for the current thread.

Usage

From source file:com.thoughtworks.go.server.service.builders.KillAllChildProcessTaskBuilderTest.java

public long getSystemTime() {
    ThreadMXBean bean = ManagementFactory.getThreadMXBean();
    return bean.isCurrentThreadCpuTimeSupported()
            ? (bean.getCurrentThreadCpuTime() - bean.getCurrentThreadUserTime())
            : 0L;//from   w  ww .  j ava2  s.c o m
}