| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/arc/arc_optin_uma.h" | 5 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_functions.h" |
| 7 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 8 | 9 |
| 9 namespace arc { | 10 namespace arc { |
| 10 | 11 |
| 11 void UpdateOptInActionUMA(OptInActionType type) { | 12 void UpdateOptInActionUMA(OptInActionType type) { |
| 12 UMA_HISTOGRAM_ENUMERATION("Arc.OptInAction", static_cast<int>(type), | 13 UMA_HISTOGRAM_ENUMERATION("Arc.OptInAction", static_cast<int>(type), |
| 13 static_cast<int>(OptInActionType::SIZE)); | 14 static_cast<int>(OptInActionType::SIZE)); |
| 14 } | 15 } |
| 15 | 16 |
| 16 void UpdateOptInCancelUMA(OptInCancelReason reason) { | 17 void UpdateOptInCancelUMA(OptInCancelReason reason) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 42 // The macro UMA_HISTOGRAM_CUSTOM_TIMES expects a constant string, but since | 43 // The macro UMA_HISTOGRAM_CUSTOM_TIMES expects a constant string, but since |
| 43 // this measurement happens very infrequently, we do not need to use a macro | 44 // this measurement happens very infrequently, we do not need to use a macro |
| 44 // here. | 45 // here. |
| 45 base::Histogram::FactoryTimeGet( | 46 base::Histogram::FactoryTimeGet( |
| 46 histogram_name, base::TimeDelta::FromSeconds(1), | 47 histogram_name, base::TimeDelta::FromSeconds(1), |
| 47 base::TimeDelta::FromMinutes(6), 50, | 48 base::TimeDelta::FromMinutes(6), 50, |
| 48 base::HistogramBase::kUmaTargetedHistogramFlag) | 49 base::HistogramBase::kUmaTargetedHistogramFlag) |
| 49 ->AddTime(elapsed_time); | 50 ->AddTime(elapsed_time); |
| 50 } | 51 } |
| 51 | 52 |
| 53 void UpdateAuthTiming(const char* histogram_name, |
| 54 base::TimeDelta elapsed_time) { |
| 55 base::UmaHistogramCustomTimes(histogram_name, elapsed_time, |
| 56 base::TimeDelta::FromSeconds(1) /* minimum */, |
| 57 base::TimeDelta::FromMinutes(3) /* maximum */, |
| 58 50 /* bucket_count */); |
| 59 } |
| 60 |
| 61 void UpdateAuthCheckinAttempts(int32_t num_attempts) { |
| 62 UMA_HISTOGRAM_SPARSE_SLOWLY("ArcAuth.CheckinAttempts", num_attempts); |
| 63 } |
| 64 |
| 52 void UpdateSilentAuthCodeUMA(OptInSilentAuthCode state) { | 65 void UpdateSilentAuthCodeUMA(OptInSilentAuthCode state) { |
| 53 UMA_HISTOGRAM_ENUMERATION("Arc.OptInSilentAuthCode", static_cast<int>(state), | 66 UMA_HISTOGRAM_ENUMERATION("Arc.OptInSilentAuthCode", static_cast<int>(state), |
| 54 static_cast<int>(OptInSilentAuthCode::SIZE)); | 67 static_cast<int>(OptInSilentAuthCode::SIZE)); |
| 55 } | 68 } |
| 56 | 69 |
| 57 std::ostream& operator<<(std::ostream& os, const ProvisioningResult& result) { | 70 std::ostream& operator<<(std::ostream& os, const ProvisioningResult& result) { |
| 58 #define MAP_PROVISIONING_RESULT(name) \ | 71 #define MAP_PROVISIONING_RESULT(name) \ |
| 59 case ProvisioningResult::name: \ | 72 case ProvisioningResult::name: \ |
| 60 return os << #name | 73 return os << #name |
| 61 | 74 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 84 | 97 |
| 85 #undef MAP_PROVISIONING_RESULT | 98 #undef MAP_PROVISIONING_RESULT |
| 86 | 99 |
| 87 // Some compilers report an error even if all values of an enum-class are | 100 // Some compilers report an error even if all values of an enum-class are |
| 88 // covered exhaustively in a switch statement. | 101 // covered exhaustively in a switch statement. |
| 89 NOTREACHED() << "Invalid value " << static_cast<int>(result); | 102 NOTREACHED() << "Invalid value " << static_cast<int>(result); |
| 90 return os; | 103 return os; |
| 91 } | 104 } |
| 92 | 105 |
| 93 } // namespace arc | 106 } // namespace arc |
| OLD | NEW |