All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.codahale.metrics.jvm.CpuTimeClock Maven / Gradle / Ivy

Go to download

A set of classes which allow you to monitor critical aspects of your Java Virtual Machine using Metrics.

The newest version!
package com.codahale.metrics.jvm;

import com.codahale.metrics.Clock;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;

/**
 * A clock implementation which returns the current thread's CPU time.
 */
public class CpuTimeClock extends Clock {

    private static final ThreadMXBean THREAD_MX_BEAN = ManagementFactory.getThreadMXBean();

    @Override
    public long getTick() {
        return THREAD_MX_BEAN.getCurrentThreadCpuTime();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy