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

Side by Side Diff: content/browser/background_sync/background_sync_metrics.cc

Issue 1227363002: [Background Sync] Gather UMA data for Background Sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Explicit conversion to boolean in UMA recording Created 5 years, 5 months 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
(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::RecordSyncEventHandlingTime(
26 const base::TimeDelta& time) {
27 // The total event 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::CountRegistration(
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("BackgroundSync.Registration.Periodic.CouldFire",
jkarlin 2015/07/15 17:17:06 Not sure what periodic could fire means.
iclelland 2015/07/15 18:01:35 I suppose it would have to mean "the power and net
jkarlin 2015/07/15 19:27:33 Let's remove this one for now. Easy to add back la
iclelland 2015/07/16 13:29:44 Done.
53 registration_could_fire == REGISTRATION_COULD_FIRE);
54 UMA_HISTOGRAM_BOOLEAN(
55 "BackgroundSync.Registration.Periodic.IsDuplicate",
56 registration_is_duplicate == REGISTRATION_IS_DUPLICATE);
57 return;
58 }
59 NOTREACHED();
60 }
61
62 void BackgroundSyncMetrics::CountUnregistration(
jkarlin 2015/07/15 17:17:06 Is unregistration a word? Perhaps CountUnregister
iclelland 2015/07/15 18:01:35 Deregisration? Disregistration? :) Switched to Co
63 SyncPeriodicity periodicity,
64 BackgroundSyncManager::ErrorType result) {
65 switch (periodicity) {
66 case SYNC_ONE_SHOT:
67 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Unregistration.OneShot", result,
68 BackgroundSyncManager::ERROR_TYPE_MAX + 1);
69 return;
70 case SYNC_PERIODIC:
71 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Unregistration.Periodic",
72 result,
73 BackgroundSyncManager::ERROR_TYPE_MAX + 1);
74 return;
75 }
76 NOTREACHED();
77 }
78
79 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698