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

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc

Issue 2546273002: Record DRP histogram on how long back savings were cleared (Closed)
Patch Set: Rebased Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 // Record the number of days since data reduction proxy has been enabled. 270 // Record the number of days since data reduction proxy has been enabled.
271 int64_t last_enabled_time = 271 int64_t last_enabled_time =
272 prefs->GetInt64(prefs::kDataReductionProxyLastEnabledTime); 272 prefs->GetInt64(prefs::kDataReductionProxyLastEnabledTime);
273 if (last_enabled_time != 0) { 273 if (last_enabled_time != 0) {
274 // Record the metric only if the time when data reduction proxy was 274 // Record the metric only if the time when data reduction proxy was
275 // enabled is available. 275 // enabled is available.
276 RecordDaysSinceEnabledMetric( 276 RecordDaysSinceEnabledMetric(
277 (clock_->Now() - base::Time::FromInternalValue(last_enabled_time)) 277 (clock_->Now() - base::Time::FromInternalValue(last_enabled_time))
278 .InDays()); 278 .InDays());
279 } 279 }
280
281 int64_t last_savings_cleared_time = prefs->GetInt64(
282 prefs::kDataReductionProxySavingsClearedNegativeSystemClock);
283 if (last_savings_cleared_time != 0) {
284 int32_t days_since_savings_cleared =
285 (clock_->Now() -
286 base::Time::FromInternalValue(last_savings_cleared_time))
287 .InDays();
288
289 // Sample in the UMA histograms must be at least 1.
290 if (days_since_savings_cleared == 0)
291 days_since_savings_cleared = 1;
292 UMA_HISTOGRAM_CUSTOM_COUNTS(
293 "DataReductionProxy.DaysSinceSavingsCleared.NegativeSystemClock",
294 days_since_savings_cleared, 1, 365, 50);
295 }
280 } 296 }
281 297
282 if (spdy_proxy_auth_enabled_.GetValue() && 298 if (spdy_proxy_auth_enabled_.GetValue() &&
283 !prefs->GetBoolean(prefs::kDataReductionProxyWasEnabledBefore)) { 299 !prefs->GetBoolean(prefs::kDataReductionProxyWasEnabledBefore)) {
284 prefs->SetBoolean(prefs::kDataReductionProxyWasEnabledBefore, true); 300 prefs->SetBoolean(prefs::kDataReductionProxyWasEnabledBefore, true);
285 ResetDataReductionStatistics(); 301 ResetDataReductionStatistics();
286 } 302 }
287 if (!at_startup) { 303 if (!at_startup) {
288 if (IsDataReductionProxyEnabled()) { 304 if (IsDataReductionProxyEnabled()) {
289 RecordSettingsEnabledState(DATA_REDUCTION_SETTINGS_ACTION_OFF_TO_ON); 305 RecordSettingsEnabledState(DATA_REDUCTION_SETTINGS_ACTION_OFF_TO_ON);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 int64_t data_used, 426 int64_t data_used,
411 int64_t original_size) { 427 int64_t original_size) {
412 if (!IsDataReductionProxyEnabled()) 428 if (!IsDataReductionProxyEnabled())
413 return false; 429 return false;
414 data_reduction_proxy_service_->compression_stats()->UpdateDataSavings( 430 data_reduction_proxy_service_->compression_stats()->UpdateDataSavings(
415 data_usage_host, data_used, original_size); 431 data_usage_host, data_used, original_size);
416 return true; 432 return true;
417 } 433 }
418 434
419 } // namespace data_reduction_proxy 435 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698