|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.MiToBo.tools.system.UserTime
public class UserTime
This is a stopwatch to measure elapsed user or real time used.
If the proper native library is availabe and is requested user time is
elapsed. Otherwith real time is elapsed.
If you like to use this class you must set the VM option
-Djava.library.path
to the directory where the native library
resides.
The native library is
JNI_time.dll
for Windows,libJNI_time.so
for Linux,libJNI_time.jnilib
for Mac OS X.
Field Summary | |
---|---|
private static boolean |
debug
For internal use. |
(package private) static boolean |
haveJNI
Were we able to load the JNI library? |
(package private) float |
start
Variable to save start value. |
(package private) long |
startReal
Variable to save real start value. |
(package private) float |
ticks
Variable to remember ticks. |
(package private) static java.lang.String |
timeLib
Basename of the JNI library. |
private boolean |
useJNI
Does this instance use JNI and thus user time? |
Constructor Summary | |
---|---|
UserTime()
Creates a new time object and starts the clock. |
|
UserTime(boolean useUsertime)
Creates a new time object and starts the clock elapsing real time. |
Method Summary | |
---|---|
double |
getElapsedTime()
Returns the elapsed time since last reset (or invoking the constructor) in seconds |
java.lang.String |
getOperation()
Return UserTime or RealTime depending on mode of operation |
private long |
getTicks()
Declaration of native method for getting ticks. |
private float |
getUserTime()
Declaration of native method for user time measurement. |
void |
reset()
Reset time |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static boolean debug
static boolean haveJNI
float start
long startReal
float ticks
static final java.lang.String timeLib
private boolean useJNI
Constructor Detail |
---|
public UserTime()
public UserTime(boolean useUsertime)
useUsertime
is true and the runtime
library is available, otherwise the real time.
Method Detail |
---|
public double getElapsedTime()
public java.lang.String getOperation()
private long getTicks()
private float getUserTime()
public void reset()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |