summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authornsatragno@chromium.org <nsatragno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-12 16:45:07 +0000
committernsatragno@chromium.org <nsatragno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-12 16:45:07 +0000
commitf7a2d6e12b66d1ccc9c70a280e11237c857fde82 (patch)
tree1f8e75ba37ca9c99b664b680c81e5d58b44d6325 /ash
parente70bdb7dc6e14beebad46c2647134fcc1e7c159a (diff)
downloadchromium_src-f7a2d6e12b66d1ccc9c70a280e11237c857fde82.zip
chromium_src-f7a2d6e12b66d1ccc9c70a280e11237c857fde82.tar.gz
chromium_src-f7a2d6e12b66d1ccc9c70a280e11237c857fde82.tar.bz2
Added UMA stats to overview mode
This patch: * Brought back WindowSelector.CycleTime histogram with different name (WindowCycleController.CycleTime). * Renamed WindowSelector.Selection to WindowCycleController.Cycle and fixed that it counted incorrectly overview mode selections. * Fixed a bug in which the number of items in overview mode were not counted correctly. * Added stats for: ** Number of closed items. ** Number of times the enter key is used to select a window. ** Number of arrow key presses per session. ** Ratio between arrow key presses and number of items. BUG=364590 TEST=none Review URL: https://codereview.chromium.org/320303002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276710 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/metrics/user_metrics_recorder.cc10
-rw-r--r--ash/metrics/user_metrics_recorder.h13
-rw-r--r--ash/wm/overview/window_selector.cc35
-rw-r--r--ash/wm/overview/window_selector.h14
-rw-r--r--ash/wm/overview/window_selector_controller.cc2
-rw-r--r--ash/wm/window_cycle_controller.cc5
-rw-r--r--ash/wm/window_cycle_controller.h3
7 files changed, 61 insertions, 21 deletions
diff --git a/ash/metrics/user_metrics_recorder.cc b/ash/metrics/user_metrics_recorder.cc
index 2ab9380..37757450 100644
--- a/ash/metrics/user_metrics_recorder.cc
+++ b/ash/metrics/user_metrics_recorder.cc
@@ -368,9 +368,13 @@ void UserMetricsRecorder::RecordUserMetricsAction(UserMetricsAction action) {
base::RecordAction(
base::UserMetricsAction("WindowSelector_Overview"));
break;
- case ash::UMA_WINDOW_SELECTION:
+ case ash::UMA_WINDOW_OVERVIEW_ENTER_KEY:
base::RecordAction(
- base::UserMetricsAction("WindowSelector_Selection"));
+ base::UserMetricsAction("WindowSelector_OverviewEnterKey"));
+ break;
+ case ash::UMA_WINDOW_CYCLE:
+ base::RecordAction(
+ base::UserMetricsAction("WindowCycleController_Cycle"));
break;
}
}
@@ -401,7 +405,7 @@ void UserMetricsRecorder::RecordPeriodicMetrics() {
ACTIVE_WINDOW_STATE_TYPE_NO_ACTIVE_WINDOW;
wm::WindowState* active_window_state = ash::wm::GetActiveWindowState();
if (active_window_state) {
- switch(active_window_state->GetStateType()) {
+ switch (active_window_state->GetStateType()) {
case wm::WINDOW_STATE_TYPE_MAXIMIZED:
active_window_state_type = ACTIVE_WINDOW_STATE_TYPE_MAXIMIZED;
break;
diff --git a/ash/metrics/user_metrics_recorder.h b/ash/metrics/user_metrics_recorder.h
index 98eb652..11d274a 100644
--- a/ash/metrics/user_metrics_recorder.h
+++ b/ash/metrics/user_metrics_recorder.h
@@ -100,14 +100,15 @@ enum UserMetricsAction {
UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT,
UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT,
- // Thumbnail sized overview of windows triggered. This is a subset of
- // UMA_WINDOW_SELECTION triggered by lingering during alt+tab cycles or
- // pressing the overview key.
+ // Thumbnail sized overview of windows triggered by pressing the overview key.
UMA_WINDOW_OVERVIEW,
- // Window selection started by beginning an alt+tab cycle or pressing the
- // overview key. This does not count each step through an alt+tab cycle.
- UMA_WINDOW_SELECTION,
+ // Selecting a window in overview mode by pressing the enter key.
+ UMA_WINDOW_OVERVIEW_ENTER_KEY,
+
+ // Window selection started by beginning an alt+tab cycle. This does not count
+ // each step through an alt+tab cycle.
+ UMA_WINDOW_CYCLE,
};
// User Metrics Recorder provides a repeating callback (RecordPeriodicMetrics)
diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc
index a8aaab4..467aca6 100644
--- a/ash/wm/overview/window_selector.cc
+++ b/ash/wm/overview/window_selector.cc
@@ -95,8 +95,10 @@ WindowSelector::WindowSelector(const WindowList& windows,
restore_focus_window_(aura::client::GetFocusClient(
Shell::GetPrimaryRootWindow())->GetFocusedWindow()),
ignore_activations_(false),
+ selected_grid_index_(0),
overview_start_time_(base::Time::Now()),
- selected_grid_index_(0) {
+ num_key_presses_(0),
+ num_items_(0) {
DCHECK(delegate_);
Shell* shell = Shell::GetInstance();
shell->OnOverviewModeStarting();
@@ -105,7 +107,6 @@ WindowSelector::WindowSelector(const WindowList& windows,
restore_focus_window_->AddObserver(this);
const aura::Window::Windows root_windows = Shell::GetAllRootWindows();
- size_t items = 0;
for (aura::Window::Windows::const_iterator iter = root_windows.begin();
iter != root_windows.end(); iter++) {
// Observed switchable containers for newly created windows on all root
@@ -119,12 +120,12 @@ WindowSelector::WindowSelector(const WindowList& windows,
scoped_ptr<WindowGrid> grid(new WindowGrid(*iter, windows, this));
if (grid->empty())
continue;
+ num_items_ += grid->size();
grid_list_.push_back(grid.release());
- items += grid_list_.size();
}
DCHECK(!grid_list_.empty());
- UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", items);
+ UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", num_items_);
shell->activation_client()->AddObserver(this);
@@ -169,9 +170,18 @@ WindowSelector::~WindowSelector() {
shell->RemovePreTargetHandler(this);
shell->GetScreen()->RemoveObserver(this);
- UMA_HISTOGRAM_MEDIUM_TIMES(
- "Ash.WindowSelector.TimeInOverview",
- base::Time::Now() - overview_start_time_);
+
+ size_t remaining_items = 0;
+ for (ScopedVector<WindowGrid>::iterator iter = grid_list_.begin();
+ iter != grid_list_.end(); iter++) {
+ remaining_items += (*iter)->size();
+ }
+
+ DCHECK(num_items_ >= remaining_items);
+ UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.OverviewClosedItems",
+ num_items_ - remaining_items);
+ UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowSelector.TimeInOverview",
+ base::Time::Now() - overview_start_time_);
// TODO(nsatragno): Change this to OnOverviewModeEnded and move it to when
// everything is done.
@@ -206,21 +216,32 @@ void WindowSelector::OnKeyEvent(ui::KeyEvent* event) {
CancelSelection();
break;
case ui::VKEY_UP:
+ num_key_presses_++;
Move(WindowSelector::UP);
break;
case ui::VKEY_DOWN:
+ num_key_presses_++;
Move(WindowSelector::DOWN);
break;
case ui::VKEY_RIGHT:
+ num_key_presses_++;
Move(WindowSelector::RIGHT);
break;
case ui::VKEY_LEFT:
+ num_key_presses_++;
Move(WindowSelector::LEFT);
break;
case ui::VKEY_RETURN:
// Ignore if no item is selected.
if (!grid_list_[selected_grid_index_]->is_selecting())
return;
+ UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.ArrowKeyPresses",
+ num_key_presses_);
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Ash.WindowSelector.KeyPressesOverItemsRatio",
+ (num_key_presses_ * 100) / num_items_, 1, 300, 30);
+ Shell::GetInstance()->metrics()->RecordUserMetricsAction(
+ UMA_WINDOW_OVERVIEW_ENTER_KEY);
wm::GetWindowState(grid_list_[selected_grid_index_]->
SelectedWindow()->SelectionWindow())->Activate();
break;
diff --git a/ash/wm/overview/window_selector.h b/ash/wm/overview/window_selector.h
index d6c8519..f9ca51a 100644
--- a/ash/wm/overview/window_selector.h
+++ b/ash/wm/overview/window_selector.h
@@ -124,9 +124,6 @@ class ASH_EXPORT WindowSelector
// List of all the window overview grids, one for each root window.
ScopedVector<WindowGrid> grid_list_;
- // The time when overview was started.
- base::Time overview_start_time_;
-
// Tracks windows which were hidden because they were not part of the
// overview.
aura::WindowTracker hidden_windows_;
@@ -134,6 +131,17 @@ class ASH_EXPORT WindowSelector
// Tracks the index of the root window the selection widget is in.
size_t selected_grid_index_;
+ // The following variables are used for metric collection purposes. All of
+ // them refer to this particular overview session and are not cumulative:
+ // The time when overview was started.
+ base::Time overview_start_time_;
+
+ // The number of arrow key presses.
+ size_t num_key_presses_;
+
+ // The number of items in the overview.
+ size_t num_items_;
+
DISALLOW_COPY_AND_ASSIGN(WindowSelector);
};
diff --git a/ash/wm/overview/window_selector_controller.cc b/ash/wm/overview/window_selector_controller.cc
index ea74ff0..02e2f59 100644
--- a/ash/wm/overview/window_selector_controller.cc
+++ b/ash/wm/overview/window_selector_controller.cc
@@ -67,8 +67,6 @@ void WindowSelectorController::OnSelectionEnded() {
}
void WindowSelectorController::OnSelectionStarted() {
- Shell* shell = Shell::GetInstance();
- shell->metrics()->RecordUserMetricsAction(UMA_WINDOW_SELECTION);
if (!last_selection_time_.is_null()) {
UMA_HISTOGRAM_LONG_TIMES(
"Ash.WindowSelector.TimeBetweenUse",
diff --git a/ash/wm/window_cycle_controller.cc b/ash/wm/window_cycle_controller.cc
index 472a83d..54e702c 100644
--- a/ash/wm/window_cycle_controller.cc
+++ b/ash/wm/window_cycle_controller.cc
@@ -8,6 +8,7 @@
#include "ash/shell.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/window_cycle_list.h"
+#include "base/metrics/histogram.h"
#include "ui/events/event.h"
#include "ui/events/event_handler.h"
@@ -79,6 +80,8 @@ void WindowCycleController::StartCycling() {
window_cycle_list_.reset(new WindowCycleList(ash::Shell::GetInstance()->
mru_window_tracker()->BuildMruWindowList()));
event_handler_.reset(new WindowCycleEventFilter());
+ cycle_start_time_ = base::Time::Now();
+ Shell::GetInstance()->metrics()->RecordUserMetricsAction(UMA_WINDOW_CYCLE);
}
//////////////////////////////////////////////////////////////////////////////
@@ -93,6 +96,8 @@ void WindowCycleController::StopCycling() {
window_cycle_list_.reset();
// Remove our key event filter.
event_handler_.reset();
+ UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowCycleController.CycleTime",
+ base::Time::Now() - cycle_start_time_);
}
} // namespace ash
diff --git a/ash/wm/window_cycle_controller.h b/ash/wm/window_cycle_controller.h
index d0da1f4..4120bc0 100644
--- a/ash/wm/window_cycle_controller.h
+++ b/ash/wm/window_cycle_controller.h
@@ -8,6 +8,7 @@
#include "ash/ash_export.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "base/time/time.h"
namespace ui {
class EventHandler;
@@ -65,6 +66,8 @@ class ASH_EXPORT WindowCycleController {
// Event handler to watch for release of alt key.
scoped_ptr<ui::EventHandler> event_handler_;
+ base::Time cycle_start_time_;
+
DISALLOW_COPY_AND_ASSIGN(WindowCycleController);
};