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
Modifier and Type Method Description longdelay(long nanoSeconds)Delay for specified number of nano seconds.voiddoCosine(double angle)Perform a somewhat CPU time intensive function.voiddoSine(double angle)Perform a somewhat CPU time intensive function.voidprofileTestUsingBusyWaiting()Test the Profile class using busy waiting.voidprofileTestUsingTrigFunctions()Test the Profile class using sine and cosine.voidstartOnly()Calls start, but not end.voidtestFailureModes()Test handling of inappropriate calling sequences.
-
Constructor Details
-
ProfileTest
public ProfileTest()
-
-
Method Details
-
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
Test the Profile class using busy waiting.- Throws:
InterruptedException- if that happens; this test has failed
-
delay
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.
-