| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/service_worker/service_worker_metrics.h" | 5 #include "content/browser/service_worker/service_worker_metrics.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "content/common/service_worker/service_worker_types.h" | 10 #include "content/common/service_worker/service_worker_types.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 case EventType::ACTIVATE: | 51 case EventType::ACTIVATE: |
| 52 return "Activate"; | 52 return "Activate"; |
| 53 case EventType::INSTALL: | 53 case EventType::INSTALL: |
| 54 return "Install"; | 54 return "Install"; |
| 55 case EventType::FETCH: | 55 case EventType::FETCH: |
| 56 return "Fetch"; | 56 return "Fetch"; |
| 57 case EventType::SYNC: | 57 case EventType::SYNC: |
| 58 return "Sync"; | 58 return "Sync"; |
| 59 case EventType::NOTIFICATION_CLICK: | 59 case EventType::NOTIFICATION_CLICK: |
| 60 return "Notification Click"; | 60 return "Notification Click"; |
| 61 case EventType::NOTIFICATION_CLOSE: |
| 62 return "Notification Close"; |
| 61 case EventType::PUSH: | 63 case EventType::PUSH: |
| 62 return "Push"; | 64 return "Push"; |
| 63 case EventType::GEOFENCING: | 65 case EventType::GEOFENCING: |
| 64 return "Geofencing"; | 66 return "Geofencing"; |
| 65 case EventType::SERVICE_PORT_CONNECT: | 67 case EventType::SERVICE_PORT_CONNECT: |
| 66 return "Service Port Connect"; | 68 return "Service Port Connect"; |
| 67 case EventType::MESSAGE: | 69 case EventType::MESSAGE: |
| 68 return "Message"; | 70 return "Message"; |
| 69 case EventType::NUM_TYPES: | 71 case EventType::NUM_TYPES: |
| 70 break; | 72 break; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.InstallEvent.Time", time); | 221 UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.InstallEvent.Time", time); |
| 220 break; | 222 break; |
| 221 case EventType::SYNC: | 223 case EventType::SYNC: |
| 222 UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.BackgroundSyncEvent.Time", | 224 UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.BackgroundSyncEvent.Time", |
| 223 time); | 225 time); |
| 224 break; | 226 break; |
| 225 case EventType::NOTIFICATION_CLICK: | 227 case EventType::NOTIFICATION_CLICK: |
| 226 UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.NotificationClickEvent.Time", | 228 UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.NotificationClickEvent.Time", |
| 227 time); | 229 time); |
| 228 break; | 230 break; |
| 231 case EventType::NOTIFICATION_CLOSE: |
| 232 UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.NotificationCloseEvent.Time", |
| 233 time); |
| 234 break; |
| 229 case EventType::PUSH: | 235 case EventType::PUSH: |
| 230 UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.PushEvent.Time", time); | 236 UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.PushEvent.Time", time); |
| 231 break; | 237 break; |
| 232 | 238 |
| 233 // Event duration for fetch is recorded separately. | 239 // Event duration for fetch is recorded separately. |
| 234 case EventType::FETCH: | 240 case EventType::FETCH: |
| 235 // For now event duration for these events is not recorded. | 241 // For now event duration for these events is not recorded. |
| 236 case EventType::GEOFENCING: | 242 case EventType::GEOFENCING: |
| 237 case EventType::SERVICE_PORT_CONNECT: | 243 case EventType::SERVICE_PORT_CONNECT: |
| 238 case EventType::MESSAGE: | 244 case EventType::MESSAGE: |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.URLRequestJob.FallbackedRequestMode", | 309 UMA_HISTOGRAM_ENUMERATION("ServiceWorker.URLRequestJob.FallbackedRequestMode", |
| 304 mode, FETCH_REQUEST_MODE_LAST + 1); | 310 mode, FETCH_REQUEST_MODE_LAST + 1); |
| 305 } | 311 } |
| 306 | 312 |
| 307 void ServiceWorkerMetrics::RecordTimeBetweenEvents( | 313 void ServiceWorkerMetrics::RecordTimeBetweenEvents( |
| 308 const base::TimeDelta& time) { | 314 const base::TimeDelta& time) { |
| 309 UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.TimeBetweenEvents", time); | 315 UMA_HISTOGRAM_MEDIUM_TIMES("ServiceWorker.TimeBetweenEvents", time); |
| 310 } | 316 } |
| 311 | 317 |
| 312 } // namespace content | 318 } // namespace content |
| OLD | NEW |