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

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: Addressed Alexei's comments. 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..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

Powered by Google App Engine
This is Rietveld 408576698