goog.testing.PerformanceTimer
Classgoog.testing.PerformanceTimer(opt_numSamples, opt_timeoutInterval)
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).
opt_numSamples
{number
=}
opt_timeoutInterval
{number
=}
goog.testing.PerformanceTimer.Task
ClassA task for the performance timer to measure. Callers can specify optional setUp and tearDown methods to control state before and after each run of the test function. … more
.createResults(samples)
Creates a performance timer results object by analyzing a given array of sample timings.
samples
{Array
.<number
>}
Object
}
.getNumSamples()
number
}
.getTimeoutInterval()
number
}
.isDiscardOutliers()
boolean
}
.run(testFn)
Executes 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) }
testFn
{Function
}
Object
}
.runTask(task)
Executes the test function of the specified task as described in {@code run}. In addition, if specified, the set up and tear down functions of the task are invoked before and after each invocation of the test function.
task
{goog.testing.PerformanceTimer.Task
}
Object
}
.setDiscardOutliers(discard)
Sets whether to ignore the smallest and the largest values when computing stats.
discard
{boolean
}
.setNumSamples(numSamples)
Sets the number of times the test function will be run.
numSamples
{number
}
.setTimeoutInterval(timeoutInterval)
Sets the number of milliseconds after which the test times out.
timeoutInterval
{number
}