Commit e1919c13 authored by Tommy Li's avatar Tommy Li Committed by Commit Bot

[omnibox] Revive InMemoryURLIndex restore and save cache time histograms

These histograms were obsoleted recently.

I would like to bring them back to validate the hypothesis that the
HistoryQuickProvider / InMemoryURLIndex cache is not needed.

Details of experiment: go/chrome-omnibox-hqp-ablate-cache-file

Specifically, my theory is that the time it takes to restore + save the
cache file is in the same order of magnitude as it takes to rebuild the
index from the History DB.

The cache causes two known problems:
 1. Saving it is responsible for roughly 10% of shutdown hangs.
 2. Restoring it seems to take a lot of memory.

This CL is a partial revert of:
https://chromium-review.googlesource.com/c/chromium/src/+/2324551

Bug: 750845, 1032679, 1141539
Change-Id: I7e679c0ba602cf48ab10ad0a89bd75bc3dbf5ee6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490148Reviewed-by: default avatarMark Pearson <mpearson@chromium.org>
Commit-Queue: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819950}
parent 24bfaa02
...@@ -383,6 +383,7 @@ bool URLIndexPrivateData::DeleteURL(const GURL& url) { ...@@ -383,6 +383,7 @@ bool URLIndexPrivateData::DeleteURL(const GURL& url) {
// static // static
scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RestoreFromFile( scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RestoreFromFile(
const base::FilePath& file_path) { const base::FilePath& file_path) {
base::TimeTicks beginning_time = base::TimeTicks::Now();
if (!base::PathExists(file_path)) if (!base::PathExists(file_path))
return nullptr; return nullptr;
std::string data; std::string data;
...@@ -409,6 +410,8 @@ scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RestoreFromFile( ...@@ -409,6 +410,8 @@ scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RestoreFromFile(
if (!restored_data->RestorePrivateData(index_cache)) if (!restored_data->RestorePrivateData(index_cache))
return nullptr; return nullptr;
UMA_HISTOGRAM_TIMES("History.InMemoryURLIndexRestoreCacheTime",
base::TimeTicks::Now() - beginning_time);
UMA_HISTOGRAM_COUNTS_1M("History.InMemoryURLHistoryItems", UMA_HISTOGRAM_COUNTS_1M("History.InMemoryURLHistoryItems",
restored_data->history_id_word_map_.size()); restored_data->history_id_word_map_.size());
if (restored_data->Empty()) if (restored_data->Empty())
...@@ -934,6 +937,7 @@ void URLIndexPrivateData::ResetSearchTermCache() { ...@@ -934,6 +937,7 @@ void URLIndexPrivateData::ResetSearchTermCache() {
} }
bool URLIndexPrivateData::SaveToFile(const base::FilePath& file_path) { bool URLIndexPrivateData::SaveToFile(const base::FilePath& file_path) {
base::TimeTicks beginning_time = base::TimeTicks::Now();
InMemoryURLIndexCacheItem index_cache; InMemoryURLIndexCacheItem index_cache;
SavePrivateData(&index_cache); SavePrivateData(&index_cache);
std::string data; std::string data;
...@@ -947,6 +951,8 @@ bool URLIndexPrivateData::SaveToFile(const base::FilePath& file_path) { ...@@ -947,6 +951,8 @@ bool URLIndexPrivateData::SaveToFile(const base::FilePath& file_path) {
LOG(WARNING) << "Failed to write " << file_path.value(); LOG(WARNING) << "Failed to write " << file_path.value();
return false; return false;
} }
UMA_HISTOGRAM_TIMES("History.InMemoryURLIndexSaveCacheTime",
base::TimeTicks::Now() - beginning_time);
return true; return true;
} }
......
...@@ -597,7 +597,7 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -597,7 +597,7 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</histogram> </histogram>
<histogram name="History.InMemoryURLIndexingTime" units="ms" <histogram name="History.InMemoryURLIndexingTime" units="ms"
expires_after="2021-03-30"> expires_after="2021-06-30">
<owner>mpearson@chromium.org</owner> <owner>mpearson@chromium.org</owner>
<owner>ssid@chromium.org</owner> <owner>ssid@chromium.org</owner>
<summary> <summary>
...@@ -606,6 +606,27 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -606,6 +606,27 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary> </summary>
</histogram> </histogram>
<histogram name="History.InMemoryURLIndexRestoreCacheTime" units="ms"
expires_after="2021-06-30">
<owner>tommycli@chromium.org</owner>
<owner>mpearson@chromium.org</owner>
<summary>
Time to restore the in-memory url index from disk cache. Recorded on profile
open.
</summary>
</histogram>
<histogram name="History.InMemoryURLIndexSaveCacheTime" units="ms"
expires_after="2021-06-30">
<owner>tommycli@chromium.org</owner>
<owner>mpearson@chromium.org</owner>
<summary>
Time to write in-memory url index to disk cache. Recorded once shortly after
profile open (after rebuilding the in-memory url index from history) and
again upon (clean) shutdown.
</summary>
</histogram>
<histogram name="History.MigrateFailureFromVersion" units="units" <histogram name="History.MigrateFailureFromVersion" units="units"
expires_after="M77"> expires_after="M77">
<owner>sky@chromium.org</owner> <owner>sky@chromium.org</owner>
......
...@@ -27109,33 +27109,6 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -27109,33 +27109,6 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary> </summary>
</histogram> </histogram>
<histogram name="History.InMemoryURLIndexRestoreCacheTime" units="ms"
expires_after="2019-08-30">
<obsolete>
Removed July 2020.
</obsolete>
<owner>mpearson@chromium.org</owner>
<owner>ssid@chromium.org</owner>
<summary>
Time to restore the in-memory url index from disk cache. Recorded on profile
open.
</summary>
</histogram>
<histogram name="History.InMemoryURLIndexSaveCacheTime" units="ms"
expires_after="2019-08-30">
<obsolete>
Removed July 2020.
</obsolete>
<owner>mpearson@chromium.org</owner>
<owner>ssid@chromium.org</owner>
<summary>
Time to write in-memory url index to disk cache. Recorded once shortly after
profile open (after rebuilding the in-memory url index from history) and
again upon (clean) shutdown.
</summary>
</histogram>
<histogram name="History.InMemoryURLWords" units="units" expires_after="M86"> <histogram name="History.InMemoryURLWords" units="units" expires_after="M86">
<obsolete> <obsolete>
Removed August 2020. Removed August 2020.
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