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.timeituses a MEX configuration object withIntegrityChecksandResponsivenessChecksproperties set tofalse.coder.timeitmeasures the execution times for multiple runs and returns the median execution time.The
coder.timeitfunction uses internal heuristics to determine the number of runs.coder.timeitexcludes 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
Name-Value 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
MinRunsandMinTimeto 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
libordllbuild types than with themexbuild type.When using multiple instances of MATLAB and running
coder.timeitfrom the same folder, use theWorkDirectoryname-value argument to specify different folders.
Version History
Introduced in R2024b