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

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

Issue 1465533006: [BackgroundSync] Split failed and succeeded cases of BackgroundSyncMetrics::CountRegister (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 1 month 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') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/background_sync/background_sync_metrics.h" 5 #include "content/browser/background_sync/background_sync_metrics.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/metrics/user_metrics_action.h" 8 #include "base/metrics/user_metrics_action.h"
9 9
10 namespace { 10 namespace {
(...skipping 14 matching lines...) Expand all
25 : RESULT_PATTERN_SUCCESS_BACKGROUND; 25 : RESULT_PATTERN_SUCCESS_BACKGROUND;
26 } 26 }
27 return finished_in_foreground ? RESULT_PATTERN_FAILED_FOREGROUND 27 return finished_in_foreground ? RESULT_PATTERN_FAILED_FOREGROUND
28 : RESULT_PATTERN_FAILED_BACKGROUND; 28 : RESULT_PATTERN_FAILED_BACKGROUND;
29 } 29 }
30 30
31 } // namespace 31 } // namespace
32 32
33 namespace content { 33 namespace content {
34 34
35 // status
iclelland 2015/11/23 19:54:59 static? (ditto for the other three instances)
jkarlin 2015/11/23 20:00:46 Oy. Thanks! Done.
35 void BackgroundSyncMetrics::RecordEventResult(SyncPeriodicity periodicity, 36 void BackgroundSyncMetrics::RecordEventResult(SyncPeriodicity periodicity,
36 bool success, 37 bool success,
37 bool finished_in_foreground) { 38 bool finished_in_foreground) {
38 switch (periodicity) { 39 switch (periodicity) {
39 case SYNC_ONE_SHOT: 40 case SYNC_ONE_SHOT:
40 UMA_HISTOGRAM_ENUMERATION( 41 UMA_HISTOGRAM_ENUMERATION(
41 "BackgroundSync.Event.OneShotResultPattern", 42 "BackgroundSync.Event.OneShotResultPattern",
42 EventResultToResultPattern(success, finished_in_foreground), 43 EventResultToResultPattern(success, finished_in_foreground),
43 RESULT_PATTERN_MAX + 1); 44 RESULT_PATTERN_MAX + 1);
44 return; 45 return;
45 case SYNC_PERIODIC: 46 case SYNC_PERIODIC:
46 UMA_HISTOGRAM_ENUMERATION( 47 UMA_HISTOGRAM_ENUMERATION(
47 "BackgroundSync.Event.PeriodicResultPattern", 48 "BackgroundSync.Event.PeriodicResultPattern",
48 EventResultToResultPattern(success, finished_in_foreground), 49 EventResultToResultPattern(success, finished_in_foreground),
49 RESULT_PATTERN_MAX + 1); 50 RESULT_PATTERN_MAX + 1);
50 return; 51 return;
51 } 52 }
52 NOTREACHED(); 53 NOTREACHED();
53 } 54 }
54 55
56 // status
55 void BackgroundSyncMetrics::RecordBatchSyncEventComplete( 57 void BackgroundSyncMetrics::RecordBatchSyncEventComplete(
56 const base::TimeDelta& time, 58 const base::TimeDelta& time,
57 int number_of_batched_sync_events) { 59 int number_of_batched_sync_events) {
58 // The total batch handling time should be under 5 minutes; we'll record up to 60 // The total batch handling time should be under 5 minutes; we'll record up to
59 // 6 minutes, to be safe. 61 // 6 minutes, to be safe.
60 UMA_HISTOGRAM_CUSTOM_TIMES("BackgroundSync.Event.Time", time, 62 UMA_HISTOGRAM_CUSTOM_TIMES("BackgroundSync.Event.Time", time,
61 base::TimeDelta::FromMilliseconds(10), 63 base::TimeDelta::FromMilliseconds(10),
62 base::TimeDelta::FromMinutes(6), 50); 64 base::TimeDelta::FromMinutes(6), 50);
63 UMA_HISTOGRAM_COUNTS_100("BackgroundSync.Event.BatchSize", 65 UMA_HISTOGRAM_COUNTS_100("BackgroundSync.Event.BatchSize",
64 number_of_batched_sync_events); 66 number_of_batched_sync_events);
65 } 67 }
66 68
67 void BackgroundSyncMetrics::CountRegister( 69 // status
70 void BackgroundSyncMetrics::CountRegisterSuccess(
68 SyncPeriodicity periodicity, 71 SyncPeriodicity periodicity,
69 RegistrationCouldFire registration_could_fire, 72 RegistrationCouldFire registration_could_fire,
70 RegistrationIsDuplicate registration_is_duplicate, 73 RegistrationIsDuplicate registration_is_duplicate) {
71 BackgroundSyncStatus result) {
72 switch (periodicity) { 74 switch (periodicity) {
73 case SYNC_ONE_SHOT: 75 case SYNC_ONE_SHOT:
74 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.OneShot", result, 76 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.OneShot",
77 BACKGROUND_SYNC_STATUS_OK,
75 BACKGROUND_SYNC_STATUS_MAX + 1); 78 BACKGROUND_SYNC_STATUS_MAX + 1);
76 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Registration.OneShot.CouldFire", 79 UMA_HISTOGRAM_BOOLEAN("BackgroundSync.Registration.OneShot.CouldFire",
77 registration_could_fire == REGISTRATION_COULD_FIRE); 80 registration_could_fire == REGISTRATION_COULD_FIRE);
78 UMA_HISTOGRAM_BOOLEAN( 81 UMA_HISTOGRAM_BOOLEAN(
79 "BackgroundSync.Registration.OneShot.IsDuplicate", 82 "BackgroundSync.Registration.OneShot.IsDuplicate",
80 registration_is_duplicate == REGISTRATION_IS_DUPLICATE); 83 registration_is_duplicate == REGISTRATION_IS_DUPLICATE);
81 return; 84 return;
82 case SYNC_PERIODIC: 85 case SYNC_PERIODIC:
83 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.Periodic", result, 86 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.Periodic",
87 BACKGROUND_SYNC_STATUS_OK,
84 BACKGROUND_SYNC_STATUS_MAX + 1); 88 BACKGROUND_SYNC_STATUS_MAX + 1);
85 UMA_HISTOGRAM_BOOLEAN( 89 UMA_HISTOGRAM_BOOLEAN(
86 "BackgroundSync.Registration.Periodic.IsDuplicate", 90 "BackgroundSync.Registration.Periodic.IsDuplicate",
87 registration_is_duplicate == REGISTRATION_IS_DUPLICATE); 91 registration_is_duplicate == REGISTRATION_IS_DUPLICATE);
88 return; 92 return;
89 } 93 }
90 NOTREACHED(); 94 NOTREACHED();
91 } 95 }
92 96
97 // status
98 void BackgroundSyncMetrics::CountRegisterFailure(SyncPeriodicity periodicity,
99 BackgroundSyncStatus result) {
100 switch (periodicity) {
101 case SYNC_ONE_SHOT:
102 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.OneShot", result,
103 BACKGROUND_SYNC_STATUS_MAX + 1);
104 return;
105 case SYNC_PERIODIC:
106 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Registration.Periodic", result,
107 BACKGROUND_SYNC_STATUS_MAX + 1);
108 return;
109 }
110 NOTREACHED();
111 }
112
113 // status
93 void BackgroundSyncMetrics::CountUnregister(SyncPeriodicity periodicity, 114 void BackgroundSyncMetrics::CountUnregister(SyncPeriodicity periodicity,
94 BackgroundSyncStatus result) { 115 BackgroundSyncStatus result) {
95 switch (periodicity) { 116 switch (periodicity) {
96 case SYNC_ONE_SHOT: 117 case SYNC_ONE_SHOT:
97 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Unregistration.OneShot", result, 118 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Unregistration.OneShot", result,
98 BACKGROUND_SYNC_STATUS_MAX + 1); 119 BACKGROUND_SYNC_STATUS_MAX + 1);
99 return; 120 return;
100 case SYNC_PERIODIC: 121 case SYNC_PERIODIC:
101 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Unregistration.Periodic", 122 UMA_HISTOGRAM_ENUMERATION("BackgroundSync.Unregistration.Periodic",
102 result, BACKGROUND_SYNC_STATUS_MAX + 1); 123 result, BACKGROUND_SYNC_STATUS_MAX + 1);
103 return; 124 return;
104 } 125 }
105 NOTREACHED(); 126 NOTREACHED();
106 } 127 }
107 128
108 } // namespace content 129 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/background_sync/background_sync_metrics.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698