diff options
| author | 2019-11-27 11:12:36 -0800 | |
|---|---|---|
| committer | 2019-11-27 11:12:36 -0800 | |
| commit | 6eed08baf4271ffa6a361f9b3e777d08a25fe88e (patch) | |
| tree | 4426662e6eaf8583c790f0ad554bc1bfc776f4c2 | |
| parent | 90d076eabdc8162bf4142581952f2591d027b6c2 (diff) | |
| parent | bdf17fb2b3e46757b674ee9eaabd1c36aeffeb46 (diff) | |
Merge "Use resetJitCounters for boot image profiling" am: ce9a776f1d am: 39cbd1fb92
am: bdf17fb2b3
Change-Id: I7e7b4f59d26c25671d71cb4d53403a7726af2e19
| -rw-r--r-- | core/java/com/android/internal/os/ZygoteInit.java | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index 865ec27e00c4..9ee79eada626 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -254,18 +254,6 @@ public class ZygoteInit { InputStream is; try { - // If we are profiling the boot image, avoid preloading classes. - // Can't use device_config since we are the zygote. - String prop = SystemProperties.get( - "persist.device_config.runtime_native_boot.profilebootclasspath", ""); - // Might be empty if the property is unset since the default is "". - if (prop.length() == 0) { - prop = SystemProperties.get("dalvik.vm.profilebootclasspath", ""); - } - if ("true".equals(prop)) { - return; - } - is = new FileInputStream(PRELOADED_CLASSES); } catch (FileNotFoundException e) { Log.e(TAG, "Couldn't find " + PRELOADED_CLASSES + "."); @@ -345,6 +333,22 @@ public class ZygoteInit { runtime.preloadDexCaches(); Trace.traceEnd(Trace.TRACE_TAG_DALVIK); + // If we are profiling the boot image, reset the Jit counters after preloading the + // classes. We want to preload for performance, and we can use method counters to + // infer what clases are used after calling resetJitCounters, for profile purposes. + // Can't use device_config since we are the zygote. + String prop = SystemProperties.get( + "persist.device_config.runtime_native_boot.profilebootclasspath", ""); + // Might be empty if the property is unset since the default is "". + if (prop.length() == 0) { + prop = SystemProperties.get("dalvik.vm.profilebootclasspath", ""); + } + if ("true".equals(prop)) { + Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "ResetJitCounters"); + runtime.resetJitCounters(); + Trace.traceEnd(Trace.TRACE_TAG_DALVIK); + } + // Bring back root. We'll need it later if we're in the zygote. if (droppedPriviliges) { try { |