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 5655e12c92fdd4fc8fe6f62922396b85505649df..ebacdbf6df7338bd9148f3a1182e67d168c94a50 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 |
| @@ -704,6 +704,7 @@ void DataReductionProxyCompressionStats::RecordContentLengthPrefs( |
| // Here, we prefer collecting less data but the collected data is |
| // associated with an accurate date. |
| if (days_since_last_update == 1) { |
| + RecordUserVisibleDataSavings(); |
| // The previous day's data point is the second one from the tail. |
| // Therefore (kNumDaysInHistory - 2) below. |
| RecordDailyContentLengthHistograms( |
| @@ -721,4 +722,27 @@ void DataReductionProxyCompressionStats::RecordContentLengthPrefs( |
| } |
| } |
| +void DataReductionProxyCompressionStats::RecordUserVisibleDataSavings() { |
| + int64 original_content_length; |
| + int64 received_content_length; |
| + int64 last_update_internal; |
| + GetContentLengths(kNumDaysInHistorySummary, &original_content_length, |
| + &received_content_length, &last_update_internal); |
| + |
| + if (original_content_length == 0) { |
|
Alexei Svitkine (slow)
2015/06/05 18:01:43
Nit: Most of Chromium style prefers no {}'s for 1-
Not at Google. Contact bengr
2015/06/05 18:36:10
Done.
|
| + return; |
| + } |
| + |
| + int64 user_visible_savings_bytes = |
| + original_content_length - received_content_length; |
| + int user_visible_savings_percent = |
| + user_visible_savings_bytes * 100 / original_content_length; |
| + UMA_HISTOGRAM_PERCENTAGE( |
| + "Net.DailyUserVisibleSavingsPercent_DataRedictionProxyEnabled", |
| + user_visible_savings_percent); |
| + UMA_HISTOGRAM_COUNTS( |
| + "Net.DailyUserVisibleSavingsSize_DataRedictionProxyEnabled", |
| + user_visible_savings_bytes >> 10); |
| +} |
| + |
| } // namespace data_reduction_proxy |