Creates a performance timer that runs test functions a number of times to generate timing samples, and provides performance statistics (minimum, maximum, average, and standard deviation).
| Instance Method Summary | |
getNumSamples() ⇒ number | |
getTimeoutInterval() ⇒ number | |
isDiscardOutliers() ⇒ boolean | |
run(?Function testFn) ⇒ ?ObjectExecutes the test function the required number of times (or until the test run exceeds the timeout interval, whichever comes first). Returns an object containing the following:
{
'average': average execution time (ms)
'count': number of executions (may be fewer than expected due to timeout)
'maximum': longest execution time (ms)
'minimum': shortest execution time (ms)
'standardDeviation': sample standard deviation (ms)
'total': total execution time (ms)
}
| |
setDiscardOutliers(boolean discard)Sets whether to ignore the smallest and the largest values when computing stats. | |
setNumSamples(number numSamples)Sets the number of times the test function will be run. | |
setTimeoutInterval(number timeoutInterval)Sets the number of milliseconds after which the test times out. | |