Skip to content

Commit

Permalink
Add UMA metrics collection for text filtering in Ash overview mode
Browse files Browse the repository at this point in the history
Add four new histograms to Ash.WindowSelector:

* Ash.WindowSelector.ItemsWhenTextFilteringUsed: 
  Records the number of items visible in overview mode
  sessions where the text filtering feature is used.

* Ash.WindowSelector.TextFilteringStringLength:
  Records the length of the string in the text filtering
  textfield at the time when the overview mode session
  is terminated.

* Ash.WindowSelector.TextFilteringTextfieldCleared:
  Records the number of times the text in the text
  filtering textfield has been completely removed,
  recorded at the time when the overview mode session
  is terminated.

* Ash.WindowSelector.TimeInOverviewWithTextFiltering:
  Records the time spent in an overview mode sessions
  where the text filtering feature is used.

BUG=398156
TEST=none

Review URL: https://codereview.chromium.org/427673002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286313 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
tdanderson@chromium.org committed Jul 29, 2014
1 parent 619611c commit a6b084f
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
22 changes: 21 additions & 1 deletion ash/wm/overview/window_selector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ WindowSelector::WindowSelector(const WindowList& windows,
overview_start_time_(base::Time::Now()),
num_key_presses_(0),
num_items_(0),
showing_selection_widget_(false) {
showing_selection_widget_(false),
text_filter_string_length_(0),
num_times_textfield_cleared_(0) {
DCHECK(delegate_);
Shell* shell = Shell::GetInstance();
shell->OnOverviewModeStarting();
Expand Down Expand Up @@ -244,6 +246,20 @@ WindowSelector::~WindowSelector() {
UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowSelector.TimeInOverview",
base::Time::Now() - overview_start_time_);

// Record metrics related to text filtering.
UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringStringLength",
text_filter_string_length_);
UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringTextfieldCleared",
num_times_textfield_cleared_);
if (text_filter_string_length_) {
UMA_HISTOGRAM_MEDIUM_TIMES(
"Ash.WindowSelector.TimeInOverviewWithTextFiltering",
base::Time::Now() - overview_start_time_);
UMA_HISTOGRAM_COUNTS_100(
"Ash.WindowSelector.ItemsWhenTextFilteringUsed",
remaining_items);
}

// TODO(flackr): Change this to OnOverviewModeEnded and move it to when
// everything is done.
shell->OnOverviewModeEnding();
Expand Down Expand Up @@ -389,6 +405,10 @@ void WindowSelector::ContentsChanged(views::Textfield* sender,
return;
}

text_filter_string_length_ = new_contents.length();
if (!text_filter_string_length_)
num_times_textfield_cleared_++;

bool should_show_selection_widget = !new_contents.empty();
if (showing_selection_widget_ != should_show_selection_widget) {
ui::ScopedLayerAnimationSettings animation_settings(
Expand Down
7 changes: 7 additions & 0 deletions ash/wm/overview/window_selector.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ class ASH_EXPORT WindowSelector
// such as enter key to select.
scoped_ptr<views::Widget> text_filter_widget_;

// The current length of the string entered into the text filtering textfield.
size_t text_filter_string_length_;

// The number of times the text filtering textfield has been cleared of text
// during this overview mode session.
size_t num_times_textfield_cleared_;

DISALLOW_COPY_AND_ASSIGN(WindowSelector);
};

Expand Down
43 changes: 43 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,16 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>

<histogram name="Ash.WindowSelector.ItemsWhenTextFilteringUsed" units="items">
<owner>tdanderson@chromium.org</owner>
<owner>flackr@chromium.org</owner>
<summary>
The number of items showing in overview mode at the moment when an item is
selected or when selection is canceled. Only recorded if the text filtering
textfield contains a non-empty string.
</summary>
</histogram>

<histogram name="Ash.WindowSelector.KeyPressesOverItemsRatio" units="%">
<owner>flackr@chromium.org</owner>
<owner>tdanderson@chromium.org</owner>
Expand All @@ -781,6 +791,27 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>

<histogram name="Ash.WindowSelector.TextFilteringStringLength"
units="characters">
<owner>tdanderson@chromium.org</owner>
<owner>flackr@chromium.org</owner>
<summary>
The length of the string entered into the text filtering textfield at the
moment when an item is selected or when selection is canceled.
</summary>
</histogram>

<histogram name="Ash.WindowSelector.TextFilteringTextfieldCleared">
<owner>tdanderson@chromium.org</owner>
<owner>flackr@chromium.org</owner>
<summary>
The number of times the text filtering textfield has had all of its text
removed within a single overview mode session. Measured from the time
overview mode is invoked to when an item is selected or when selection is
canceled.
</summary>
</histogram>

<histogram name="Ash.WindowSelector.TimeBetweenUse" units="milliseconds">
<owner>flackr@chromium.org</owner>
<owner>kuscher@google.com</owner>
Expand All @@ -800,6 +831,18 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>

<histogram name="Ash.WindowSelector.TimeInOverviewWithTextFiltering"
units="milliseconds">
<owner>tdanderson@chromium.org</owner>
<owner>flackr@chromium.org</owner>
<summary>
The amount of time spent in overview mode when text filtering is used. The
time is measured from the moment the windows begin animating to a thumbnail
size preview to when a window is selected or selection is canceled. Only
recorded if the text filtering textfield contains a non-empty string.
</summary>
</histogram>

<histogram name="AsyncDNS.AttemptCountFail">
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
<summary>
Expand Down

0 comments on commit a6b084f

Please sign in to comment.