diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-15 19:49:43 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-15 19:49:43 +0000 |
commit | a01d93551393e886430385e641b2bd80ef3ba913 (patch) | |
tree | 356aeb6854408490b7b863ec21bf2725d33159f7 | |
parent | 68b16b9650dcfa49c7d8d79e384bbcc30b26311a (diff) | |
download | chromium_src-a01d93551393e886430385e641b2bd80ef3ba913.zip chromium_src-a01d93551393e886430385e641b2bd80ef3ba913.tar.gz chromium_src-a01d93551393e886430385e641b2bd80ef3ba913.tar.bz2 |
Adds some histograms from various omnibox queries. I'm doing this as
with the quick provider enabled the omnibox feels a bit sluggish and I
would like to quantify that. I'll update the xml file separately.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6679049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78263 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/autocomplete/autocomplete.cc | 9 | ||||
-rw-r--r-- | chrome/browser/autocomplete/history_quick_provider.cc | 12 |
2 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc index 4226bae..1f4a10e 100644 --- a/chrome/browser/autocomplete/autocomplete.cc +++ b/chrome/browser/autocomplete/autocomplete.cc @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/command_line.h" #include "base/i18n/number_formatting.h" +#include "base/metrics/histogram.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -852,12 +853,20 @@ void AutocompleteController::Start(const string16& text, // Start the new query. in_start_ = true; + base::TimeTicks start_time = base::TimeTicks::Now(); for (ACProviders::iterator i(providers_.begin()); i != providers_.end(); ++i) { (*i)->Start(input_, minimal_changes); if (synchronous_only) DCHECK((*i)->done()); } + if (!synchronous_only && text.size() < 6) { + base::TimeTicks end_time = base::TimeTicks::Now(); + std::string name = "Omnibox.QueryTime." + base::IntToString(text.size()); + scoped_refptr<base::Histogram> counter = base::Histogram::FactoryGet( + name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag); + counter->Add(static_cast<int>((end_time - start_time).InMilliseconds())); + } in_start_ = false; CheckIfDone(); UpdateResult(true); diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc index af0148c..1ecb81f 100644 --- a/chrome/browser/autocomplete/history_quick_provider.cc +++ b/chrome/browser/autocomplete/history_quick_provider.cc @@ -7,7 +7,10 @@ #include "base/basictypes.h" #include "base/i18n/break_iterator.h" #include "base/logging.h" +#include "base/metrics/histogram.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" +#include "base/time.h" #include "base/utf_string_conversions.h" #include "chrome/browser/history/history.h" #include "chrome/browser/history/in_memory_url_index.h" @@ -62,7 +65,16 @@ void HistoryQuickProvider::Start(const AutocompleteInput& input, // someone unloads the history backend, we'll get inconsistent inline // autocomplete behavior here. if (GetIndex()) { + base::TimeTicks start_time = base::TimeTicks::Now(); DoAutocomplete(); + if (input.text().size() < 6) { + base::TimeTicks end_time = base::TimeTicks::Now(); + std::string name = "HistoryQuickProvider.QueryIndexTime." + + base::IntToString(input.text().size()); + scoped_refptr<base::Histogram> counter = base::Histogram::FactoryGet( + name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag); + counter->Add(static_cast<int>((end_time - start_time).InMilliseconds())); + } UpdateStarredStateOfMatches(); } } |