summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/runtime.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 8345d77a5b..7646a13bf9 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1788,6 +1788,14 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
callbacks_->NextRuntimePhase(RuntimePhaseCallback::RuntimePhase::kInitialAgents);
}
+ if (IsZygote() && IsPerfettoHprofEnabled()) {
+ constexpr const char* plugin_name = kIsDebugBuild ?
+ "libperfetto_hprofd.so" : "libperfetto_hprof.so";
+ // Load eagerly in Zygote to improve app startup times. This will make
+ // subsequent dlopens for the library no-ops.
+ dlopen(plugin_name, RTLD_NOW | RTLD_LOCAL);
+ }
+
VLOG(startup) << "Runtime::Init exiting";
// Set OnlyUseSystemOatFiles only after boot classpath has been set up.