Basics

Profiling is a procedure for analyzing the runtime behavior of a software application. The aim is to identify performance bottlenecks and inefficient code in order to improve the performance of the application.

The TwinCAT 3 PLC Profiler is based on the technology of the TE1010 | TC3 Realtime Monitor and is specially tailored to the requirements of PLC development. Profiling provides answers to questions such as:

Measuring principle: instrumentation

The “Instrumentation” measurement principle is used for the TwinCAT 3 PLC Profiler. Measurement marks (entry and exit methods) are automatically inserted into the compiled code during compilation. The PLC source code is not changed. The measurement marks record the execution times of individual function blocks and thus enable the precise assignment of runtimes to program elements.

Removing the profiler file from the PLC project removes all instrumentation.

Important terms

Term

Meaning

Total Time

The elapsed time of an element including the elapsed time of all sub-elements.

Own Time

The elapsed time of an element excluding the elapsed time of all sub-elements. Indicates how much time is spent in the element itself.

Task execution time

The total time spent on all program blocks that are called by a task.

Influence of the measurement marks on the measurement results

The measurement marks that are inserted into the code during instrumentation cause additional runtime overhead. This can influence the measured execution times. Areas of the code with many instrumented elements may appear over-represented in the analysis, as the measurement methods themselves take time.

The profiler offers two correction modes to subtract the runtime component of the measurement marks from the measured values:

Variability of the measured values

The measured values may vary between cycles. The reasons for this include dynamic CPU clocking and other system factors. The variability can be reduced by the following measures:

Effects on the system

Consider the following effects on the system when using the profiler: