Run set of tests for performance measurement
results = runperf
runs all the tests in your current folder
for performance measurements and returns an array of
matlab.perftest.TimeResult
objects. Each element in
results
corresponds to an element in the test suite.
The performance test framework runs the tests using a variable number of
measurements to reach a sample mean with a 0.05 relative margin of error within a
0.95 confidence level. It runs the tests four times to warm up the code, and then
between 4 and 256 times to collect measurements that meet the statistical
objectives. If the sample mean does not meet the 0.05 relative margin of error
within a 0.95 confidence level after 256 test runs, the performance test framework
stops running the test and displays a warning. In this case, the
matlab.perftest.TimeResult
object contains information for the 4
warm-up runs and 256 measurement runs.
The runperf
function provides a simple way to run a
collection of tests as a performance experiment.
results = runperf(
runs a set of tests with additional options specified by one or more
tests
,Name,Value
)Name,Value
pair arguments.
To customize the statistical objectives of the performance test, use the
TimeExperiment
class to construct
and run the performance test.
When you use shared test fixtures in your tests and specify the input to the
runperf
function as a string array or cell array of
character vectors, the testing framework sorts the array to reduce shared
fixture setup and teardown operations. As a result, the tests might run in an
order that is different from the order of elements in the input array. For more
information, see sortByFixtures
.
When you write class-based tests, you can run your tests as a standalone application (requires MATLAB Compiler™). Compiling performance tests is not currently supported. For more information, see Compile MATLAB Unit Tests.
To create a test suite explicitly, you can use the testsuite
function or the matlab.unittest.TestSuite
methods to
create a suite. Then, you can run your performance test with the run
method of your specified TimeExperiment
.
comparisonPlot
| matlab.perftest.FrequentistTimeExperiment
| matlab.unittest.measurement.MeasurementResult
| runtests