coder.timeit
Syntax
Description
[
measures the execution time of the code generated from the MATLAB® function t
,trObj
,benchObj
] = coder.timeit(fcnName
,numOutputs
,runtimeArgs
)fcnName
. The generated code is executed with
input arguments runtimeArgs
and returns numOutputs
output arguments.
By default,
coder.timeit
uses a MEX configuration object withIntegrityChecks
andResponsivenessChecks
properties set tofalse
.coder.timeit
measures the execution times for multiple runs and returns the median execution time.The
coder.timeit
function uses internal heuristics to determine the number of runs.coder.timeit
excludes the timing overhead incurred by the data transfer between MATLAB and generated code execution.
[~,~,
creates a benchObj
] = coder.timeit(fcnName
,numOutputs
,runtimeArgs
,"generatecodeonly")coder.performance.Benchmarkable
object that can be used to time
fcnName
multiple times with different inputs without having to
regenerate code every time. The function packages the generated code inside a wrapper
object benchObj
.
[
specifies additional options using one or more name-value arguments.t
,trObj
,benchObj
] = coder.timeit(___,Name=Value
)
Examples
Input Arguments
Output Arguments
Tips
To achieve consistent results, make sure no other computation-intensive processes are running on the machine where you measure the execution time of the MATLAB function or the generated code.
Use the name-value arguments
MinRuns
andMinTime
to can control the number of times to run the generated code.The code generator takes longer to measure the execution time of code generated with
lib
ordll
build types than with themex
build type.When using multiple instances of MATLAB and running
coder.timeit
from the same folder, use theWorkDirectory
name-value argument to specify different folders.
Version History
Introduced in R2024b