From 56dc348cc88bf44c4a677db0f8d4bbf48fd2ca6d Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Tue, 3 Jun 2025 11:18:11 -0700 Subject: [PATCH] utils: add additional guards for Tracing (#8810) The addition JobSystem.cpp allows for defining FILAMENT_TRACING_ENABLED across targets. Addingin FILAMENT_TRACING_ENABLED to the #if in Tracing.h prevents perfetto from being included. --- libs/utils/include/private/utils/Tracing.h | 4 ++-- libs/utils/src/JobSystem.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/utils/include/private/utils/Tracing.h b/libs/utils/include/private/utils/Tracing.h index 9ea253499e..4c872d1f1f 100644 --- a/libs/utils/include/private/utils/Tracing.h +++ b/libs/utils/include/private/utils/Tracing.h @@ -30,9 +30,9 @@ # define FILAMENT_APPLE_SYSTRACE 0 #endif -#if defined(__ANDROID__) +#if defined(__ANDROID__) && FILAMENT_TRACING_ENABLED # include -#elif defined(__APPLE__) && FILAMENT_APPLE_SYSTRACE +#elif defined(__APPLE__) && FILAMENT_APPLE_SYSTRACE && FILAMENT_TRACING_ENABLED # include #else diff --git a/libs/utils/src/JobSystem.cpp b/libs/utils/src/JobSystem.cpp index 179796921c..8733fb96ce 100644 --- a/libs/utils/src/JobSystem.cpp +++ b/libs/utils/src/JobSystem.cpp @@ -14,8 +14,13 @@ * limitations under the License. */ +// TODO: Clean-up. We shouldn't need this #ifndef here, but a client has requested that perfetto be +// disabled due to size increase. In their case, this flag would be defined across targets. Hence +// we guard below with an #ifndef. +#ifndef FILAMENT_TRACING_ENABLED // Note: The overhead of TRACING is not negligible especially with parallel_for(). #define FILAMENT_TRACING_ENABLED false +#endif // when FILAMENT_TRACING_ENABLED is true, enables even heavier tracing #define HEAVY_TRACING 0