| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/translate/core/common/translate_metrics.h" | 5 #include "components/translate/core/common/translate_metrics.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 | 9 |
| 10 namespace translate { | 10 namespace translate { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 void ReportLanguageVerification(LanguageVerificationType type) { | 76 void ReportLanguageVerification(LanguageVerificationType type) { |
| 77 UMA_HISTOGRAM_ENUMERATION(kTranslateLanguageVerification, | 77 UMA_HISTOGRAM_ENUMERATION(kTranslateLanguageVerification, |
| 78 type, | 78 type, |
| 79 LANGUAGE_VERIFICATION_MAX); | 79 LANGUAGE_VERIFICATION_MAX); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void ReportTimeToBeReady(double time_in_msec) { | 82 void ReportTimeToBeReady(double time_in_msec) { |
| 83 UMA_HISTOGRAM_MEDIUM_TIMES( | 83 UMA_HISTOGRAM_MEDIUM_TIMES( |
| 84 kTranslateTimeToBeReady, | 84 kTranslateTimeToBeReady, |
| 85 base::TimeDelta::FromMicroseconds(time_in_msec * 1000.0)); | 85 base::TimeDelta::FromMicroseconds( |
| 86 static_cast<int64>(time_in_msec * 1000.0))); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void ReportTimeToLoad(double time_in_msec) { | 89 void ReportTimeToLoad(double time_in_msec) { |
| 89 UMA_HISTOGRAM_MEDIUM_TIMES( | 90 UMA_HISTOGRAM_MEDIUM_TIMES( |
| 90 kTranslateTimeToLoad, | 91 kTranslateTimeToLoad, |
| 91 base::TimeDelta::FromMicroseconds(time_in_msec * 1000.0)); | 92 base::TimeDelta::FromMicroseconds( |
| 93 static_cast<int64>(time_in_msec * 1000.0))); |
| 92 } | 94 } |
| 93 | 95 |
| 94 void ReportTimeToTranslate(double time_in_msec) { | 96 void ReportTimeToTranslate(double time_in_msec) { |
| 95 UMA_HISTOGRAM_MEDIUM_TIMES( | 97 UMA_HISTOGRAM_MEDIUM_TIMES( |
| 96 kTranslateTimeToTranslate, | 98 kTranslateTimeToTranslate, |
| 97 base::TimeDelta::FromMicroseconds(time_in_msec * 1000.0)); | 99 base::TimeDelta::FromMicroseconds( |
| 100 static_cast<int64>(time_in_msec * 1000.0))); |
| 98 } | 101 } |
| 99 | 102 |
| 100 void ReportUserActionDuration(base::TimeTicks begin, base::TimeTicks end) { | 103 void ReportUserActionDuration(base::TimeTicks begin, base::TimeTicks end) { |
| 101 UMA_HISTOGRAM_LONG_TIMES(kTranslateUserActionDuration, end - begin); | 104 UMA_HISTOGRAM_LONG_TIMES(kTranslateUserActionDuration, end - begin); |
| 102 } | 105 } |
| 103 | 106 |
| 104 void ReportPageScheme(const std::string& scheme) { | 107 void ReportPageScheme(const std::string& scheme) { |
| 105 SchemeType type = SCHEME_OTHERS; | 108 SchemeType type = SCHEME_OTHERS; |
| 106 if (scheme == kSchemeHttp) | 109 if (scheme == kSchemeHttp) |
| 107 type = SCHEME_HTTP; | 110 type = SCHEME_HTTP; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 121 const char* GetMetricsName(MetricsNameIndex index) { | 124 const char* GetMetricsName(MetricsNameIndex index) { |
| 122 for (size_t i = 0; i < arraysize(kMetricsEntries); ++i) { | 125 for (size_t i = 0; i < arraysize(kMetricsEntries); ++i) { |
| 123 if (kMetricsEntries[i].index == index) | 126 if (kMetricsEntries[i].index == index) |
| 124 return kMetricsEntries[i].name; | 127 return kMetricsEntries[i].name; |
| 125 } | 128 } |
| 126 NOTREACHED(); | 129 NOTREACHED(); |
| 127 return NULL; | 130 return NULL; |
| 128 } | 131 } |
| 129 | 132 |
| 130 } // namespace translate | 133 } // namespace translate |
| OLD | NEW |