Commit 3abb2c66 authored by Wei-Yin Chen (陳威尹)'s avatar Wei-Yin Chen (陳威尹) Committed by Commit Bot

Add PartnerBookmark.LoadingTime

Record time spent on reading partner bookmarks, since this is part of
the critical path of showing bookmark UI.

Bug: 787132
Change-Id: I8aa68436b0d762d644691992bde0e2df095259f0
Reviewed-on: https://chromium-review.googlesource.com/825004Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524601}
parent 82479045
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
package org.chromium.chrome.browser.bookmarks; package org.chromium.chrome.browser.bookmarks;
import android.os.SystemClock;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Pair; import android.util.Pair;
...@@ -11,6 +12,7 @@ import org.chromium.base.ContextUtils; ...@@ -11,6 +12,7 @@ import org.chromium.base.ContextUtils;
import org.chromium.base.ObserverList; import org.chromium.base.ObserverList;
import org.chromium.base.VisibleForTesting; import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim; import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.components.bookmarks.BookmarkId; import org.chromium.components.bookmarks.BookmarkId;
...@@ -19,6 +21,7 @@ import org.chromium.components.url_formatter.UrlFormatter; ...@@ -19,6 +21,7 @@ import org.chromium.components.url_formatter.UrlFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
/** /**
* Provides the communication channel for Android to fetch and manipulate the * Provides the communication channel for Android to fetch and manipulate the
...@@ -303,10 +306,13 @@ public class BookmarkBridge { ...@@ -303,10 +306,13 @@ public class BookmarkBridge {
return true; return true;
} }
long startTime = SystemClock.elapsedRealtime();
addObserver(new BookmarkModelObserver() { addObserver(new BookmarkModelObserver() {
@Override @Override
public void bookmarkModelLoaded() { public void bookmarkModelLoaded() {
removeObserver(this); removeObserver(this);
RecordHistogram.recordTimesHistogram("PartnerBookmark.LoadingTime",
SystemClock.elapsedRealtime() - startTime, TimeUnit.MILLISECONDS);
runAfterModelLoaded.run(); runAfterModelLoaded.run();
} }
@Override @Override
......
...@@ -58879,6 +58879,14 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. ...@@ -58879,6 +58879,14 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary> </summary>
</histogram> </histogram>
<histogram name="PartnerBookmark.LoadingTime" units="ms">
<owner>wychen@chromium.org</owner>
<summary>
The time spent on loading partner bookmarks, from kickOffReading() to
bookmarkModelLoaded() callback.
</summary>
</histogram>
<histogram name="PartnerBookmark.Null" enum="BooleanNull"> <histogram name="PartnerBookmark.Null" enum="BooleanNull">
<owner>wychen@chromium.org</owner> <owner>wychen@chromium.org</owner>
<summary> <summary>
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