Index: chrome/browser/profiles/profile_metrics.cc |
=================================================================== |
--- chrome/browser/profiles/profile_metrics.cc (revision 113419) |
+++ chrome/browser/profiles/profile_metrics.cc (working copy) |
@@ -11,11 +11,13 @@ |
#include "chrome/browser/profiles/profile_info_cache.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/common/chrome_constants.h" |
+#include "content/public/browser/browser_thread.h" |
namespace { |
ProfileMetrics::ProfileType GetProfileType( |
- FilePath& profile_path) { |
+ const FilePath& profile_path) { |
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
ProfileMetrics::ProfileType metric = ProfileMetrics::SECONDARY; |
ProfileManager* manager = g_browser_process->profile_manager(); |
FilePath user_data_dir; |
@@ -63,6 +65,27 @@ |
NUM_PROFILE_AVATAR_METRICS |
}; |
+void ProfileMetrics::LogNumberOfProfiles(ProfileManager* manager, |
+ ProfileEvent startup) { |
+ size_t number_of_profiles = |
+ manager->GetProfileInfoCache().GetNumberOfProfiles(); |
+ if (startup == STARTUP_PROFILE_EVENT) { |
+ UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfProfilesOnStartup", |
+ number_of_profiles); |
+ } else { |
+ UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfProfilesAfterAddOrDelete", |
jar (doing other things)
2011/12/10 22:07:44
I'm curious, do you really expect the distribution
rpetterson
2011/12/11 08:46:12
Because this is a stat which changes during usage,
|
+ number_of_profiles); |
+ } |
+} |
+ |
+void ProfileMetrics::LogProfileAddNewUser(ProfileAdd metric) { |
+ DCHECK(metric < NUM_PROFILE_ADD_METRICS); |
+ UMA_HISTOGRAM_ENUMERATION("Profile.AddNewUser", metric, |
+ NUM_PROFILE_ADD_METRICS); |
+ UMA_HISTOGRAM_ENUMERATION("Profile.NetUserCount", ADD_NEW_USER, |
+ NUM_PROFILE_NET_METRICS); |
+} |
+ |
void ProfileMetrics::LogProfileAvatarSelection(size_t icon_index) { |
DCHECK(icon_index < NUM_PROFILE_AVATAR_METRICS); |
ProfileAvatar icon_name = AVATAR_UNKNOWN; |
@@ -156,18 +179,24 @@ |
NUM_PROFILE_AVATAR_METRICS); |
} |
+void ProfileMetrics::LogProfileDeleteUser(ProfileNetUserCounts metric) { |
+ DCHECK(metric < NUM_PROFILE_NET_METRICS); |
+ UMA_HISTOGRAM_ENUMERATION("Profile.NetUserCount", metric, |
+ NUM_PROFILE_NET_METRICS); |
+} |
+ |
void ProfileMetrics::LogProfileOpenMethod(ProfileOpen metric) { |
DCHECK(metric < NUM_PROFILE_OPEN_METRICS); |
UMA_HISTOGRAM_ENUMERATION("Profile.OpenMethod", metric, |
NUM_PROFILE_OPEN_METRICS); |
} |
-void ProfileMetrics::LogProfileAddNewUser(ProfileAdd metric) { |
- DCHECK(metric < NUM_PROFILE_ADD_METRICS); |
- UMA_HISTOGRAM_ENUMERATION("Profile.AddNewUser", metric, |
- NUM_PROFILE_ADD_METRICS); |
- UMA_HISTOGRAM_ENUMERATION("Profile.NetUserCount", ADD_NEW_USER, |
- NUM_PROFILE_NET_METRICS); |
+void ProfileMetrics::LogProfileSwitchGaia(ProfileGaia metric) { |
+ if (metric == GAIA_OPT_IN) |
+ LogProfileAvatarSelection(AVATAR_GAIA); |
+ UMA_HISTOGRAM_ENUMERATION("Profile.SwitchGaiaPhotoSettings", |
+ metric, |
+ NUM_PROFILE_GAIA_METRICS); |
} |
void ProfileMetrics::LogProfileSwitchUser(ProfileOpen metric) { |
@@ -176,34 +205,26 @@ |
NUM_PROFILE_OPEN_METRICS); |
} |
-void ProfileMetrics::LogProfileDeleteUser(ProfileNetUserCounts metric) { |
- DCHECK(metric < NUM_PROFILE_NET_METRICS); |
- UMA_HISTOGRAM_ENUMERATION("Profile.NetUserCount", metric, |
- NUM_PROFILE_NET_METRICS); |
-} |
- |
void ProfileMetrics::LogProfileSyncInfo(ProfileSync metric) { |
DCHECK(metric < NUM_PROFILE_SYNC_METRICS); |
UMA_HISTOGRAM_ENUMERATION("Profile.SyncCustomize", metric, |
NUM_PROFILE_SYNC_METRICS); |
} |
-void ProfileMetrics::LogProfileUpdate(FilePath& profile_path) { |
- UMA_HISTOGRAM_ENUMERATION("Profile.Update", |
+void ProfileMetrics::LogProfileLaunch(const FilePath& profile_path) { |
+ UMA_HISTOGRAM_ENUMERATION("Profile.LaunchBrowser", |
GetProfileType(profile_path), |
NUM_PROFILE_TYPE_METRICS); |
} |
-void ProfileMetrics::LogProfileSyncSignIn(FilePath& profile_path) { |
+void ProfileMetrics::LogProfileSyncSignIn(const FilePath& profile_path) { |
UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", |
GetProfileType(profile_path), |
NUM_PROFILE_TYPE_METRICS); |
} |
-void ProfileMetrics::LogProfileSwitchGaia(ProfileGaia metric) { |
- if (metric == GAIA_OPT_IN) |
- LogProfileAvatarSelection(AVATAR_GAIA); |
- UMA_HISTOGRAM_ENUMERATION("Profile.SwitchGaiaPhotoSettings", |
- metric, |
- NUM_PROFILE_GAIA_METRICS); |
+void ProfileMetrics::LogProfileUpdate(const FilePath& profile_path) { |
+ UMA_HISTOGRAM_ENUMERATION("Profile.Update", |
+ GetProfileType(profile_path), |
+ NUM_PROFILE_TYPE_METRICS); |
} |