Commit b8534089 authored by Egor Pasko's avatar Egor Pasko Committed by Commit Bot

LibraryLoader: Add residency percentage to trace

This should help triage cases when library prefetching takes too long or
too little.

Bug: 881384
Change-Id: I315020758bb702578237fae6de5c776e27c367d4
Reviewed-on: https://chromium-review.googlesource.com/1215802Reviewed-by: default avatarBenoit L <lizeb@chromium.org>
Reviewed-by: default avataragrieve <agrieve@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589920}
parent 89341da8
...@@ -221,7 +221,7 @@ public class TraceEvent implements AutoCloseable { ...@@ -221,7 +221,7 @@ public class TraceEvent implements AutoCloseable {
* Note that if tracing is not enabled, this will not result in allocating an object. * Note that if tracing is not enabled, this will not result in allocating an object.
* *
* @param name Trace event name. * @param name Trace event name.
* @param name The arguments of the event. * @param arg The arguments of the event.
* @return a TraceEvent, or null if tracing is not enabled. * @return a TraceEvent, or null if tracing is not enabled.
*/ */
public static TraceEvent scoped(String name, String arg) { public static TraceEvent scoped(String name, String arg) {
......
...@@ -358,8 +358,9 @@ public class LibraryLoader { ...@@ -358,8 +358,9 @@ public class LibraryLoader {
@Override @Override
protected Void doInBackground() { protected Void doInBackground() {
try (TraceEvent e = TraceEvent.scoped("LibraryLoader.asyncPrefetchLibrariesToMemory")) { int percentage = nativePercentageOfResidentNativeLibraryCode();
int percentage = nativePercentageOfResidentNativeLibraryCode(); try (TraceEvent e = TraceEvent.scoped("LibraryLoader.asyncPrefetchLibrariesToMemory",
Integer.toString(percentage))) {
// Arbitrary percentage threshold. If most of the native library is already // Arbitrary percentage threshold. If most of the native library is already
// resident (likely with monochrome), don't bother creating a prefetch process. // resident (likely with monochrome), don't bother creating a prefetch process.
boolean prefetch = mColdStart && percentage < 90; boolean prefetch = mColdStart && percentage < 90;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment