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.
5 #include "content/browser/background_sync/background_sync_metrics.h"
7 #include "base/metrics/histogram_macros.h"
8 #include "base/metrics/user_metrics_action.h"
12 void BackgroundSyncMetrics::RecordEventResult(SyncPeriodicity periodicity
,
14 switch (periodicity
) {
16 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Event.OneShotResult", success
);
19 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Event.PeriodicResult", success
);
25 void BackgroundSyncMetrics::RecordBatchSyncEventComplete(
26 const base::TimeDelta
& time
,
27 int number_of_batched_sync_events
) {
28 // The total batch handling time should be under 5 minutes; we'll record up to
29 // 6 minutes, to be safe.
30 UMA_HISTOGRAM_CUSTOM_TIMES("BackgroundSync.Event.Time", time
,
31 base::TimeDelta::FromMilliseconds(10),
32 base::TimeDelta::FromMinutes(6), 50);
33 UMA_HISTOGRAM_COUNTS_100("BackgroundSync.Event.BatchSize",
34 number_of_batched_sync_events
);
37 void BackgroundSyncMetrics::CountRegister(
38 SyncPeriodicity periodicity
,
39 RegistrationCouldFire registration_could_fire
,
40 RegistrationIsDuplicate registration_is_duplicate
,
41 BackgroundSyncStatus result
) {
42 switch (periodicity
) {
44 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.OneShot", result
,
45 BACKGROUND_SYNC_STATUS_MAX
+ 1);
46 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Registration.OneShot.CouldFire",
47 registration_could_fire
== REGISTRATION_COULD_FIRE
);
48 UMA_HISTOGRAM_BOOLEAN(
49 "BackgroundSync.Registration.OneShot.IsDuplicate",
50 registration_is_duplicate
== REGISTRATION_IS_DUPLICATE
);
53 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.Periodic", result
,
54 BACKGROUND_SYNC_STATUS_MAX
+ 1);
55 UMA_HISTOGRAM_BOOLEAN(
56 "BackgroundSync.Registration.Periodic.IsDuplicate",
57 registration_is_duplicate
== REGISTRATION_IS_DUPLICATE
);
63 void BackgroundSyncMetrics::CountUnregister(SyncPeriodicity periodicity
,
64 BackgroundSyncStatus result
) {
65 switch (periodicity
) {
67 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Unregistration.OneShot", result
,
68 BACKGROUND_SYNC_STATUS_MAX
+ 1);
71 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Unregistration.Periodic",
72 result
, BACKGROUND_SYNC_STATUS_MAX
+ 1);
78 } // namespace content