|
11 | 11 | #ifndef O2_FRAMEWORK_SIGNPOST_H_ |
12 | 12 | #define O2_FRAMEWORK_SIGNPOST_H_ |
13 | 13 |
|
| 14 | +#include "Framework/CompilerBuiltins.h" |
14 | 15 | #include <atomic> |
15 | 16 | #include <array> |
16 | 17 | #ifdef __APPLE__ |
@@ -460,22 +461,22 @@ void _o2_log_set_stacktrace(_o2_log_t* log, int stacktrace) |
460 | 461 | // they are compatible between the two implementations, we also use remove_engineering_type to remove |
461 | 462 | // the engineering types from the format string, so that we can use the same format string for both. |
462 | 463 | #define O2_SIGNPOST_EVENT_EMIT(log, id, name, format, ...) __extension__({ \ |
463 | | - if (O2_SIGNPOST_ENABLED_MAC(log)) { \ |
| 464 | + if (O2_BUILTIN_UNLIKELY(O2_SIGNPOST_ENABLED_MAC(log))) { \ |
464 | 465 | O2_SIGNPOST_EVENT_EMIT_MAC(log, id, name, format, ##__VA_ARGS__); \ |
465 | | - } else if (private_o2_log_##log->stacktrace) { \ |
| 466 | + } else if (O2_BUILTIN_UNLIKELY(private_o2_log_##log->stacktrace)) { \ |
466 | 467 | _o2_signpost_event_emit(private_o2_log_##log, id, name, remove_engineering_type(format).data(), ##__VA_ARGS__); \ |
467 | 468 | } \ |
468 | 469 | }) |
469 | 470 | #define O2_SIGNPOST_START(log, id, name, format, ...) \ |
470 | | - if (O2_SIGNPOST_ENABLED_MAC(log)) { \ |
| 471 | + if (O2_BUILTIN_UNLIKELY(O2_SIGNPOST_ENABLED_MAC(log))) { \ |
471 | 472 | O2_SIGNPOST_START_MAC(log, id, name, format, ##__VA_ARGS__); \ |
472 | | - } else if (private_o2_log_##log->stacktrace) { \ |
| 473 | + } else if (O2_BUILTIN_UNLIKELY(private_o2_log_##log->stacktrace)) { \ |
473 | 474 | _o2_signpost_interval_begin(private_o2_log_##log, id, name, remove_engineering_type(format).data(), ##__VA_ARGS__); \ |
474 | 475 | } |
475 | 476 | #define O2_SIGNPOST_END(log, id, name, format, ...) \ |
476 | | - if (O2_SIGNPOST_ENABLED_MAC(log)) { \ |
| 477 | + if (O2_BUILTIN_UNLIKELY(O2_SIGNPOST_ENABLED_MAC(log))) { \ |
477 | 478 | O2_SIGNPOST_END_MAC(log, id, name, format, ##__VA_ARGS__); \ |
478 | | - } else if (private_o2_log_##log->stacktrace) { \ |
| 479 | + } else if (O2_BUILTIN_UNLIKELY(private_o2_log_##log->stacktrace)) { \ |
479 | 480 | _o2_signpost_interval_end(private_o2_log_##log, id, name, remove_engineering_type(format).data(), ##__VA_ARGS__); \ |
480 | 481 | } |
481 | 482 | #else // This is the release implementation, it does nothing. |
|
0 commit comments