Skip to content

Commit

Permalink
Android: Record UMA for custom resources on startup.
Browse files Browse the repository at this point in the history
Record UMA once during startup only for the browser process.

Bug: 768497
Change-Id: I24fa3eebe812ee4dc423390535e7b52ab8c6fcd1
Reviewed-on: https://chromium-review.googlesource.com/699697
Commit-Queue: Eric Stevenson <estevenson@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506595}
  • Loading branch information
Eric Stevenson authored and Commit Bot committed Oct 5, 2017
1 parent c382c79 commit d0431db
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,13 @@ public static void initCustomResources(Context context) {
}

protected abstract void initCustomResourcesImpl(Context context);

/**
* Record custom resources related UMA. Requires native library to be loaded.
*/
public static void maybeRecordResourceMetrics() {
sInstance.maybeRecordResourceMetricsImpl();
}

protected abstract void maybeRecordResourceMetricsImpl();
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ protected boolean isEnabledImpl() {
}

protected void initCustomResourcesImpl(Context context) {}

protected void maybeRecordResourceMetricsImpl() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.chromium.base.TraceEvent;
import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.build.BuildHooksAndroid;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.AfterStartupTaskUtils;
import org.chromium.chrome.browser.AppHooks;
Expand Down Expand Up @@ -410,6 +411,9 @@ public void run() {
logEGLShaderCacheSizeHistogram();
}
});

deferredStartupHandler.addDeferredTask(
() -> { BuildHooksAndroid.maybeRecordResourceMetrics(); });
}

private void initChannelsAsync() {
Expand Down
6 changes: 6 additions & 0 deletions tools/metrics/histograms/enums.xml
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,12 @@ uploading your change for review. These are checked by presubmit scripts.
<int value="3" label="LowMemory"/>
</enum>

<enum name="AndroidResourceExtractionStatus">
<int value="0" label="No extraction performed"/>
<int value="1" label="Extraction success"/>
<int value="2" label="Extraction failure"/>
</enum>

<enum name="AndroidRestoreResult">
<int value="0" label="No restore attempted"/>
<int value="1" label="Restore successful"/>
Expand Down
10 changes: 10 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,16 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>

<histogram name="Android.CompressedResources.ExtractionStatus"
enum="AndroidResourceExtractionStatus">
<owner>estevenson@chromium.org</owner>
<owner>agrieve@chromium.org</owner>
<summary>
Describes the result of Android resource extraction, and is recorded once
per browser start as part of deferred startup (not at time of extraction).
</summary>
</histogram>

<histogram name="Android.CompressedResources.ExtractionTime" units="ms">
<owner>estevenson@chromium.org</owner>
<owner>agrieve@chromium.org</owner>
Expand Down

0 comments on commit d0431db

Please sign in to comment.