| 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 <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 value, max); | 971 value, max); |
| 972 } else { | 972 } else { |
| 973 UMA_HISTOGRAM_ENUMERATION( | 973 UMA_HISTOGRAM_ENUMERATION( |
| 974 "ServiceWorker.ContextRequestHandlerStatus.NewWorker." | 974 "ServiceWorker.ContextRequestHandlerStatus.NewWorker." |
| 975 "ImportedScript", | 975 "ImportedScript", |
| 976 value, max); | 976 value, max); |
| 977 } | 977 } |
| 978 } | 978 } |
| 979 } | 979 } |
| 980 | 980 |
| 981 void ServiceWorkerMetrics::RecordRuntime(base::TimeDelta time) { |
| 982 // Start at 1 second since we expect service worker to last at least this |
| 983 // long: the update timer and idle timeout timer run on the order of seconds. |
| 984 constexpr base::TimeDelta kMin = base::TimeDelta::FromSeconds(1); |
| 985 // End at 1 day since service workers can conceivably run as long as the the |
| 986 // browser is open; we have to cap somewhere. |
| 987 constexpr base::TimeDelta kMax = base::TimeDelta::FromDays(1); |
| 988 // Set the bucket count to 50 since that is the recommended value for all |
| 989 // histograms. |
| 990 const int kBucketCount = 50; |
| 991 |
| 992 UMA_HISTOGRAM_CUSTOM_TIMES("ServiceWorker.Runtime", time, kMin, kMax, |
| 993 kBucketCount); |
| 994 } |
| 995 |
| 981 } // namespace content | 996 } // namespace content |
| OLD | NEW |