public interface TestTimesInterface
This interface will be used to organize and manage test times that are measured for specific operations. Implementing this interface requires the following:
long values.
double values.
Users of an implementation of this interface calculate time measurements as follows:
long startTime = System.nanoTime().
long endTime = System.nanoTime().
long testTime = endTime - startTime.
| Modifier and Type | Interface and Description |
|---|---|
static class |
TestTimesInterface.MemoryUnits
Memory usage is measured in Bytes.
|
static class |
TestTimesInterface.TimeUnits
Run times are measured in Nano Seconds.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTestTime(long runTime)
This method is used to add a test time and capture the current memory usage.
|
double |
getAverageMemoryUsage()
This method is used to obtain the average memory usage.
|
double |
getAverageTestTime()
This method is used to obtain the average test time.
|
double |
getLastMemoryUsage()
This method is used to retrieve the last memory usage.
|
double |
getLastTestTime()
This method is used to retrieve the last test time.
|
TestTimesInterface.MemoryUnits |
getMemoryUnits()
This method is used to obtain the current
TestTimesInterface.MemoryUnits configured for the RunTime
class. |
double[] |
getMemoryUsages()
This method returns an array of double values representing the last 10 memory usages
converted to the configured
TestTimesInterface.MemoryUnits. |
double[] |
getTestTimes()
This method returns an array of double values representing the last 10 test times
converted to the configured
TestTimesInterface.TimeUnits. |
TestTimesInterface.TimeUnits |
getTimeUnits()
This method is used to obtain the current
TestTimesInterface.TimeUnits configured for the RunTime
class. |
void |
resetTestTimes()
This method is used to reset all 10 linear search times to zero.
|
void |
setMemoryUnits(TestTimesInterface.MemoryUnits memoryUnits)
This method is used to configure the desired
TestTimesInterface.MemoryUnits. |
void |
setTimeUnits(TestTimesInterface.TimeUnits timeUnits)
This method is used to configure the desired
TestTimesInterface.TimeUnits. |
TestTimesInterface.TimeUnits getTimeUnits()
TestTimesInterface.TimeUnits configured for the RunTime
class. Please note that the default TimeUnits is NanoSecondsTimeUnits.void setTimeUnits(TestTimesInterface.TimeUnits timeUnits)
TestTimesInterface.TimeUnits.timeUnits - The desired TimeUnitsTestTimesInterface.MemoryUnits getMemoryUnits()
TestTimesInterface.MemoryUnits configured for the RunTime
class. Please note that the default MemoryUnits is BytesMemoryUnits.void setMemoryUnits(TestTimesInterface.MemoryUnits memoryUnits)
TestTimesInterface.MemoryUnits.memoryUnits - The desired MemoryUnitsdouble getLastTestTime()
TestTimesInterface.TimeUnits,
or 0.double getLastMemoryUsage()
TestTimesInterface.MemoryUnits,
or 0.0.double[] getTestTimes()
TestTimesInterface.TimeUnits. If less than 10 test times are available,
the remaining test times should be zero. If more than 10 test times have been added, the array
should contain the last 10 test times.double[] getMemoryUsages()
TestTimesInterface.MemoryUnits.
If less than 10 memory usages are available, the remaining
memory usages should be zero. If more than 10 memory usages have been added, the array
should contain the last 10 memory usages.void resetTestTimes()
void addTestTime(long runTime)
runTime - a long value representing the test time in nanoseconds.double getAverageTestTime()
TestTimesInterface.TimeUnits or 0.double getAverageMemoryUsage()
TestTimesInterface.MemoryUnits, or 0.0.