OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/background_sync/background_sync_metrics.h" |
| 6 |
| 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/metrics/user_metrics_action.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 void BackgroundSyncMetrics::RecordEventResult(SyncPeriodicity periodicity, |
| 13 bool success) { |
| 14 switch (periodicity) { |
| 15 case SYNC_ONE_SHOT: |
| 16 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Event.OneShotResult", success); |
| 17 return; |
| 18 case SYNC_PERIODIC: |
| 19 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Event.PeriodicResult", success); |
| 20 return; |
| 21 } |
| 22 NOTREACHED(); |
| 23 } |
| 24 |
| 25 void BackgroundSyncMetrics::RecordBatchSyncEventHandlingTime( |
| 26 const base::TimeDelta& time) { |
| 27 // The total batch handling time should be under 5 minutes; we'll record up to |
| 28 // 6 minutes, to be safe. |
| 29 UMA_HISTOGRAM_CUSTOM_TIMES("BackgroundSync.Event.Time", time, |
| 30 base::TimeDelta::FromMilliseconds(10), |
| 31 base::TimeDelta::FromMinutes(6), 50); |
| 32 } |
| 33 |
| 34 void BackgroundSyncMetrics::CountRegister( |
| 35 SyncPeriodicity periodicity, |
| 36 RegistrationCouldFire registration_could_fire, |
| 37 RegistrationIsDuplicate registration_is_duplicate, |
| 38 BackgroundSyncManager::ErrorType result) { |
| 39 switch (periodicity) { |
| 40 case SYNC_ONE_SHOT: |
| 41 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.OneShot", result, |
| 42 BackgroundSyncManager::ERROR_TYPE_MAX + 1); |
| 43 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Registration.OneShot.CouldFire", |
| 44 registration_could_fire == REGISTRATION_COULD_FIRE); |
| 45 UMA_HISTOGRAM_BOOLEAN( |
| 46 "BackgroundSync.Registration.OneShot.IsDuplicate", |
| 47 registration_is_duplicate == REGISTRATION_IS_DUPLICATE); |
| 48 return; |
| 49 case SYNC_PERIODIC: |
| 50 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.Periodic", result, |
| 51 BackgroundSyncManager::ERROR_TYPE_MAX + 1); |
| 52 UMA_HISTOGRAM_BOOLEAN( |
| 53 "BackgroundSync.Registration.Periodic.IsDuplicate", |
| 54 registration_is_duplicate == REGISTRATION_IS_DUPLICATE); |
| 55 return; |
| 56 } |
| 57 NOTREACHED(); |
| 58 } |
| 59 |
| 60 void BackgroundSyncMetrics::CountUnregister( |
| 61 SyncPeriodicity periodicity, |
| 62 BackgroundSyncManager::ErrorType result) { |
| 63 switch (periodicity) { |
| 64 case SYNC_ONE_SHOT: |
| 65 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Unregistration.OneShot", result, |
| 66 BackgroundSyncManager::ERROR_TYPE_MAX + 1); |
| 67 return; |
| 68 case SYNC_PERIODIC: |
| 69 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Unregistration.Periodic", |
| 70 result, |
| 71 BackgroundSyncManager::ERROR_TYPE_MAX + 1); |
| 72 return; |
| 73 } |
| 74 NOTREACHED(); |
| 75 } |
| 76 |
| 77 } // namespace content |
OLD | NEW |