edu.ucla.util
Class JVMProfiler

Object
  extended by JVMProfiler

public class JVMProfiler
extends Object

This code comes from Java Tip 92 on Javaworld.com (but was modified quite a bit) see http://www.javaworld.com/javaworld/javatips/jw-javatip92.html

It is an interface into the JVM Profiler and allows the cpu time for the current thread to be obtained (and possibly other things to be added later).

The program must use the command line java -Xrunjvm_profiler application


Field Summary
static long nanosPerMilli
           
 
Constructor Summary
JVMProfiler()
           
 
Method Summary
static long getCurrentThreadCpuTime_native()
          This will throw an unsatisfied link exception if loaded is not true.
static long getCurrentThreadCpuTime()
          Will return the CPU Time of the thread or else will return 0 if the profiler cannot be interfaced with.
static long getCurrentThreadCpuTimeMS()
          Will return the CPU Time of the thread or else will return 0 if the profiler cannot be interfaced with.
static boolean loaded()
           
static void main(String[] args)
          Test/debug
static boolean profilerRunning_native()
          Will return true if the command line to start the profiler was set, otherwise will return false.
static boolean profilerRunning()
          Will return true if the command line to start the profiler was set, otherwise will return false.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nanosPerMilli

public static final long nanosPerMilli
See Also:
Constant Field Values
Constructor Detail

JVMProfiler

public JVMProfiler()
Method Detail

loaded

public static boolean loaded()

getCurrentThreadCpuTime_native

public static long getCurrentThreadCpuTime_native()
This will throw an unsatisfied link exception if loaded is not true.


profilerRunning_native

public static boolean profilerRunning_native()
Will return true if the command line to start the profiler was set, otherwise will return false.

Will throw an unsatisfied link exception if loaded is not true.


getCurrentThreadCpuTime

public static long getCurrentThreadCpuTime()
Will return the CPU Time of the thread or else will return 0 if the profiler cannot be interfaced with. The cpu time is in nanoseconds.


getCurrentThreadCpuTimeMS

public static long getCurrentThreadCpuTimeMS()
Will return the CPU Time of the thread or else will return 0 if the profiler cannot be interfaced with. The cpu time is in milliseconds (integer division used).


profilerRunning

public static boolean profilerRunning()
Will return true if the command line to start the profiler was set, otherwise will return false.


main

public static void main(String[] args)
Test/debug

Since:
20060315


Copyright 2010 UCLA Automated Reasoning Group