stopMeasuring
类: matlab.perftest.TestCase
命名空间: matlab.perftest
指定测量结束边界
说明
stopMeasuring(
指定测量结束边界。调用此方法和 testcase
)startMeasuring
方法,以限制只测量 startMeasuring
和 stopMeasuring
方法调用之间的代码。定义此边界以允许在测量中排除设置、验证和拆解代码。
性能框架允许在 Test
属性标记的每个方法中对 startMeasuring
和 stopMeasuring
方法进行多次非嵌套调用。创建有界性能测试时,请记住以下几点:
调用
startMeasuring
方法的测试方法必须在同一测试方法的作用域内调用stopMeasuring
方法。调用
startMeasuring
方法之后,必须在同一测试方法的作用域内调用stopMeasuring
方法。同样,调用stopMeasuring
方法之前必须先调用startMeasuring
。您不能在其条件中具有
keepMeasuring
方法的while
循环内调用startMeasuring
和stopMeasuring
方法。同样,您不能在对startMeasuring
和stopMeasuring
的调用之间放置一个具有keepMeasuring
条件的while
循环。如果测试方法多次调用
startMeasuring
和stopMeasuring
,则性能框架会对测量值进行累加并求和。
如果框架在某个测试方法中遇到不支持的 startMeasuring
和 stopMeasuring
用法,它会将对应的 MeasurementResult
实例标记为无效。
输入参数
示例
版本历史记录
在 R2016a 中推出