package umontreal.iro.lecuyer.util;
/**
* Extends the {@link AbstractChrono} class to compute the global CPU time used
* by the Java Virtual Machine. This includes CPU time taken by any thread,
* including the garbage collector, class loader, etc.
*
*
* Part of this class is implemented in the C language and the
* implementation is unfortunately operating system-dependent.
* The C functions for the current class have been compiled on a 32-bit machine
* running Linux. For a platform-independent CPU timer (valid only with Java-1.5 or later),
* one should use the class {@link ThreadCPUTimeChrono} which is programmed
* directly in Java.
*
*/
public class GlobalCPUTimeChrono extends AbstractChrono {
private static boolean ssjUtilLoaded = false;
private static native void Heure (long[] tab);
protected void getTime (long[] tab) {
if (!ssjUtilLoaded) {
// We cannot load the library in a static block
// since the subclass ChronoSingleThread does not
// need the native method.
System.loadLibrary ("ssjutil");
ssjUtilLoaded = true;
}
Heure (tab);
}
/**
* Constructs a Chrono object and initializes it to zero.
*
*/
public GlobalCPUTimeChrono() {
init();
}
}
Ads help maintain this website.