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/data_reduction_proxy/browser/data_reduction_proxy_metrics.h " | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h " |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 original_length_with_data_reduction_enabled; | 105 original_length_with_data_reduction_enabled; |
106 } | 106 } |
107 UMA_HISTOGRAM_PERCENTAGE( | 107 UMA_HISTOGRAM_PERCENTAGE( |
108 "Net.DailyContentSavingPercent_DataReductionProxyEnabled", | 108 "Net.DailyContentSavingPercent_DataReductionProxyEnabled", |
109 percent_data_reduction_proxy_enabled); | 109 percent_data_reduction_proxy_enabled); |
110 | 110 |
111 UMA_HISTOGRAM_PERCENTAGE( | 111 UMA_HISTOGRAM_PERCENTAGE( |
112 "Net.DailyContentPercent_DataReductionProxyEnabled", | 112 "Net.DailyContentPercent_DataReductionProxyEnabled", |
113 (100 * received_length_with_data_reduction_enabled) / received_length); | 113 (100 * received_length_with_data_reduction_enabled) / received_length); |
114 | 114 |
115 if (https_length_with_data_reduction_enabled > 0) { | 115 DCHECK_GE(https_length_with_data_reduction_enabled, 0); |
116 UMA_HISTOGRAM_COUNTS( | 116 UMA_HISTOGRAM_COUNTS( |
117 "Net.DailyContentLength_DataReductionProxyEnabled_Https", | 117 "Net.DailyContentLength_DataReductionProxyEnabled_Https", |
118 https_length_with_data_reduction_enabled >> 10); | 118 https_length_with_data_reduction_enabled >> 10); |
119 UMA_HISTOGRAM_PERCENTAGE( | 119 UMA_HISTOGRAM_PERCENTAGE( |
120 "Net.DailyContentPercent_DataReductionProxyEnabled_Https", | 120 "Net.DailyContentPercent_DataReductionProxyEnabled_Https", |
121 (100 * https_length_with_data_reduction_enabled) / received_length); | 121 (100 * https_length_with_data_reduction_enabled) / received_length); |
122 } | |
123 | 122 |
124 if (short_bypass_length_with_data_reduction_enabled > 0) { | 123 DCHECK_GE(short_bypass_length_with_data_reduction_enabled, 0); |
125 UMA_HISTOGRAM_COUNTS( | 124 UMA_HISTOGRAM_COUNTS( |
126 "Net.DailyContentLength_DataReductionProxyEnabled_ShortBypass", | 125 "Net.DailyContentLength_DataReductionProxyEnabled_ShortBypass", |
127 short_bypass_length_with_data_reduction_enabled >> 10); | 126 short_bypass_length_with_data_reduction_enabled >> 10); |
128 UMA_HISTOGRAM_PERCENTAGE( | 127 UMA_HISTOGRAM_PERCENTAGE( |
129 "Net.DailyContentPercent_DataReductionProxyEnabled_ShortBypass", | 128 "Net.DailyContentPercent_DataReductionProxyEnabled_ShortBypass", |
130 ((100 * short_bypass_length_with_data_reduction_enabled) / | 129 ((100 * short_bypass_length_with_data_reduction_enabled) / |
131 received_length)); | 130 received_length)); |
132 } | |
133 | 131 |
134 if (long_bypass_length_with_data_reduction_enabled > 0) { | 132 DCHECK_GE(long_bypass_length_with_data_reduction_enabled, 0); |
135 UMA_HISTOGRAM_COUNTS( | 133 UMA_HISTOGRAM_COUNTS( |
136 "Net.DailyContentLength_DataReductionProxyEnabled_LongBypass", | 134 "Net.DailyContentLength_DataReductionProxyEnabled_LongBypass", |
137 long_bypass_length_with_data_reduction_enabled >> 10); | 135 long_bypass_length_with_data_reduction_enabled >> 10); |
138 UMA_HISTOGRAM_PERCENTAGE( | 136 UMA_HISTOGRAM_PERCENTAGE( |
139 "Net.DailyContentPercent_DataReductionProxyEnabled_LongBypass", | 137 "Net.DailyContentPercent_DataReductionProxyEnabled_LongBypass", |
140 ((100 * long_bypass_length_with_data_reduction_enabled) / | 138 ((100 * long_bypass_length_with_data_reduction_enabled) / |
141 received_length)); | 139 received_length)); |
142 } | |
143 | 140 |
144 if (unknown_length_with_data_reduction_enabled > 0) { | 141 DCHECK_GE(unknown_length_with_data_reduction_enabled, 0); |
145 UMA_HISTOGRAM_COUNTS( | 142 UMA_HISTOGRAM_COUNTS( |
146 "Net.DailyContentLength_DataReductionProxyEnabled_Unknown", | 143 "Net.DailyContentLength_DataReductionProxyEnabled_Unknown", |
147 unknown_length_with_data_reduction_enabled >> 10); | 144 unknown_length_with_data_reduction_enabled >> 10); |
148 UMA_HISTOGRAM_PERCENTAGE( | 145 UMA_HISTOGRAM_PERCENTAGE( |
149 "Net.DailyContentPercent_DataReductionProxyEnabled_Unknown", | 146 "Net.DailyContentPercent_DataReductionProxyEnabled_Unknown", |
150 ((100 * unknown_length_with_data_reduction_enabled) / | 147 ((100 * unknown_length_with_data_reduction_enabled) / |
151 received_length)); | 148 received_length)); |
152 } | |
153 | 149 |
154 if (original_length_via_data_reduction_proxy <= 0 || | 150 DCHECK_GE(original_length_via_data_reduction_proxy, 0); |
155 received_length_via_data_reduction_proxy <= 0) { | 151 DCHECK_GE(received_length_via_data_reduction_proxy, 0); |
bengr
2014/06/06 20:41:34
Move this down to just before the UMA that refers
bolian
2014/06/06 20:56:17
Done.
| |
156 return; | |
157 } | |
158 | |
159 UMA_HISTOGRAM_COUNTS( | 152 UMA_HISTOGRAM_COUNTS( |
160 "Net.DailyOriginalContentLength_ViaDataReductionProxy", | 153 "Net.DailyOriginalContentLength_ViaDataReductionProxy", |
161 original_length_via_data_reduction_proxy >> 10); | 154 original_length_via_data_reduction_proxy >> 10); |
162 UMA_HISTOGRAM_COUNTS( | 155 UMA_HISTOGRAM_COUNTS( |
163 "Net.DailyContentLength_ViaDataReductionProxy", | 156 "Net.DailyContentLength_ViaDataReductionProxy", |
164 received_length_via_data_reduction_proxy >> 10); | 157 received_length_via_data_reduction_proxy >> 10); |
165 int percent_via_data_reduction_proxy = 0; | 158 int percent_via_data_reduction_proxy = 0; |
166 if (original_length_via_data_reduction_proxy > | 159 if (original_length_via_data_reduction_proxy > |
167 received_length_via_data_reduction_proxy) { | 160 received_length_via_data_reduction_proxy) { |
168 percent_via_data_reduction_proxy = | 161 percent_via_data_reduction_proxy = |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
540 UpdateContentLengthPrefsForDataReductionProxy( | 533 UpdateContentLengthPrefsForDataReductionProxy( |
541 received_content_length, | 534 received_content_length, |
542 original_content_length, | 535 original_content_length, |
543 with_data_reduction_proxy_enabled, | 536 with_data_reduction_proxy_enabled, |
544 request_type, | 537 request_type, |
545 base::Time::Now(), | 538 base::Time::Now(), |
546 prefs); | 539 prefs); |
547 } | 540 } |
548 | 541 |
549 } // namespace data_reduction_proxy | 542 } // namespace data_reduction_proxy |
OLD | NEW |