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

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: Rename WouldFireRegistrationWithOptions to AreOptionConditionsMet 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
« no previous file with comments | « content/browser/background_sync/background_sync_metrics.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
45 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Registration.OneShot.IsDuplicate",
46 registration_is_duplicate);
47 return;
48 case SYNC_PERIODIC:
49 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.Periodic", result,
50 BackgroundSyncManager::ERROR_TYPE_MAX + 1);
51 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Registration.Periodic.CouldFire",
jkarlin 2015/07/14 21:56:22 These should either be made proper booleans or use
iclelland 2015/07/15 14:22:25 Done.
52 registration_could_fire);
53 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Registration.Periodic.IsDuplicate",
54 registration_is_duplicate);
55 return;
56 }
57 NOTREACHED();
58 }
59
60 void BackgroundSyncMetrics::CountUnregistration(
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
OLDNEW
« no previous file with comments | « content/browser/background_sync/background_sync_metrics.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698