startMeasuring
Class: matlab.perftest.TestCase
Namespace: matlab.perftest
Designate start of measurement boundary
Description
startMeasuring(
designates the
start of a measurement boundary. Invoke this method and the
testcase
)stopMeasuring
method to restrict measurements to the code
between the startMeasuring
and stopMeasuring
method calls. Defining this boundary allows you to exclude setup, verification, and
teardown code from the measurement.
The performance framework permits multiple, nonnested calls to
the startMeasuring
and stopMeasuring
methods within each
method that is tagged with the Test
attribute. When creating bounded
performance tests, keep the following in mind:
A test method that calls the
startMeasuring
method must call thestopMeasuring
method in the scope of the same test method.A call to the
startMeasuring
method must have a subsequent call tostopMeasuring
method in the scope of the same test method. Similarly, a call to thestopMeasuring
method must have a preceding call tostartMeasuring
.You cannot call the
startMeasuring
andstopMeasuring
methods inside awhile
loop that has thekeepMeasuring
method in the condition. Similarly, you cannot have awhile
loop that has thekeepMeasuring
condition between calls tostartMeasuring
andstopMeasuring
.If a test method has multiple calls to
startMeasuring
andstopMeasuring
, then the performance framework accumulates and sums the measurements.
If the framework encounters unsupported use of startMeasuring
and stopMeasuring
within a test method, it marks the corresponding
MeasurementResult
instance invalid.
startMeasuring(
designates the start of a measurement boundary and labels the measurement with testcase
,label
)label
. Specifying a measurement boundary with a label is similar to specifying one without a label. A call to startMeasuring
with a label must have a subsequent call to stopMeasuring
with the same label in the scope of the same test method. If a test method has multiple boundaries with the same label, then the performance framework accumulates the measurements by label and computes the sum. The performance framework does not support nested measurement boundaries.
The label is appended in angle brackets to the test element name in the Samples
and TestActivity
properties of the MeasurementResult
.
Input Arguments
Examples
Version History
Introduced in R2016a