Package org.djutils.profile
Class ProfileTest
- java.lang.Object
-
- org.djutils.profile.ProfileTest
-
public class ProfileTest extends Object
Test the Profile class.
-
-
Constructor Summary
Constructors Constructor Description ProfileTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
delay(long nanoSeconds)
Delay for specified number of nano seconds.void
doCosine(double angle)
Perform a somewhat CPU time intensive function.void
doSine(double angle)
Perform a somewhat CPU time intensive function.void
profileTestUsingBusyWaiting()
Test the Profile class using busy waiting.void
profileTestUsingTrigFunctions()
Test the Profile class using sine and cosine.void
startOnly()
Calls start, but not end.void
testFailureModes()
Test handling of inappropriate calling sequences.
-
-
-
Method Detail
-
profileTestUsingTrigFunctions
public void profileTestUsingTrigFunctions()
Test the Profile class using sine and cosine.
-
doSine
public void doSine(double angle)
Perform a somewhat CPU time intensive function.- Parameters:
angle
- double; the argument
-
doCosine
public void doCosine(double angle)
Perform a somewhat CPU time intensive function.- Parameters:
angle
- double; the argument
-
profileTestUsingBusyWaiting
public void profileTestUsingBusyWaiting() throws InterruptedException
Test the Profile class using busy waiting.- Throws:
InterruptedException
- if that happens; this test has failed
-
delay
public long delay(long nanoSeconds) throws InterruptedException
Delay for specified number of nano seconds.
Derived from https://stackoverflow.com/questions/11498585/how-to-suspend-a-java-thread-for-a-small-period-of-time-like-100-nanoseconds- Parameters:
nanoSeconds
- long; time to delay in nano seconds- Returns:
- long; number of iterations in the busy waiting loop
- Throws:
InterruptedException
- If that happens; this test fails
-
testFailureModes
public void testFailureModes()
Test handling of inappropriate calling sequences.
-
startOnly
public void startOnly()
Calls start, but not end.
-
-