execution-time profiling for pil
during a processor-in-the-loop (pil) execution, you can produce a profile of the execution times for code generated from entry-point functions. the software calculates execution times from data that is obtained through instrumentation probes added to the pil application.
use the execution-time profile to check whether your code runs within the required time on your target hardware:
if code execution overruns, look for ways to reduce execution time.
if your code easily meets time requirements, consider enhancing functionality to exploit the unused processing power.
at the end of the pil execution, you can:
view a report of code execution times.
use the simulation data inspector to view and compare plots of function execution times.
access and analyze execution time profiling data.
note
pil execution supports multiple entry-point functions. an entry-point function can call another entry-point function as a subfunction. however, the software generates execution-time profiles only for functions that are called at the entry-point level. the software does not generate execution-time profiles for entry-point functions that are called as subfunctions by other entry-point functions.
note
when using pil execution, make sure that the benchmarking
option in
gpu coder™ settings is false
. executing pil with benchmarking results
in compilation errors.
generate execution-time profile
before running a processor-in-the-loop (pil) execution, enable execution-time profiling:
to open the gpu coder app, on the matlab® toolstrip apps tab, under code generation, click the app icon.
to open your project, click and then click
open existing project
. select the project.on the generate code page, click verify code.
select the enable entry point execution profiling check box.
or, from the command window, specify the codeexecutionprofiling
property of your coder.gpuconfig
object. for
example:
cfg.codeexecutionprofiling = true;
view execution times
when you run a pil execution with execution time profiling enabled, the software generates a message in the test output tab. for example:
### starting application: 'codegen\lib\mandelbrot_count\pil\mandelbrot_count.elf' to terminate execution: clear mandelbrot_count_pil ### launching application mandelbrot_count.elf... execution profiling data is available for viewing. open simulation data inspector. execution profiling report available after termination.
to open the code execution profiling report:
click the
stop pil verification
link.the software terminates the execution process and displays a new link.
execution profiling report: report(getcoderexecutionprofile('mandelbrot_count'))
click the new link.
the report provides:
a summary.
information about profiled code sections, which includes time measurements for:
the
entry_point_fn
_initialize
function, for example,mandelbrot_count_initialize
.the entry-point function, for example,
mandelbrot_count
.the
entry_point_fn
_terminate
function, for example,mandelbrot_count_terminate
.
definitions for metrics.
by default, the report displays time in ticks. you can specify the time unit and numeric
display format. the report displays time in seconds only if the timer is calibrated, that
is, the number of timer ticks per second is established. for example, if your processor
speed is 2.035 ghz, specify the number of timer ticks per second by using the
timertickspersecond
property. to display time in microseconds
(10-6 seconds), use the (embedded coder)
command.
executionprofile=getcoderexecutionprofile('mandelbrot_count'); % create workspace var executionprofile.timertickspersecond = 2035 * 1e6; report(executionprofile, ... 'units', 'seconds', ... 'scalefactor', '1e-06', ... 'numericformat', '%0.3f')
to display measured execution times for a code section, click the simulation data inspector icon on the corresponding row. you can use the simulation data inspector to manage and compare plots from various executions.
the following table lists the information provided in the code section profiles.
column | description |
---|---|
section | name of function from which code is generated. |
maximum execution time | longest time between start and end of code section. |
average execution time | average time between start and end of code section. |
maximum self time | maximum execution time, excluding time in child sections. |
average self time | average execution time, excluding time in child sections. |
calls | number of calls to the code section. |
icon that you click to display the profiled code section. | |
icon that you click to display measured execution times with simulation data inspector. |
see also
functions
- | | | | | |
objects
- |