Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: chrome/browser/chromeos/arc/arc_optin_uma.cc

Issue 2704383006: arc: Handle metrics for Auth operations. (Closed)
Patch Set: update histogram.xml to match change Arc.Auth to ArcAuth Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string> 7 #include <string>
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // The macro UMA_HISTOGRAM_CUSTOM_TIMES expects a constant string, but since 44 // The macro UMA_HISTOGRAM_CUSTOM_TIMES expects a constant string, but since
45 // this measurement happens very infrequently, we do not need to use a macro 45 // this measurement happens very infrequently, we do not need to use a macro
46 // here. 46 // here.
47 base::Histogram::FactoryTimeGet( 47 base::Histogram::FactoryTimeGet(
48 histogram_name, base::TimeDelta::FromSeconds(1), 48 histogram_name, base::TimeDelta::FromSeconds(1),
49 base::TimeDelta::FromMinutes(6), 50, 49 base::TimeDelta::FromMinutes(6), 50,
50 base::HistogramBase::kUmaTargetedHistogramFlag) 50 base::HistogramBase::kUmaTargetedHistogramFlag)
51 ->AddTime(elapsed_time); 51 ->AddTime(elapsed_time);
52 } 52 }
53 53
54 void UpdateAuthTiming(const char* histogram_name,
55 base::TimeDelta elapsed_time) {
56 base::Histogram::FactoryTimeGet(
57 histogram_name, base::TimeDelta::FromSeconds(1) /* minimum */,
58 base::TimeDelta::FromMinutes(3) /* maximum */, 50 /* bucket_count */,
59 base::HistogramBase::kUmaTargetedHistogramFlag)
60 ->AddTime(elapsed_time);
Ilya Sherman 2017/02/23 21:23:34 Please use the convenience wrapper base::UmaHistog
khmel 2017/02/23 21:57:45 Done.
61 }
62
63 void UpdateAuthAttempts(const char* histogram_name, int32_t value) {
64 UMA_HISTOGRAM_CUSTOM_COUNTS(histogram_name, value, 0 /* minimum */,
65 5 /* maximum */, 6 /* bucket_count */);
Ilya Sherman 2017/02/23 21:23:34 Please use the convenience wrapper base::UmaHistog
khmel 2017/02/23 21:57:45 Thanks for detailed comment. I reserved it for pos
66 }
67
54 void UpdateSilentAuthCodeUMA(OptInSilentAuthCode state) { 68 void UpdateSilentAuthCodeUMA(OptInSilentAuthCode state) {
55 UMA_HISTOGRAM_ENUMERATION("Arc.OptInSilentAuthCode", static_cast<int>(state), 69 UMA_HISTOGRAM_ENUMERATION("Arc.OptInSilentAuthCode", static_cast<int>(state),
56 static_cast<int>(OptInSilentAuthCode::SIZE)); 70 static_cast<int>(OptInSilentAuthCode::SIZE));
57 } 71 }
58 72
59 std::ostream& operator<<(std::ostream& os, const ProvisioningResult& result) { 73 std::ostream& operator<<(std::ostream& os, const ProvisioningResult& result) {
60 #define MAP_PROVISIONING_RESULT(name) \ 74 #define MAP_PROVISIONING_RESULT(name) \
61 case ProvisioningResult::name: \ 75 case ProvisioningResult::name: \
62 return os << #name 76 return os << #name
63 77
(...skipping 22 matching lines...) Expand all
86 100
87 #undef MAP_PROVISIONING_RESULT 101 #undef MAP_PROVISIONING_RESULT
88 102
89 // Some compilers report an error even if all values of an enum-class are 103 // Some compilers report an error even if all values of an enum-class are
90 // covered exhaustively in a switch statement. 104 // covered exhaustively in a switch statement.
91 NOTREACHED() << "Invalid value " << static_cast<int>(result); 105 NOTREACHED() << "Invalid value " << static_cast<int>(result);
92 return os; 106 return os;
93 } 107 }
94 108
95 } // namespace arc 109 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698