JJianliang Wang[Optimize] Reduce trace overhead when recording is disabled
| Files | Last commit | Last update |
|---|---|---|
[Feature] LynxBase standalone -- Implement Independent Trace Event System in LynxBase This change addresses a critical circular dependency between the lynx-base and lynx-trace libraries. Previously, lynx-base relied on the lynx-trace component for its TRACE_EVENT macros, creating a problematic coupling. Key Changes: 1. Decoupling from lynx-trace: The lynx-base library now includes its own implementation for trace events, removing the direct dependency on the lynx-trace component. 2. Injectable Trace Backend: A new service injection pattern has been introduced. Consumers of lynx-base are now responsible for providing a concrete tracing implementation (a "backend") by implementing the LynxBaseTraceService interface and injecting it at runtime. issue:m-6736726571 AutoSubmit:true | 1 year ago | |
[Optimize] Reduce trace overhead when recording is disabled - Add runtime-enabled guards for native, Android Java, and Darwin trace paths so disabled recording exits before expensive bridge and Perfetto work. - Fast-path Darwin wrapper macros through a C runtime-enabled helper and delay UI owner trace string construction until tracing is active. - Remove the scoped native TRACE_EVENT enabled flag so the size impact of destructor-side runtime checks can be measured. - Keep trace-enabled release performance tasks unchanged so optimized trace builds can be measured against real release and release with trace baselines. - Export the runtime-enabled helpers for linked consumers and cover the disabled path with native and Darwin tests. TEST: git diff --check TEST: xcrun --sdk iphoneos clang++ -fsyntax-only -x objective-c++ -std=c++17 -fblocks -fobjc-arc -include Foundation/Foundation.h -DENABLE_TRACE_PERFETTO=1 -I. -Ilynx -Ithird_party/googletest/googletest/include lynx/base/trace/darwin/LynxTraceEvent_unittest.mm TEST: xcrun --sdk iphoneos clang++ -fsyntax-only -x objective-c++ -std=c++17 -fblocks -fobjc-arc -include Foundation/Foundation.h -DENABLE_TRACE_PERFETTO=1 -I. -Ilynx lynx/base/trace/darwin/LynxTraceEvent.mm TEST: xcrun --sdk iphoneos clang++ -fsyntax-only -x objective-c++ -std=c++17 -fblocks -fobjc-arc -include Foundation/Foundation.h -DENABLE_TRACE_PERFETTO=0 -I. -Ilynx lynx/base/trace/darwin/LynxTraceEvent.mm TEST: xcrun --sdk iphoneos clang++ -fsyntax-only -x c++ -std=c++17 -DENABLE_TRACE_PERFETTO=1 -I. -Ilynx -Ithird_party/googletest/googletest/include -Ithird_party/perfetto/sdk -Ithird_party/perfetto -Ithird_party/rapidjson lynx/base/trace/native/trace_event_unittest.cc TEST: platform/android ../../tools/env.sh ./gradlew :BaseDevtool:assembleNoasanRelease SkipChecks: macro, trace-name | 3 months ago | |
[Feature] LynxBase standalone -- Integrate all modules with the standalone LynxBase library Refactors the codebase to make LynxBase a fully independent component, meeting the dependency requirements for all modules. This commit completes the integration of all modules with the `LynxBase` library. Key Changes: 1. Refactor Lynx Log: a. Removed `LLog` implementations (`.java`, `.ets`, `.mm`) from the `lynx` module, forwarding all public APIs to the `LynxBase` library. b. On Android, replaced unused `ILogDelegate` and `ILynxLogService` with `BaseLogDelegate` to bridge the host-injected `AbsLogDelegate`. c. Adapted `LynxLogService` on Android, Darwin, and HarmonyOS to inherit from the `ILynxBaseLogService` interface and be injected via `LynxBaseService`. d. Replaced `logging_android.cc` and `logging_darwin.cc` in the `lynx` module with the implementations from `LynxBase`. 2. Implement Base Trace: a. On Darwin and HarmonyOS, implemented and injected `LynxBaseTraceService` during `LynxEnv` initialization, allowing `LynxBase` to retrieve the trace backend from the service. b. Replaced the `TRACE_EVENT` macro with the internal `BASE_TRACE_EVENT` macro within the `LynxBase` library. 3. Adapt Build System: a. Removed dependencies on the `base` submodule from GN projects. b. On Android, configured all modules to dynamically link the `lynx_base` library and depend on the `LynxBase` component at the platform level. c. On iOS, updated all Podspec targets (e.g., `Lynx`, `LynxDevtool`) to depend on the `LynxBase` podspec instead of `base` source files. d. On HarmonyOS, switched all modules from statically linking `base` source to dynamically linking the `lynx_base` library and depending on its HAR package. e. On Windows, established a static dependency on the `base` static library. f. Configured unit test modules to statically depend on the `base_static` library. 4. Update LynxEnv Initialization: a. Removed legacy `LLog` initialization logic. b. Added injection logic for the `LynxBase` Trace service on Darwin and HarmonyOS. c. Added calls to initialize `LynxBaseEnv` on all platforms. 5. Android Specific: Removed calls to `fml::MessageLoopAndroid::Register(env)` from outside the `LynxBase` library. 6. Symbol Management: Exported necessary symbols from `LynxBase` to support dynamic linking across all components. issue:m-6736726571 SkipChecks:macro AutoSubmit:true | 1 year ago | |
[Feature] LynxBase standalone -- Integrate all modules with the standalone LynxBase library Refactors the codebase to make LynxBase a fully independent component, meeting the dependency requirements for all modules. This commit completes the integration of all modules with the `LynxBase` library. Key Changes: 1. Refactor Lynx Log: a. Removed `LLog` implementations (`.java`, `.ets`, `.mm`) from the `lynx` module, forwarding all public APIs to the `LynxBase` library. b. On Android, replaced unused `ILogDelegate` and `ILynxLogService` with `BaseLogDelegate` to bridge the host-injected `AbsLogDelegate`. c. Adapted `LynxLogService` on Android, Darwin, and HarmonyOS to inherit from the `ILynxBaseLogService` interface and be injected via `LynxBaseService`. d. Replaced `logging_android.cc` and `logging_darwin.cc` in the `lynx` module with the implementations from `LynxBase`. 2. Implement Base Trace: a. On Darwin and HarmonyOS, implemented and injected `LynxBaseTraceService` during `LynxEnv` initialization, allowing `LynxBase` to retrieve the trace backend from the service. b. Replaced the `TRACE_EVENT` macro with the internal `BASE_TRACE_EVENT` macro within the `LynxBase` library. 3. Adapt Build System: a. Removed dependencies on the `base` submodule from GN projects. b. On Android, configured all modules to dynamically link the `lynx_base` library and depend on the `LynxBase` component at the platform level. c. On iOS, updated all Podspec targets (e.g., `Lynx`, `LynxDevtool`) to depend on the `LynxBase` podspec instead of `base` source files. d. On HarmonyOS, switched all modules from statically linking `base` source to dynamically linking the `lynx_base` library and depending on its HAR package. e. On Windows, established a static dependency on the `base` static library. f. Configured unit test modules to statically depend on the `base_static` library. 4. Update LynxEnv Initialization: a. Removed legacy `LLog` initialization logic. b. Added injection logic for the `LynxBase` Trace service on Darwin and HarmonyOS. c. Added calls to initialize `LynxBaseEnv` on all platforms. 5. Android Specific: Removed calls to `fml::MessageLoopAndroid::Register(env)` from outside the `LynxBase` library. 6. Symbol Management: Exported necessary symbols from `LynxBase` to support dynamic linking across all components. issue:m-6736726571 SkipChecks:macro AutoSubmit:true | 1 year ago | |
[Feature] LynxBase standalone -- Implement Independent Trace Event System in LynxBase This change addresses a critical circular dependency between the lynx-base and lynx-trace libraries. Previously, lynx-base relied on the lynx-trace component for its TRACE_EVENT macros, creating a problematic coupling. Key Changes: 1. Decoupling from lynx-trace: The lynx-base library now includes its own implementation for trace events, removing the direct dependency on the lynx-trace component. 2. Injectable Trace Backend: A new service injection pattern has been introduced. Consumers of lynx-base are now responsible for providing a concrete tracing implementation (a "backend") by implementing the LynxBaseTraceService interface and injecting it at runtime. issue:m-6736726571 AutoSubmit:true | 1 year ago | |
[Feature] LynxBase standalone -- Implement Independent Trace Event System in LynxBase This change addresses a critical circular dependency between the lynx-base and lynx-trace libraries. Previously, lynx-base relied on the lynx-trace component for its TRACE_EVENT macros, creating a problematic coupling. Key Changes: 1. Decoupling from lynx-trace: The lynx-base library now includes its own implementation for trace events, removing the direct dependency on the lynx-trace component. 2. Injectable Trace Backend: A new service injection pattern has been introduced. Consumers of lynx-base are now responsible for providing a concrete tracing implementation (a "backend") by implementing the LynxBaseTraceService interface and injecting it at runtime. issue:m-6736726571 AutoSubmit:true | 1 year ago |