Commit a4afc43b authored by skuhne@chromium.org's avatar skuhne@chromium.org

Changing the UsersPerSession UMA metric to count relative user amount changes...

Changing the UsersPerSession UMA metric to count relative user amount changes for sessions which can do multi profile

The old absolute UMA counter was stored upon shutdown. Unfortunately only one in 33 users is shutting down the system properly. As such only a fraction of sessions were accounted for => the values were useless. Furthermore we have decided to only count sessions which could be multi profile sessions.

The new values are recording state changes like e.g. going from one user to two in a single session. As such you might get a resulting stat counter list of:

1: 320 => 320 - 15 - 4 - 1 = 300 single user sessions
2: 15  =>       15 - 4 - 1 = 10  two user sessions
3: 4   =>            4 - 1 = 3   three user sessions
4: 1   =>                    1   four user session

Note that it is not possible for a single user to leave a multi profile session - so the counter will always count up.

BUG=349055
TEST=none

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255865 0039d316-1c4b-4281-b951-d872f2087c98
parent 608fdfab
......@@ -45,7 +45,8 @@ void MultiProfileUMA::RecordTeleportAction(TeleportWindowAction action) {
// static
void MultiProfileUMA::RecordUserCount(int number_of_users) {
UMA_HISTOGRAM_COUNTS_100("MultiProfile.UsersPerSession", number_of_users);
UMA_HISTOGRAM_COUNTS_100("MultiProfile.UsersPerSessionIncremental",
number_of_users);
}
// static
......
......@@ -69,7 +69,8 @@ class ASH_EXPORT MultiProfileUMA {
// Record the way and how many times a window got teleported to another desk.
static void RecordTeleportAction(TeleportWindowAction action);
// Record number of users joined into a session. Called upon logout.
// Record number of users joined into a session. Called every time a user gets
// added.
static void RecordUserCount(int number_of_users);
// Record a discarded tab in the number of running users bucket.
......
......@@ -7,6 +7,7 @@
#include <cstddef>
#include <set>
#include "ash/multi_profile_uma.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
......@@ -2039,6 +2040,13 @@ void UserManagerImpl::DoUpdateAccountLocale(
}
void UserManagerImpl::UpdateNumberOfUsers() {
size_t users = GetLoggedInUsers().size();
if (users) {
// Write the user number as UMA stat when a multi user session is possible.
if ((users + GetUsersAdmittedForMultiProfile().size()) > 1)
ash::MultiProfileUMA::RecordUserCount(users);
}
base::debug::SetCrashKeyValue(crash_keys::kNumberOfUsers,
base::StringPrintf("%" PRIuS, GetLoggedInUsers().size()));
}
......
......@@ -36,8 +36,6 @@
#include "content/public/browser/notification_service.h"
#if defined(OS_CHROMEOS)
#include "ash/multi_profile_uma.h"
#include "ash/session_state_delegate.h"
#include "base/sys_info.h"
#include "chrome/browser/chromeos/boot_times_loader.h"
#include "chrome/browser/chromeos/login/user_manager.h"
......@@ -150,12 +148,6 @@ void AttemptUserExit() {
const char kLogoutStarted[] = "logout-started";
chromeos::BootTimesLoader::Get()->RecordCurrentStats(kLogoutStarted);
// Since we are shutting down now we should record how many users have joined
// the session since session start.
ash::MultiProfileUMA::RecordUserCount(
ash::Shell::GetInstance()->session_state_delegate()->
NumberOfLoggedInUsers());
// Login screen should show up in owner's locale.
PrefService* state = g_browser_process->local_state();
if (state) {
......
......@@ -8072,8 +8072,8 @@ other types of suffix sets.
The relation of discarded tabs vs. the amount of simultaneous users. The
counts are the number of discards and the buckets are the number of users.
Since the count values are absolute numbers, they need to be normalized
before use - so divide the counts by the percentage of users found under
'MultiProfile.UsersPerSession'.
before use - so divide the counts by the percentage of users per session
found under 'MultiProfile.UsersPerSessionIncremental'.
</summary>
</histogram>
......@@ -8118,9 +8118,22 @@ other types of suffix sets.
</histogram>
<histogram name="MultiProfile.UsersPerSession">
<obsolete>
Deprecated 3/2014, renamed to MultiProfile.UsersPerSessionIncremental.
</obsolete>
<summary>
The number of users simultaneously signed into a multiprofile session on
Chrome OS. This is recorded upon session end.
</summary>
</histogram>
<histogram name="MultiProfile.UsersPerSessionIncremental">
<summary>
The number of users simultaneously signed into a multiprofile session on
Chrome OS. This is recorded whenever a new user logs in.
Chrome OS. This is recorded whenever a user gets added to the session. To
get the correct count, all following counts must be subtracted. Example: If
100 single user, 20 two user and 5 three user sessions, there were
100-20-5=75 single user sessions, 100-80=20 dual user sessions and so on.
</summary>
</histogram>
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