public class UserTime extends Object
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.Modifier and Type | Field and Description |
---|---|
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 String |
timeLib
Basename of the JNI library.
|
private boolean |
useJNI
Does this instance use JNI and thus user time?
|
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
double |
getElapsedTime()
Returns the elapsed time since last reset (or invoking the constructor) in seconds
|
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
|
static boolean haveJNI
static final String timeLib
private boolean useJNI
private static boolean debug
float start
float ticks
long startReal
public UserTime()
public UserTime(boolean useUsertime)
useUsertime
is true and the runtime
library is available, otherwise the real time.public double getElapsedTime()
public void reset()
public String getOperation()
private float getUserTime()
private long getTicks()
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.