| 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..c3621818d2cafa2802259bd6762c2009a364e70b 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
|
| @@ -827,39 +827,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 +879,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");
|
| }
|
|
|