summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpam@chromium.org <pam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-07 08:44:08 +0000
committerpam@chromium.org <pam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-07 08:44:08 +0000
commit8f89192a13f0675bce07f2bfd572991e4fe8637c (patch)
tree0772ca5f1be9799abc17f642e5c3b6c101bc5572
parentdcacee6d1da3beba9c008f82d483c32931f37537 (diff)
downloadchromium_src-8f89192a13f0675bce07f2bfd572991e4fe8637c.zip
chromium_src-8f89192a13f0675bce07f2bfd572991e4fe8637c.tar.gz
chromium_src-8f89192a13f0675bce07f2bfd572991e4fe8637c.tar.bz2
Add a histogram to track profile creation time, and a way to disable the timeout.
Tracking how long it takes to create a profile primarily gives data on how long registration takes for managed users; similarly, knowing how many attempts take the maximum allowed time gives data on timeouts. Profile creation is unlikely to take more than a second -- if that -- for non-managed users. BUG=246518 Review URL: https://chromiumcodereview.appspot.com/16483002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204762 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/managed_mode/managed_user_registration_service.cc21
-rw-r--r--chrome/browser/ui/webui/options/browser_options_handler.cc13
-rw-r--r--chrome/browser/ui/webui/options/browser_options_handler.h4
-rw-r--r--chrome/common/chrome_switches.cc5
-rw-r--r--chrome/common/chrome_switches.h1
5 files changed, 37 insertions, 7 deletions
diff --git a/chrome/browser/managed_mode/managed_user_registration_service.cc b/chrome/browser/managed_mode/managed_user_registration_service.cc
index 1ee0972..b82ed70 100644
--- a/chrome/browser/managed_mode/managed_user_registration_service.cc
+++ b/chrome/browser/managed_mode/managed_user_registration_service.cc
@@ -6,6 +6,7 @@
#include "base/base64.h"
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/prefs/pref_service.h"
#include "base/rand_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -14,6 +15,7 @@
#include "chrome/browser/managed_mode/managed_user_service_factory.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/sync/glue/device_info.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/user_prefs/pref_registry_syncable.h"
#include "google_apis/gaia/gaia_urls.h"
@@ -36,7 +38,8 @@ using syncer::SyncMergeResult;
using sync_pb::ManagedUserSpecifics;
using user_prefs::PrefRegistrySyncable;
-// How long to wait before canceling user registration.
+// How long to wait before canceling user registration. If this is changed, the
+// histogram limits in the BrowserOptionsHandler should also be updated.
static const int kRegistrationTimeoutMS = 30 * 1000;
namespace {
@@ -90,12 +93,16 @@ void ManagedUserRegistrationService::Register(
DCHECK(!registration_timer_.IsRunning());
callback_ = callback;
- registration_timer_.Start(
- FROM_HERE,
- base::TimeDelta::FromMilliseconds(kRegistrationTimeoutMS),
- base::Bind(&ManagedUserRegistrationService::CancelPendingRegistrationImpl,
- weak_ptr_factory_.GetWeakPtr(),
- GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED)));
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kNoManagedUserRegistrationTimeout)) {
+ registration_timer_.Start(
+ FROM_HERE,
+ base::TimeDelta::FromMilliseconds(kRegistrationTimeoutMS),
+ base::Bind(
+ &ManagedUserRegistrationService::CancelPendingRegistrationImpl,
+ weak_ptr_factory_.GetWeakPtr(),
+ GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED)));
+ }
DictionaryPrefUpdate update(prefs_, prefs::kManagedUsers);
DictionaryValue* dict = update.Get();
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index 62a372d..471285c 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -1111,6 +1111,8 @@ void BrowserOptionsHandler::CreateProfile(const ListValue* args) {
DCHECK(profile_path_being_created_.empty());
+ profile_creation_start_time_ = base::TimeTicks::Now();
+
Browser* browser =
chrome::FindBrowserWithWebContents(web_ui()->GetWebContents());
chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE;
@@ -1182,6 +1184,11 @@ void BrowserOptionsHandler::ShowProfileCreationFeedback(
UMA_HISTOGRAM_ENUMERATION("Profile.CreateResult",
status,
Profile::MAX_CREATE_STATUS);
+ UMA_HISTOGRAM_CUSTOM_TIMES("Profile.CreateTime",
+ base::TimeTicks::Now() - profile_creation_start_time_,
+ base::TimeDelta::FromMilliseconds(1),
+ base::TimeDelta::FromSeconds(30), // From kRegistrationTimeoutMS.
+ 100);
}
switch (status) {
@@ -1275,6 +1282,12 @@ void BrowserOptionsHandler::DeleteProfileAtPath(base::FilePath file_path) {
void BrowserOptionsHandler::HandleCancelProfileCreation(const ListValue* args) {
CancelProfileCreation();
+
+ UMA_HISTOGRAM_CUSTOM_TIMES("Profile.CreateTimeCanceled",
+ base::TimeTicks::Now() - profile_creation_start_time_,
+ base::TimeDelta::FromMilliseconds(1),
+ base::TimeDelta::FromSeconds(30), // From kRegistrationTimeoutMS.
+ 100);
}
void BrowserOptionsHandler::CancelProfileCreation() {
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.h b/chrome/browser/ui/webui/options/browser_options_handler.h
index 156764b..c7041fd 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.h
+++ b/chrome/browser/ui/webui/options/browser_options_handler.h
@@ -11,6 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/prefs/pref_member.h"
+#include "base/time.h"
#include "chrome/browser/printing/cloud_print/cloud_print_setup_handler.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -322,6 +323,9 @@ class BrowserOptionsHandler
// cleared when all the callbacks have been run and creation is complete.
base::FilePath profile_path_being_created_;
+ // Used to track how long profile creation takes.
+ base::TimeTicks profile_creation_start_time_;
+
// Used to get WeakPtr to self for use on the UI thread.
base::WeakPtrFactory<BrowserOptionsHandler> weak_ptr_factory_;
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index ddd5da1..7e76a71 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -980,6 +980,11 @@ const char kNoJsRandomness[] = "no-js-randomness";
// Starts the browser outside of managed mode.
const char kNoManaged[] = "no-managed";
+// Disables the timeout during registration of a new managed-user profile;
+// useful for debugging.
+const char kNoManagedUserRegistrationTimeout[] =
+ "no-managed-user-registration-timeout";
+
// Whether or not the browser should warn if the profile is on a network share.
// This flag is only relevant for Windows currently.
const char kNoNetworkProfileWarning[] = "no-network-profile-warning";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 90a0073..8eca363 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -263,6 +263,7 @@ extern const char kNoExperiments[];
extern const char kNoFirstRun[];
extern const char kNoJsRandomness[];
extern const char kNoManaged[];
+extern const char kNoManagedUserRegistrationTimeout[];
extern const char kNoNetworkProfileWarning[];
extern const char kNoProxyServer[];
extern const char kNoPings[];