0

Adding UMA statistics for multi profile

We are capturing:
- The used multi profile mode
- Window teleports (and their type of transfer)

BUG=311828
TEST=visual using chrome://histograms page

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232355 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
skuhne@chromium.org
2013-11-01 13:35:17 +00:00
parent a19c652e7e
commit 7c43e7fed1
7 changed files with 92 additions and 9 deletions

@ -9,10 +9,10 @@
namespace ash {
// static
void MultiProfileUMA::RecordSwitchActiveUser(SwitchActiveUserAction action) {
UMA_HISTOGRAM_ENUMERATION("MultiProfile.SwitchActiveUserUIPath",
void MultiProfileUMA::RecordSessionMode(SessionMode action) {
UMA_HISTOGRAM_ENUMERATION("MultiProfile.SessionMode",
action,
NUM_SWITCH_ACTIVE_USER_ACTIONS);
NUM_SESSION_MODES);
}
// static
@ -22,4 +22,18 @@ void MultiProfileUMA::RecordSigninUser(SigninUserAction action) {
NUM_SIGNIN_USER_ACTIONS);
}
// static
void MultiProfileUMA::RecordSwitchActiveUser(SwitchActiveUserAction action) {
UMA_HISTOGRAM_ENUMERATION("MultiProfile.SwitchActiveUserUIPath",
action,
NUM_SWITCH_ACTIVE_USER_ACTIONS);
}
// static
void MultiProfileUMA::RecordTeleportAction(TeleportWindowAction action) {
UMA_HISTOGRAM_ENUMERATION("MultiProfile.TeleportWindow",
action,
NUM_TELEPORT_WINDOW_ACTIONS);
}
} // namespace ash

@ -16,10 +16,11 @@ namespace ash {
class ASH_EXPORT MultiProfileUMA {
public:
// Keep these enums up to date with tools/metrics/histograms/histograms.xml.
enum SwitchActiveUserAction {
SWITCH_ACTIVE_USER_BY_TRAY = 0,
SWITCH_ACTIVE_USER_BY_ACCELERATOR,
NUM_SWITCH_ACTIVE_USER_ACTIONS
enum SessionMode {
SESSION_SINGLE_USER_MODE = 0,
SESSION_SIDE_BY_SIDE_MODE,
SESSION_SEPARATE_DESKTOP_MODE,
NUM_SESSION_MODES
};
enum SigninUserAction {
@ -28,12 +29,32 @@ class ASH_EXPORT MultiProfileUMA {
NUM_SIGNIN_USER_ACTIONS
};
// Record switching the active user and what UI path was taken.
static void RecordSwitchActiveUser(SwitchActiveUserAction action);
enum SwitchActiveUserAction {
SWITCH_ACTIVE_USER_BY_TRAY = 0,
SWITCH_ACTIVE_USER_BY_ACCELERATOR,
NUM_SWITCH_ACTIVE_USER_ACTIONS
};
enum TeleportWindowAction {
TELEPORT_WINDOW_DRAG_AND_DROP = 0,
TELEPORT_WINDOW_CAPTION_MENU,
TELEPORT_WINDOW_RETURN_BY_MINIMIZE,
TELEPORT_WINDOW_RETURN_BY_LAUNCHER,
NUM_TELEPORT_WINDOW_ACTIONS
};
// Record the type of user (multi profile) session.
static void RecordSessionMode(SessionMode mode);
// Record signing in a new user and what UI path was taken.
static void RecordSigninUser(SigninUserAction action);
// Record switching the active user and what UI path was taken.
static void RecordSwitchActiveUser(SwitchActiveUserAction action);
// Record the way and how many times a window got teleported to another desk.
static void RecordTeleportAction(TeleportWindowAction action);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(MultiProfileUMA);
};

@ -81,6 +81,7 @@
#include "ui/views/corewm/window_animations.h"
#if defined(OS_CHROMEOS)
#include "ash/multi_profile_uma.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "chrome/browser/chromeos/login/wallpaper_manager.h"
@ -1041,6 +1042,8 @@ void ChromeLauncherController::ActivateWindowOrMinimizeIfActive(
const std::string& current_user =
manager->GetUserIDFromProfile(profile());
if (!manager->IsWindowOnDesktopOfUser(native_window, current_user)) {
ash::MultiProfileUMA::RecordTeleportAction(
ash::MultiProfileUMA::TELEPORT_WINDOW_RETURN_BY_LAUNCHER);
manager->ShowWindowForUser(native_window, current_user);
window->Activate();
return;

@ -7,6 +7,7 @@
#include "apps/shell_window.h"
#include "apps/shell_window_registry.h"
#include "ash/ash_switches.h"
#include "ash/multi_profile_uma.h"
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
@ -95,17 +96,22 @@ MultiUserWindowManager* MultiUserWindowManager::GetInstance() {
}
MultiUserWindowManager* MultiUserWindowManager::CreateInstance() {
ash::MultiProfileUMA::SessionMode mode =
ash::MultiProfileUMA::SESSION_SINGLE_USER_MODE;
if (!g_instance &&
ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled() &&
!ash::switches::UseFullMultiProfileMode()) {
g_instance = CreateInstanceInternal(
ash::Shell::GetInstance()->session_state_delegate()->GetUserID(0));
multi_user_mode_ = MULTI_PROFILE_MODE_SEPARATED;
mode = ash::MultiProfileUMA::SESSION_SEPARATE_DESKTOP_MODE;
} else if (ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) {
multi_user_mode_ = MULTI_PROFILE_MODE_MIXED;
mode = ash::MultiProfileUMA::SESSION_SIDE_BY_SIDE_MODE;
} else {
multi_user_mode_ = MULTI_PROFILE_MODE_OFF;
}
ash::MultiProfileUMA::RecordSessionMode(mode);
return g_instance;
}
@ -199,6 +205,9 @@ void MultiUserWindowManager::ShowWindowForUser(aura::Window* window,
if (user_id != owner && ash::wm::GetWindowState(window)->IsMinimized())
return;
ash::MultiProfileUMA::RecordTeleportAction(
ash::MultiProfileUMA::TELEPORT_WINDOW_RETURN_BY_MINIMIZE);
WindowToEntryMap::iterator it = window_to_entry_.find(window);
it->second->set_show_for_user(user_id);

@ -4,6 +4,7 @@
#include "chrome/browser/ui/ash/session_state_delegate_chromeos.h"
#include "ash/multi_profile_uma.h"
#include "ash/session_state_observer.h"
#include "base/command_line.h"
#include "base/logging.h"
@ -174,6 +175,10 @@ bool SessionStateDelegateChromeos::TransferWindowToDesktopOfUser(
chrome::MultiUserWindowManager::GetInstance();
if (!window_manager || window_manager->GetWindowOwner(window).empty())
return false;
ash::MultiProfileUMA::RecordTeleportAction(
ash::MultiProfileUMA::TELEPORT_WINDOW_DRAG_AND_DROP);
DCHECK_LT(index, NumberOfLoggedInUsers());
window_manager->ShowWindowForUser(window,
chromeos::UserManager::Get()->GetLRULoggedInUsers()[index]->email());

@ -57,6 +57,7 @@
#endif
#if defined(OS_CHROMEOS)
#include "ash/multi_profile_uma.h"
#include "ash/session_state_delegate.h"
#include "ash/shell.h"
#include "chrome/browser/ui/ash/multi_user_window_manager.h"
@ -462,6 +463,8 @@ void BrowserCommandController::ExecuteCommandWithDisposition(
#if defined(OS_CHROMEOS)
case IDC_VISIT_DESKTOP_OF_LRU_USER_2:
case IDC_VISIT_DESKTOP_OF_LRU_USER_3: {
ash::MultiProfileUMA::RecordTeleportAction(
ash::MultiProfileUMA::TELEPORT_WINDOW_CAPTION_MENU);
// When running the multi user mode on Chrome OS, windows can "visit"
// another user's desktop.
const std::string& user_id =

@ -6839,6 +6839,13 @@ other types of suffix sets.
</summary>
</histogram>
<histogram name="MultiProfile.SessionMode" enum="MultiProfileSessionMode">
<summary>
The session counter for different multi profile modes which gets stored once
per session at the beginning of the session.
</summary>
</histogram>
<histogram name="MultiProfile.SigninUserUIPath"
enum="MultiProfileSigninUserAction">
<summary>
@ -6857,6 +6864,14 @@ other types of suffix sets.
</summary>
</histogram>
<histogram name="MultiProfile.TeleportWindow"
enum="MultiProfileTeleportWindowAction">
<summary>
Counts the number of window teleportations when using separated desktop
mode.
</summary>
</histogram>
<histogram name="Multiprofile.UserCount">
<summary>
The number of users simultaneously signed into a multiprofile session on
@ -24959,6 +24974,12 @@ other types of suffix sets.
<int value="9" label="OPUS"/>
</enum>
<enum name="MultiProfileSessionMode" type="int">
<int value="0" label="Single user mode"/>
<int value="1" label="Side by side mode"/>
<int value="2" label="Separate desktop mode"/>
</enum>
<enum name="MultiProfileSigninUserAction" type="int">
<int value="0" label="System tray"/>
<int value="1" label="Browser frame"/>
@ -24969,6 +24990,13 @@ other types of suffix sets.
<int value="1" label="Keyboard accelerator"/>
</enum>
<enum name="MultiProfileTeleportWindowAction" type="int">
<int value="0" label="Drag and drop"/>
<int value="1" label="Caption context menu"/>
<int value="2" label="Return by minimize"/>
<int value="3" label="Return by launcher"/>
</enum>
<enum name="NavigationScheme" type="int">
<int value="0" label="(Unknown)"/>
<int value="1" label="http"/>