Index: base/android/library_loader/library_loader_hooks.cc |
diff --git a/base/android/library_loader/library_loader_hooks.cc b/base/android/library_loader/library_loader_hooks.cc |
index 0b59a30429676b131f428de41b5b8e6c3889b483..0313f70f4beb730a5b3f30815222d212c5f30cb7 100644 |
--- a/base/android/library_loader/library_loader_hooks.cc |
+++ b/base/android/library_loader/library_loader_hooks.cc |
@@ -48,13 +48,19 @@ enum BrowserHistogramCode { |
RendererHistogramCode g_renderer_histogram_code = NO_PENDING_HISTOGRAM_CODE; |
+// The amount of time, in milliseconds, that it took to load the shared |
+// libraries in the renderer. Set in |
+// RegisterChromiumAndroidLinkerRendererHistogram. |
+long g_renderer_library_load_time_ms = 0; |
+ |
} // namespace |
static void RegisterChromiumAndroidLinkerRendererHistogram( |
JNIEnv* env, |
jobject jcaller, |
jboolean requested_shared_relro, |
- jboolean load_at_fixed_address_failed) { |
+ jboolean load_at_fixed_address_failed, |
+ jlong library_load_time_ms) { |
// Note a pending histogram value for later recording. |
if (requested_shared_relro) { |
g_renderer_histogram_code = load_at_fixed_address_failed |
@@ -62,6 +68,8 @@ static void RegisterChromiumAndroidLinkerRendererHistogram( |
} else { |
g_renderer_histogram_code = LFA_NOT_ATTEMPTED; |
} |
+ |
+ g_renderer_library_load_time_ms = library_load_time_ms; |
} |
void RecordChromiumAndroidLinkerRendererHistogram() { |
@@ -72,6 +80,11 @@ void RecordChromiumAndroidLinkerRendererHistogram() { |
g_renderer_histogram_code, |
MAX_RENDERER_HISTOGRAM_CODE); |
g_renderer_histogram_code = NO_PENDING_HISTOGRAM_CODE; |
+ |
+ // Record how long it took to load the shared libraries. |
+ UMA_HISTOGRAM_TIMES( |
+ "ChromiumAndroidLinker.RendererLoadTime", |
+ base::TimeDelta::FromMilliseconds(g_renderer_library_load_time_ms)); |
} |
static void RecordChromiumAndroidLinkerBrowserHistogram( |
@@ -79,7 +92,8 @@ static void RecordChromiumAndroidLinkerBrowserHistogram( |
jobject jcaller, |
jboolean is_using_browser_shared_relros, |
jboolean load_at_fixed_address_failed, |
- jint library_load_from_apk_status) { |
+ jint library_load_from_apk_status, |
+ jlong library_load_time_ms) { |
// For low-memory devices, record whether or not we successfully loaded the |
// browser at a fixed address. Otherwise just record a normal invocation. |
BrowserHistogramCode histogram_code; |
@@ -97,6 +111,10 @@ static void RecordChromiumAndroidLinkerBrowserHistogram( |
UMA_HISTOGRAM_ENUMERATION("ChromiumAndroidLinker.LibraryLoadFromApkStatus", |
library_load_from_apk_status, |
LIBRARY_LOAD_FROM_APK_STATUS_CODES_MAX); |
+ |
+ // Record how long it took to load the shared libraries. |
+ UMA_HISTOGRAM_TIMES("ChromiumAndroidLinker.BrowserLoadTime", |
+ base::TimeDelta::FromMilliseconds(library_load_time_ms)); |
} |
void SetLibraryLoadedHook(LibraryLoadedHook* func) { |