Chromium Code Reviews| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc |
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc |
| index 7f5893bc225873cb0980cbb84839a392e7a29c26..8ab11fc8cbbd78ab31b2f75165c31bf636672f51 100644 |
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc |
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc |
| @@ -173,21 +173,20 @@ void RecordDailyContentLengthHistograms( |
| received_length)); |
| DCHECK_GE(original_length_via_data_reduction_proxy, 0); |
| UMA_HISTOGRAM_COUNTS( |
| "Net.DailyOriginalContentLength_ViaDataReductionProxy", |
| original_length_via_data_reduction_proxy >> 10); |
| DCHECK_GE(received_length_via_data_reduction_proxy, 0); |
| UMA_HISTOGRAM_COUNTS( |
| "Net.DailyContentLength_ViaDataReductionProxy", |
| received_length_via_data_reduction_proxy >> 10); |
|
RyanSturm
2016/05/06 21:06:33
add linebreak back
tbansal1
2016/05/06 21:13:04
Acknowledged.
RyanSturm
2016/05/06 21:15:49
Done.
|
| - |
| int percent_via_data_reduction_proxy = 0; |
| if (original_length_via_data_reduction_proxy > |
| received_length_via_data_reduction_proxy) { |
| percent_via_data_reduction_proxy = |
| 100 * (original_length_via_data_reduction_proxy - |
| received_length_via_data_reduction_proxy) / |
| original_length_via_data_reduction_proxy; |
| } |
| UMA_HISTOGRAM_PERCENTAGE( |
| "Net.DailyContentSavingPercent_ViaDataReductionProxy", |
| @@ -827,39 +826,41 @@ void DataReductionProxyCompressionStats::RecordRequestSizePrefs( |
| data_reduction_proxy::prefs:: |
| kDailyOriginalContentLengthWithDataReductionProxyEnabledVideo, |
| "Net.DailyOriginalContentLength_DataReductionProxyEnabled_Video"); |
| RECORD_INT64PREF_TO_HISTOGRAM( |
| data_reduction_proxy::prefs:: |
| kDailyContentLengthWithDataReductionProxyEnabledVideo, |
| "Net.DailyContentLength_DataReductionProxyEnabled_Video"); |
| int64_t original_length_with_data_reduction_enabled_video = GetInt64( |
| data_reduction_proxy::prefs:: |
| kDailyOriginalContentLengthWithDataReductionProxyEnabledVideo); |
| - int64_t received_length_with_data_reduction_enabled_video = |
| - GetInt64(data_reduction_proxy::prefs:: |
| - kDailyContentLengthWithDataReductionProxyEnabledVideo); |
| - int percent_data_reduction_proxy_enabled_video = 0; |
| - // UMA percentage cannot be negative. |
| - // The DataReductionProxy server will only serve optimized video content |
| - // if the optimized content is smaller than the original content. |
| - // TODO(ryansturm): Track daily data inflation percents here and |
| - // elsewhere. http://crbug.com/595818 |
| - if (original_length_with_data_reduction_enabled_video > |
| - received_length_with_data_reduction_enabled_video) { |
| - percent_data_reduction_proxy_enabled_video = |
| - 100 * (original_length_with_data_reduction_enabled_video - |
| - received_length_with_data_reduction_enabled_video) / |
| - original_length_with_data_reduction_enabled_video; |
| + if (original_length_with_data_reduction_enabled_video > 0) { |
| + int64_t received_length_with_data_reduction_enabled_video = |
| + GetInt64(data_reduction_proxy::prefs:: |
| + kDailyContentLengthWithDataReductionProxyEnabledVideo); |
| + int percent_data_reduction_proxy_enabled_video = 0; |
| + // UMA percentage cannot be negative. |
| + // The DataReductionProxy server will only serve optimized video content |
| + // if the optimized content is smaller than the original content. |
| + // TODO(ryansturm): Track daily data inflation percents here and |
| + // elsewhere. http://crbug.com/595818 |
| + if (original_length_with_data_reduction_enabled_video > |
| + received_length_with_data_reduction_enabled_video) { |
| + percent_data_reduction_proxy_enabled_video = |
| + 100 * (original_length_with_data_reduction_enabled_video - |
| + received_length_with_data_reduction_enabled_video) / |
| + original_length_with_data_reduction_enabled_video; |
| + } |
| + UMA_HISTOGRAM_PERCENTAGE( |
| + "Net.DailyContentSavingPercent_DataReductionProxyEnabled_Video", |
| + percent_data_reduction_proxy_enabled_video); |
| } |
| - UMA_HISTOGRAM_PERCENTAGE( |
| - "Net.DailyContentSavingPercent_DataReductionProxyEnabled_Video", |
| - percent_data_reduction_proxy_enabled_video); |
| RECORD_INT64PREF_TO_HISTOGRAM( |
| data_reduction_proxy::prefs:: |
| kDailyOriginalContentLengthWithDataReductionProxyEnabledUnknown, |
| "Net.DailyOriginalContentLength_DataReductionProxyEnabled_" |
| "UnknownMime"); |
| RECORD_INT64PREF_TO_HISTOGRAM( |
| data_reduction_proxy::prefs:: |
| kDailyContentLengthWithDataReductionProxyEnabledUnknown, |
| "Net.DailyContentLength_DataReductionProxyEnabled_UnknownMime") |
| @@ -877,39 +878,41 @@ void DataReductionProxyCompressionStats::RecordRequestSizePrefs( |
| data_reduction_proxy::prefs:: |
| kDailyOriginalContentLengthViaDataReductionProxyVideo, |
| "Net.DailyOriginalContentLength_ViaDataReductionProxy_Video"); |
| RECORD_INT64PREF_TO_HISTOGRAM( |
| data_reduction_proxy::prefs:: |
| kDailyContentLengthViaDataReductionProxyVideo, |
| "Net.DailyContentLength_ViaDataReductionProxy_Video"); |
| int64_t original_length_via_data_reduction_proxy_video = |
| GetInt64(data_reduction_proxy::prefs:: |
| kDailyOriginalContentLengthViaDataReductionProxyVideo); |
| - int64_t received_length_via_data_reduction_proxy_video = |
| - GetInt64(data_reduction_proxy::prefs:: |
| - kDailyContentLengthViaDataReductionProxyVideo); |
| - int percent_via_data_reduction_proxy_video = 0; |
| - // UMA percentage cannot be negative. |
| - // The DataReductionProxy server will only serve optimized video content |
| - // if the optimized content is smaller than the original content. |
| - // TODO(ryansturm): Track daily data inflation percents here and |
| - // elsewhere. http://crbug.com/595818 |
| - if (original_length_via_data_reduction_proxy_video > |
| - received_length_via_data_reduction_proxy_video) { |
| - percent_via_data_reduction_proxy_video = |
| - 100 * (original_length_via_data_reduction_proxy_video - |
| - received_length_via_data_reduction_proxy_video) / |
| - original_length_via_data_reduction_proxy_video; |
| + if (original_length_via_data_reduction_proxy_video > 0) { |
| + int64_t received_length_via_data_reduction_proxy_video = |
| + GetInt64(data_reduction_proxy::prefs:: |
| + kDailyContentLengthViaDataReductionProxyVideo); |
| + int percent_via_data_reduction_proxy_video = 0; |
| + // UMA percentage cannot be negative. |
| + // The DataReductionProxy server will only serve optimized video content |
| + // if the optimized content is smaller than the original content. |
| + // TODO(ryansturm): Track daily data inflation percents here and |
| + // elsewhere. http://crbug.com/595818 |
| + if (original_length_via_data_reduction_proxy_video > |
| + received_length_via_data_reduction_proxy_video) { |
| + percent_via_data_reduction_proxy_video = |
| + 100 * (original_length_via_data_reduction_proxy_video - |
| + received_length_via_data_reduction_proxy_video) / |
| + original_length_via_data_reduction_proxy_video; |
| + } |
| + UMA_HISTOGRAM_PERCENTAGE( |
| + "Net.DailyContentSavingPercent_ViaDataReductionProxy_Video", |
| + percent_via_data_reduction_proxy_video); |
| } |
| - UMA_HISTOGRAM_PERCENTAGE( |
| - "Net.DailyContentSavingPercent_ViaDataReductionProxy_Video", |
| - percent_via_data_reduction_proxy_video); |
| RECORD_INT64PREF_TO_HISTOGRAM( |
| data_reduction_proxy::prefs:: |
| kDailyOriginalContentLengthViaDataReductionProxyUnknown, |
| "Net.DailyOriginalContentLength_ViaDataReductionProxy_UnknownMime"); |
| RECORD_INT64PREF_TO_HISTOGRAM( |
| data_reduction_proxy::prefs:: |
| kDailyContentLengthViaDataReductionProxyUnknown, |
| "Net.DailyContentLength_ViaDataReductionProxy_UnknownMime"); |
| } |