Skip to Content
X2C Add-on

Execution Time Estimator

How long does your control algorithm take on the target – and which processor is fast enough? The Execution Time Estimator answers both before you write a single line of code to the hardware: it predicts the execution cycles, times and CPU load of your X2C model for all supported processors at once, based on execution cycles measured on the real targets.

Time

Execution time vs. sample time

See the execution time of your model next to its sample time Ts – at the maximum CPU clock of each processor or at the clock your board actually runs at. The worst-case CPU load tells at a glance whether it fits.

In the example, the processors with floating-point unit need at most about half of Ts; those without exceed it many times over – a case for fixed-point blocks.

Execution Time Estimator: estimated execution times of a PMSM speed control on eight processors, compared with the sample time of 50 microseconds, with CPU clock and load per processor
PMSM speed control (29 blocks, Float32), Ts = 50 µs
Cycles

Execution cycles per processor

The second tab shows the estimated CPU cycles of one sample step of your model for every processor – independent of the clock frequency, so you compare the cores themselves.

  • Bar: average
  • Whisker: minimum to maximum (worst case)
  • Linear code: all blocks in every step
  • RTOS code: slower blocks run less often
  • Hatched: incomplete coverage

Blocks without measured data are clearly marked – so you know how far you can trust the estimate.

Execution Time Estimator: estimated execution cycles of a PMSM speed control on eight processors, bars with min-max whiskers, all 29 blocks covered
Estimated cycles: average as bar, minimum to maximum as whisker
Cycles per Block

Where the cycles go

Which blocks take the most cycles on your processor? The list, largest share first, shows where a slower sample time or another implementation pays off.

In the example, three blocks take more than a third of all cycles on the TM4C123.

Execution Time Estimator: worst-case cycles per block on the TM4C123GH6, sorted by share
Worst-case cycles per block on the TM4C123GH6, sorted by share
Use cases

Where the estimate pays off

Before the project

  • Select a processor that is fast enough – without building a test setup for each candidate
  • Find the shortest sample time your control algorithm can achieve
  • Decide between fixed-point and floating-point implementations

During development

  • Check after every model change whether the timing still fits – with one click
  • Move slow parts of the model to a longer sample time and see the effect right away
  • Keep headroom for interrupts, communication and your own code

Want to know more?

The Execution Time Estimator is included in X2C Professional, Plus and Educational. Contact us to learn more.

Contact us

Back to top