public interface RuntimeInterface
System.nanoTime()
to measure the runtime of an operation.
Before the operation is started, you can obtain the start time:
startTime = System.nanoTime()
.
After the operation is completed, you can obtain the end time:
endTime = System.nanoTime()
.
Run Time is then:
runTime = endTime - startTime
.
Modifier and Type | Method and Description |
---|---|
void |
addRuntime(long runTime)
This method is used to add a runtime.
|
double |
getAverageRunTime()
This method is used to obtain the average runtime.
|
long |
getLastRunTime()
This method is used to retrieve the last runtime.
|
long[] |
getRunTimes()
This method returns an array of long values representing the last 10 runtimes.
|
void |
resetRunTimes()
This method is used to reset all 10 linear search times to zero.
|
long getLastRunTime()
long[] getRunTimes()
void resetRunTimes()
void addRuntime(long runTime)
runTime
- a long value representing the runtime in nanoseconds.double getAverageRunTime()