4.7.2 Optimization Utilities Reference
The following macros are meant to avoid certain optimizations the
compiler might perform on your test code.
- C Optimization Macro: MICRO_BENCHMARK_DO_NOT_OPTIMIZE (lvalue) ¶
-
Preconditions:
- Function scope macro.
Effects:
- Simulate read+write on lvalue.
Postconditions:
- The compiler should not optimize lvalue away.
- C Optimization Macro: MICRO_BENCHMARK_COMPILER_BARRIER () ¶
-
Preconditions:
- Function scope macro.
Effects:
- Memory fence.
Postconditions:
- The compiler should treat all memory as clobbered.
- C Utility Function: void micro_benchmark_do_not_optimize (const void *dummy) ¶
-
Preconditions:
- None.
Effects:
- “Compatibility” implementation of the previous macros.
Postconditions:
- A wish of hope and not much more.