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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_compression_stats.cc

Issue 1956773003: UMA for data reduction proxy video percentages are being reported when users don't watch video. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit fix Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698