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::CountWakeUpForSync(SyncPeriodicity periodicity, |
| 13 bool success) { |
| 14 switch (periodicity) { |
| 15 case SYNC_ONE_SHOT: |
| 16 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.WakeUp.OneShot", success); |
| 17 return; |
| 18 case SYNC_PERIODIC: |
| 19 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.WakeUp.Periodic", success); |
| 20 return; |
| 21 } |
| 22 NOTREACHED(); |
| 23 } |
| 24 |
| 25 void BackgroundSyncMetrics::RecordWakeUpTime(const base::TimeDelta& time) { |
| 26 UMA_HISTOGRAM_MEDIUM_TIMES("BackgroundSync.WakeUp.Time", time); |
| 27 } |
| 28 |
| 29 void BackgroundSyncMetrics::RecordEventResult(SyncPeriodicity periodicity, |
| 30 bool result) { |
| 31 switch (periodicity) { |
| 32 case SYNC_ONE_SHOT: |
| 33 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Event.OneShotResult", result); |
| 34 return; |
| 35 case SYNC_PERIODIC: |
| 36 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Event.PeriodicResult", result); |
| 37 return; |
| 38 } |
| 39 NOTREACHED(); |
| 40 } |
| 41 |
| 42 void BackgroundSyncMetrics::RecordSyncEventHandlingTime( |
| 43 const base::TimeDelta& time) { |
| 44 UMA_HISTOGRAM_MEDIUM_TIMES("BackgroundSync.Event.Time", time); |
| 45 } |
| 46 |
| 47 void BackgroundSyncMetrics::CountRegistration(SyncPeriodicity periodicity, |
| 48 bool could_fire, |
| 49 RegistrationResult result) { |
| 50 switch (periodicity) { |
| 51 case SYNC_ONE_SHOT: |
| 52 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.OneShot", result, |
| 53 NUM_REGISTRATION_RESULT_TYPES); |
| 54 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Registration.OneShot.CouldFire", |
| 55 could_fire); |
| 56 return; |
| 57 case SYNC_PERIODIC: |
| 58 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.Periodic", result, |
| 59 NUM_REGISTRATION_RESULT_TYPES); |
| 60 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Registration.Periodic.CouldFire", |
| 61 could_fire); |
| 62 return; |
| 63 } |
| 64 NOTREACHED(); |
| 65 } |
| 66 |
| 67 void BackgroundSyncMetrics::CountUnregistration(SyncPeriodicity periodicity, |
| 68 bool success) { |
| 69 switch (periodicity) { |
| 70 case SYNC_ONE_SHOT: |
| 71 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Unregistration.OneShot", success); |
| 72 return; |
| 73 case SYNC_PERIODIC: |
| 74 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Unregistration.Periodic", success); |
| 75 return; |
| 76 } |
| 77 NOTREACHED(); |
| 78 } |
| 79 |
| 80 } // namespace content |
OLD | NEW |