diff options
author | brg@chromium.com <brg@chromium.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 02:17:06 +0000 |
---|---|---|
committer | brg@chromium.com <brg@chromium.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 02:17:06 +0000 |
commit | 1f97a11d47048f09134e36265661c1082d1f82d3 (patch) | |
tree | 30e8c919ec8f50a77b61dc1347d3d0ff6cac26a6 /chrome/browser/sync | |
parent | 4e6719f89e1323405252edb5ea78084cb7867562 (diff) | |
download | chromium_src-1f97a11d47048f09134e36265661c1082d1f82d3.zip chromium_src-1f97a11d47048f09134e36265661c1082d1f82d3.tar.gz chromium_src-1f97a11d47048f09134e36265661c1082d1f82d3.tar.bz2 |
Add UMA histograms for chrome-sync.We add the following histograms:Sync.MergeAndSyncNeededCountNumber of times merge and sync is needed to run.Sync.AuthorizationTimeTime taken during initial authorization.Sync.UserPerceivedAuthorizationTimeTime the user spends looking at the authorization dialog.Sync.BookmarkAssociationTimeTime taken during bookmark association.Sync.ReauthorizationTimeTime taken from startup for the user to reauthorize.
Sync.Events
This is an enumeration of distinct events of the following types:
Number of times sync was started from the ad in NTP.Number of times sync was started from the Wrench menu.Number of times sync was started from Wrench->Options.Number of times sync was stopped from Wrench->Options.Number of times sync was stopped during the sign-on process.Number of times sync was stopped after successfully authorized.Number of times sync was cancelled when the merge dialog was surfaces.
BUG=None.
Test=None.
Review URL: http://codereview.chromium.org/165111
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23001 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r-- | chrome/browser/sync/personalization.cc | 1 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.cc | 36 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.h | 29 |
3 files changed, 65 insertions, 1 deletions
diff --git a/chrome/browser/sync/personalization.cc b/chrome/browser/sync/personalization.cc index 8bd3c0d..8e8b6a6b 100644 --- a/chrome/browser/sync/personalization.cc +++ b/chrome/browser/sync/personalization.cc @@ -160,6 +160,7 @@ void HandleMenuItemClick(Profile* p) { ShowOptionsWindow(OPTIONS_PAGE_CONTENT, OPTIONS_GROUP_NONE, p); } else { service->EnableForUser(); + ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_WRENCH); } } diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index a832870..910563a 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -13,6 +13,7 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/gfx/png_encoder.h" +#include "base/histogram.h" #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/time.h" @@ -551,6 +552,10 @@ void ProfileSyncService::OnAuthError() { expecting_first_run_auth_needed_event_ = false; } + if (!wizard_.IsVisible()) { + auth_error_time_ == base::TimeTicks::Now(); + } + is_auth_in_progress_ = false; // Fan the notification out to interested UI-thread components. FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); @@ -559,6 +564,13 @@ void ProfileSyncService::OnAuthError() { void ProfileSyncService::ShowLoginDialog() { if (wizard_.IsVisible()) return; + + if (!auth_error_time_.is_null()) { + UMA_HISTOGRAM_LONG_TIMES("Sync.ReauthorizationTime", + base::TimeTicks::Now() - auth_error_time_); + auth_error_time_ = base::TimeTicks(); // Reset auth_error_time_ to null. + } + if (last_auth_error_ != AUTH_ERROR_NONE) wizard_.Step(SyncSetupWizard::GAIA_LOGIN); } @@ -806,7 +818,7 @@ std::wstring ProfileSyncService::GetLastSyncedTimeString() const { return TimeFormat::TimeElapsed(last_synced); } -string16 ProfileSyncService::GetAuthenticatedUsername() const { +string16 ProfileSyncService::GetAuthenticatedUsername() const { return backend_->GetAuthenticatedUsername(); } @@ -815,11 +827,19 @@ void ProfileSyncService::OnUserSubmittedAuth( last_attempted_user_email_ = username; is_auth_in_progress_ = true; FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); + + base::TimeTicks start_time = base::TimeTicks::Now(); backend_->Authenticate(username, password); + UMA_HISTOGRAM_TIMES("Sync.AuthorizationTime", + base::TimeTicks::Now() - start_time); } void ProfileSyncService::OnUserAcceptedMergeAndSync() { + base::TimeTicks start_time = base::TimeTicks::Now(); bool merge_success = model_associator_->AssociateModels(); + UMA_HISTOGRAM_TIMES("Sync.BookmarkAssociationWithUITime", + base::TimeTicks::Now() - start_time); + wizard_.Step(SyncSetupWizard::DONE); // TODO(timsteele): error state? if (!merge_success) { LOG(ERROR) << "Model assocation failed."; @@ -837,6 +857,7 @@ void ProfileSyncService::OnUserCancelledDialog() { // Rollback. DisableForUser(); } + FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); } @@ -854,12 +875,17 @@ void ProfileSyncService::StartProcessingChangesIfReady() { // Show the sync merge warning dialog if needed. if (MergeAndSyncAcceptanceNeeded()) { + ProfileSyncService::SyncEvent(MERGE_AND_SYNC_NEEDED); wizard_.Step(SyncSetupWizard::MERGE_AND_SYNC); return; } // We're ready to merge the models. + base::TimeTicks start_time = base::TimeTicks::Now(); bool merge_success = model_associator_->AssociateModels(); + UMA_HISTOGRAM_TIMES("Sync.BookmarkAssociationTime", + base::TimeTicks::Now() - start_time); + wizard_.Step(SyncSetupWizard::DONE); // TODO(timsteele): error state? if (!merge_success) { LOG(ERROR) << "Model assocation failed."; @@ -879,6 +905,14 @@ void ProfileSyncService::RemoveObserver(Observer* observer) { observers_.RemoveObserver(observer); } +void ProfileSyncService::SyncEvent(SyncEventCodes code) { + static LinearHistogram histogram("Sync.EventCodes", MIN_SYNC_EVENT_CODE, + MAX_SYNC_EVENT_CODE - 1, + MAX_SYNC_EVENT_CODE); + histogram.SetFlags(kUmaTargetedHistogramFlag); + histogram.Add(code); +} + bool ProfileSyncService::ShouldPushChanges() { return ready_to_process_changes_ && // Wait for model load and merge. !unrecoverable_error_detected_; // Halt after any terrible events. diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index d91edbe..0301647 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -53,6 +53,29 @@ class ProfileSyncService : public BookmarkModelObserver, typedef ProfileSyncServiceObserver Observer; typedef browser_sync::SyncBackendHost::Status Status; + enum SyncEventCodes { + MIN_SYNC_EVENT_CODE = 0, + + // Events starting the sync service. + START_FROM_NTP = 1, // Sync was started from the ad in NTP + START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. + START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options. + + // Events regarding cancelation of the signon process of sync. + CANCEL_FROM_SIGNON_WIHTOUT_AUTH = 10, // Cancelled before submitting + // username and password. + CANCEL_DURING_SIGNON = 11, // Cancelled after auth. + CANCEL_DURING_SIGNON_AFTER_MERGE = 12, // Cancelled during merge. + + // Events resulting in the stoppage of sync service. + STOP_FROM_OPTIONS = 20, // Sync was stopped from Wrench->Options. + + // Miscellaneous events caused by sync service. + MERGE_AND_SYNC_NEEDED = 30, + + MAX_SYNC_EVENT_CODE + }; + explicit ProfileSyncService(Profile* profile); virtual ~ProfileSyncService(); @@ -169,6 +192,9 @@ class ProfileSyncService : public BookmarkModelObserver, void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); + // Record stats on various events. + static void SyncEvent(SyncEventCodes code); + protected: // Call this after any of the subsystems being synced (the bookmark // model and the sync backend) finishes its initialization. When everything @@ -308,6 +334,9 @@ class ProfileSyncService : public BookmarkModelObserver, // Sets the last synced time to the current time. void UpdateLastSyncedTime(); + // Time at which error UI is presented for the NTP. + base::TimeTicks auth_error_time_; + // The profile whose data we are synchronizing. Profile* profile_; |