diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-14 22:12:06 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-14 22:12:06 +0000 |
commit | 989a1a68e1748f311ebf70f7e94d6cbcdf0ed679 (patch) | |
tree | c871038889e1c5335005afc6905ef2e55fc46abd /chrome | |
parent | c7aff9a658728effaceb6d88764003f7c2c95cdf (diff) | |
download | chromium_src-989a1a68e1748f311ebf70f7e94d6cbcdf0ed679.zip chromium_src-989a1a68e1748f311ebf70f7e94d6cbcdf0ed679.tar.gz chromium_src-989a1a68e1748f311ebf70f7e94d6cbcdf0ed679.tar.bz2 |
Add login time metric for chromeos.
TEST=Tested by gmerge chromeos-chrome onto device and checking
about histograms.
Review URL: http://codereview.chromium.org/2899014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52411 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
3 files changed, 16 insertions, 2 deletions
diff --git a/chrome/browser/chromeos/browser_notification_observers.cc b/chrome/browser/chromeos/browser_notification_observers.cc index f63ade1..41c35dc 100644 --- a/chrome/browser/chromeos/browser_notification_observers.cc +++ b/chrome/browser/chromeos/browser_notification_observers.cc @@ -28,7 +28,10 @@ void InitialTabNotificationObserver::Observe( const NotificationDetails& details) { // Only log for first tab to render. Make sure this is only done once. if (type == NotificationType::LOAD_START && num_tabs_.GetNext() == 0) { - // If we can't post it, it doesn't matter. + // Post difference between first tab and login succeess time as login time. + UMA_HISTOGRAM_TIMES("BootTime.Login", + base::Time::NowFromSystemTime() - login_success_time_); + // Post chrome first render stat. BootTimesLoader::RecordCurrentStats("chrome-first-render"); registrar_.Remove(this, NotificationType::LOAD_START, NotificationService::AllSources()); @@ -49,7 +52,7 @@ void LogLoginSuccessObserver::Observe(NotificationType type, DCHECK(type == NotificationType::LOGIN_AUTHENTICATION); Details<AuthenticationNotificationDetails> auth_details(details); if (auth_details->success()) { - // If we can't post it, it doesn't matter. + InitialTabNotificationObserver::Get()->SetLoginSuccessTime(); BootTimesLoader::RecordCurrentStats("login-successful"); registrar_.Remove(this, NotificationType::LOGIN_AUTHENTICATION, NotificationService::AllSources()); diff --git a/chrome/browser/chromeos/browser_notification_observers.h b/chrome/browser/chromeos/browser_notification_observers.h index e2921af..13dacce 100644 --- a/chrome/browser/chromeos/browser_notification_observers.h +++ b/chrome/browser/chromeos/browser_notification_observers.h @@ -7,6 +7,7 @@ #include "base/atomic_sequence_num.h" #include "base/singleton.h" +#include "base/time.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_source.h" @@ -26,6 +27,10 @@ class InitialTabNotificationObserver : public NotificationObserver { return Singleton<InitialTabNotificationObserver>::get(); } + void SetLoginSuccessTime() { + login_success_time_ = base::Time::NowFromSystemTime(); + } + // NotificationObserver implementation. virtual void Observe(NotificationType type, const NotificationSource& source, @@ -34,6 +39,7 @@ class InitialTabNotificationObserver : public NotificationObserver { private: NotificationRegistrar registrar_; base::AtomicSequenceNumber num_tabs_; + base::Time login_success_time_; DISALLOW_COPY_AND_ASSIGN(InitialTabNotificationObserver); }; diff --git a/chrome/browser/chromeos/login/google_authenticator.cc b/chrome/browser/chromeos/login/google_authenticator.cc index 6ccb437..5983c90 100644 --- a/chrome/browser/chromeos/login/google_authenticator.cc +++ b/chrome/browser/chromeos/login/google_authenticator.cc @@ -17,6 +17,7 @@ #include "base/third_party/nss/sha256.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" +#include "chrome/browser/chromeos/browser_notification_observers.h" #include "chrome/browser/chromeos/cros/cryptohome_library.h" #include "chrome/browser/chromeos/login/auth_response_handler.h" #include "chrome/browser/chromeos/login/authentication_notification_details.h" @@ -54,6 +55,10 @@ GoogleAuthenticator::GoogleAuthenticator(LoginStatusConsumer* consumer) unlock_(false), try_again_(true) { CHECK(chromeos::CrosLibrary::Get()->EnsureLoaded()); + + // This forces the creation of the login notification observer + // singleton. It must be created to record login time. + chromeos::LogLoginSuccessObserver::Get(); } GoogleAuthenticator::~GoogleAuthenticator() {} |