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

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

Issue 1167543010: UMA for data savings displayed to users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove {} for 1 line if. Created 5 years, 6 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
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..6db84f1034b6494e31a0f4c77dc9b2e9989d40f6 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,26 @@ 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)
+ 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);
bengr 2015/06/05 20:58:17 Why is this shifted 10?
Not at Google. Contact bengr 2015/06/05 21:00:32 To convert to KB.
bengr 2015/06/05 21:14:05 Ok. Dividing by 1024 is clearer imho.
Not at Google. Contact bengr 2015/06/05 21:19:42 Discussed in person. This file is using ">> 10" th
+}
+
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698