SPRUJG0B December 2024 – November 2025 F29H850TU , F29H859TU-Q1
The user can use different profiling techniques to benchmark their application code. With optimization enabled, the compiler can re-order operations and perform inlining, and so forth. This can sometimes make it difficult to understand exactly what was profiled, and whether what was profiled was indeed what the user wanted to profile.
"__builtin_instrumentation_label()" is a helpful label to use before and after the code that needs to be profiled (see code block below). However, it is not a perfect code barrier when optimization is enabled. The C29 compiler has no true code movement barrier other than to outline the code block into its own function, mark it noinline to disable inlining, and call that function.
// Example 1
__builtin_instrumentation_label("profiling_start");
function1();
__builtin_instrumentation_label("profiling_stop");
// Example 2
__builtin_instrumentation_label("profiling_start");
// code being profiled
..
..
__builtin_instrumentation_label("profiling_stop");