MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
This table summarizes the differences between the frequentist and fixed time
experiments.

Frequentist time
experiment

Fixed time experiment

Warm-up measurements 4 by default, but
configurable through
TimeExperiment.limiti
ngSamplingError

0 by default, but
configurable through
TimeExperiment.withFi
xedSampleSize
Number of samples Between 4 and 256 by
default, but configurable
through
TimeExperiment.limiti
ngSamplingError

Defined during experiment
construction

Relative margin of error 5% by default, but
configurable through
TimeExperiment.limiti
ngSamplingError

Not applicable

Confidence level 95% by default, but
configurable through
TimeExperiment.limiti
ngSamplingError

Not applicable

Framework behavior for
invalid test result

Stops measuring a test and
moves to the next one

Collects specified number of
samples

Write Performance Tests with Measurement Boundaries


If your class-based tests derive from matlab.perftest.TestCase instead of
matlab.unittest.TestCase, then you can use the startMeasuring and
stopMeasuring methods or the keepMeasuring method multiple times to define
boundaries for performance test measurements. If a test method has multiple calls to
startMeasuring, stopMeasuring and keepMeasuring, then the performance
framework accumulates and sums the measurements. The performance framework does
not support nested measurement boundaries. If you use these methods incorrectly in a
Test method and run the test as a TimeExperiment, then the framework marks the
measurement as invalid. Also, you still can run these performance tests as unit tests. For
more information, see “Test Performance Using Classes” on page 33-189.

33 Unit Testing

Free download pdf