OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/profiles/profile_metrics.h" | 5 #include "chrome/browser/profiles/profile_metrics.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 NUM_PROFILE_AVATAR_METRICS | 67 NUM_PROFILE_AVATAR_METRICS |
68 }; | 68 }; |
69 | 69 |
70 void ProfileMetrics::LogNumberOfProfiles(ProfileManager* manager) { | 70 void ProfileMetrics::LogNumberOfProfiles(ProfileManager* manager) { |
71 const ProfileInfoCache& info_cache = manager->GetProfileInfoCache(); | 71 const ProfileInfoCache& info_cache = manager->GetProfileInfoCache(); |
72 size_t number_of_profiles = info_cache.GetNumberOfProfiles(); | 72 size_t number_of_profiles = info_cache.GetNumberOfProfiles(); |
73 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfProfiles", | 73 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfProfiles", |
74 number_of_profiles); | 74 number_of_profiles); |
75 | 75 |
76 // Ignore other metrics if we have no profiles, e.g. in Chrome Frame tests. | 76 // Ignore other metrics if we have no profiles, e.g. in Chrome Frame tests. |
77 if (number_of_profiles) { | 77 if (!number_of_profiles) |
78 size_t number_of_managed_profiles = 0; | 78 return; |
79 size_t number_of_signed_in_profiles = 0; | 79 |
80 for (size_t i = 0; i < number_of_profiles; ++i) { | 80 size_t number_of_managed_profiles = 0; |
81 if (info_cache.ProfileIsManagedAtIndex(i)) | 81 size_t number_of_signed_in_profiles = 0; |
82 ++number_of_managed_profiles; | 82 |
83 if (!info_cache.GetUserNameOfProfileAtIndex(i).empty()) | 83 const std::vector<ProfileInfoEntry> entries(info_cache.GetProfilesSortedByName
()); |
84 ++number_of_signed_in_profiles; | 84 for (std::vector<ProfileInfoEntry>::const_iterator it = entries.begin(); |
85 } | 85 it != entries.end(); ++it) { |
86 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfManagedProfiles", | 86 if (it->IsManaged()) |
87 number_of_managed_profiles); | 87 ++number_of_managed_profiles; |
88 UMA_HISTOGRAM_COUNTS_100("Profile.PercentageOfManagedProfiles", | 88 if (!it->user_name().empty()) |
89 100 * number_of_managed_profiles / number_of_profiles); | 89 ++number_of_signed_in_profiles; |
90 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfiles", | |
91 number_of_signed_in_profiles); | |
92 } | 90 } |
| 91 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfManagedProfiles", |
| 92 number_of_managed_profiles); |
| 93 UMA_HISTOGRAM_COUNTS_100("Profile.PercentageOfManagedProfiles", |
| 94 100 * number_of_managed_profiles / number_of_profiles); |
| 95 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSignedInProfiles", |
| 96 number_of_signed_in_profiles); |
93 } | 97 } |
94 | 98 |
95 void ProfileMetrics::LogProfileAddNewUser(ProfileAdd metric) { | 99 void ProfileMetrics::LogProfileAddNewUser(ProfileAdd metric) { |
96 DCHECK(metric < NUM_PROFILE_ADD_METRICS); | 100 DCHECK(metric < NUM_PROFILE_ADD_METRICS); |
97 UMA_HISTOGRAM_ENUMERATION("Profile.AddNewUser", metric, | 101 UMA_HISTOGRAM_ENUMERATION("Profile.AddNewUser", metric, |
98 NUM_PROFILE_ADD_METRICS); | 102 NUM_PROFILE_ADD_METRICS); |
99 UMA_HISTOGRAM_ENUMERATION("Profile.NetUserCount", ADD_NEW_USER, | 103 UMA_HISTOGRAM_ENUMERATION("Profile.NetUserCount", ADD_NEW_USER, |
100 NUM_PROFILE_NET_METRICS); | 104 NUM_PROFILE_NET_METRICS); |
101 } | 105 } |
102 | 106 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", | 245 UMA_HISTOGRAM_ENUMERATION("Profile.SyncSignIn", |
242 GetProfileType(profile_path), | 246 GetProfileType(profile_path), |
243 NUM_PROFILE_TYPE_METRICS); | 247 NUM_PROFILE_TYPE_METRICS); |
244 } | 248 } |
245 | 249 |
246 void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) { | 250 void ProfileMetrics::LogProfileUpdate(const base::FilePath& profile_path) { |
247 UMA_HISTOGRAM_ENUMERATION("Profile.Update", | 251 UMA_HISTOGRAM_ENUMERATION("Profile.Update", |
248 GetProfileType(profile_path), | 252 GetProfileType(profile_path), |
249 NUM_PROFILE_TYPE_METRICS); | 253 NUM_PROFILE_TYPE_METRICS); |
250 } | 254 } |
OLD | NEW |