Commit d530b6c2 authored by kundaji's avatar kundaji Committed by Commit bot

UMA for data savings displayed to users.

Daily reported UMA for number of bytes and data savings percent over the
past 30 days.

Review URL: https://codereview.chromium.org/1167543010

Cr-Commit-Position: refs/heads/master@{#333136}
parent e5e2170f
...@@ -704,6 +704,7 @@ void DataReductionProxyCompressionStats::RecordContentLengthPrefs( ...@@ -704,6 +704,7 @@ void DataReductionProxyCompressionStats::RecordContentLengthPrefs(
// Here, we prefer collecting less data but the collected data is // Here, we prefer collecting less data but the collected data is
// associated with an accurate date. // associated with an accurate date.
if (days_since_last_update == 1) { if (days_since_last_update == 1) {
RecordUserVisibleDataSavings();
// The previous day's data point is the second one from the tail. // The previous day's data point is the second one from the tail.
// Therefore (kNumDaysInHistory - 2) below. // Therefore (kNumDaysInHistory - 2) below.
RecordDailyContentLengthHistograms( RecordDailyContentLengthHistograms(
...@@ -721,4 +722,26 @@ void DataReductionProxyCompressionStats::RecordContentLengthPrefs( ...@@ -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);
}
} // namespace data_reduction_proxy } // namespace data_reduction_proxy
...@@ -132,6 +132,11 @@ class DataReductionProxyCompressionStats { ...@@ -132,6 +132,11 @@ class DataReductionProxyCompressionStats {
DataReductionProxyRequestType request_type, DataReductionProxyRequestType request_type,
base::Time now); base::Time now);
// Record UMA with data savings bytes and percent over the past
// |DataReductionProxy::kNumDaysInHistorySummary| days. These numbers
// are displayed to users as their data savings.
void RecordUserVisibleDataSavings();
PrefService* pref_service_; PrefService* pref_service_;
scoped_refptr<base::SequencedTaskRunner> task_runner_; scoped_refptr<base::SequencedTaskRunner> task_runner_;
const base::TimeDelta delay_; const base::TimeDelta delay_;
......
...@@ -19577,6 +19577,28 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -19577,6 +19577,28 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary> </summary>
</histogram> </histogram>
<histogram name="Net.DailyUserVisibleSavingsPercent_DataRedictionProxyEnabled"
units="Percent">
<owner>kundaji@chromium.org</owner>
<owner>bengr@chromium.org</owner>
<summary>
The percentage of data savings in past
|DataReductionProxy::kNumDaysInHistorySummary| days. This number is
displayed to users as their data savings.
</summary>
</histogram>
<histogram name="Net.DailyUserVisibleSavingsSize_DataRedictionProxyEnabled"
units="KB">
<owner>kundaji@chromium.org</owner>
<owner>bengr@chromium.org</owner>
<summary>
The total data saved in KB in past
|DataReductionProxy::kNumDaysInHistorySummary| days. This number is used to
compute the data savings displayed to the user.
</summary>
</histogram>
<histogram name="Net.DhcpWpadCancelTime" units="milliseconds"> <histogram name="Net.DhcpWpadCancelTime" units="milliseconds">
<obsolete> <obsolete>
Removed in Chrome 39. Removed in Chrome 39.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment