OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/browser/appcache/appcache_histograms.h" | 5 #include "webkit/browser/appcache/appcache_histograms.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 | 8 |
9 namespace appcache { | 9 namespace appcache { |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 void AppCacheHistograms::CountCheckResponseResult( | 49 void AppCacheHistograms::CountCheckResponseResult( |
50 CheckResponseResultType result) { | 50 CheckResponseResultType result) { |
51 UMA_HISTOGRAM_ENUMERATION( | 51 UMA_HISTOGRAM_ENUMERATION( |
52 "appcache.CheckResponseResult", | 52 "appcache.CheckResponseResult", |
53 result, NUM_CHECK_RESPONSE_RESULT_TYPES); | 53 result, NUM_CHECK_RESPONSE_RESULT_TYPES); |
54 } | 54 } |
55 | 55 |
| 56 void AppCacheHistograms::CountResponseRetrieval( |
| 57 bool success, bool is_main_resource, const GURL& origin_url) { |
| 58 std::string label; |
| 59 if (is_main_resource) { |
| 60 label = "appcache.MainResourceResponseRetrieval"; |
| 61 UMA_HISTOGRAM_BOOLEAN(label, success); |
| 62 } else { |
| 63 label = "appcache.SubResourceResponseRetrieval"; |
| 64 UMA_HISTOGRAM_BOOLEAN(label, success); |
| 65 } |
| 66 const std::string suffix = OriginToCustomHistogramSuffix(origin_url); |
| 67 if (!suffix.empty()) { |
| 68 base::BooleanHistogram::FactoryGet( |
| 69 label + suffix, |
| 70 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(success); |
| 71 } |
| 72 } |
| 73 |
| 74 void AppCacheHistograms::LogUpdateFailureStats( |
| 75 const GURL& origin_url, |
| 76 int percent_complete, |
| 77 bool was_stalled, |
| 78 bool was_off_origin_resource_failure) { |
| 79 const std::string suffix = OriginToCustomHistogramSuffix(origin_url); |
| 80 |
| 81 std::string label = "appcache.UpdateProgressAtPointOfFaliure"; |
| 82 UMA_HISTOGRAM_PERCENTAGE(label, percent_complete); |
| 83 if (!suffix.empty()) { |
| 84 base::LinearHistogram::FactoryGet( |
| 85 label + suffix, |
| 86 1, 101, 102, |
| 87 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(percent_complete); |
| 88 } |
| 89 |
| 90 label = "appcache.UpdateWasStalledAtPointOfFailure"; |
| 91 UMA_HISTOGRAM_BOOLEAN(label, was_stalled); |
| 92 if (!suffix.empty()) { |
| 93 base::BooleanHistogram::FactoryGet( |
| 94 label + suffix, |
| 95 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(was_stalled); |
| 96 } |
| 97 |
| 98 label = "appcache.UpdateWasOffOriginAtPointOfFailure"; |
| 99 UMA_HISTOGRAM_BOOLEAN(label, was_off_origin_resource_failure); |
| 100 if (!suffix.empty()) { |
| 101 base::BooleanHistogram::FactoryGet( |
| 102 label + suffix, |
| 103 base::HistogramBase::kUmaTargetedHistogramFlag)->Add( |
| 104 was_off_origin_resource_failure); |
| 105 } |
| 106 } |
| 107 |
56 void AppCacheHistograms::AddTaskQueueTimeSample( | 108 void AppCacheHistograms::AddTaskQueueTimeSample( |
57 const base::TimeDelta& duration) { | 109 const base::TimeDelta& duration) { |
58 UMA_HISTOGRAM_TIMES("appcache.TaskQueueTime", duration); | 110 UMA_HISTOGRAM_TIMES("appcache.TaskQueueTime", duration); |
59 } | 111 } |
60 | 112 |
61 void AppCacheHistograms::AddTaskRunTimeSample( | 113 void AppCacheHistograms::AddTaskRunTimeSample( |
62 const base::TimeDelta& duration) { | 114 const base::TimeDelta& duration) { |
63 UMA_HISTOGRAM_TIMES("appcache.TaskRunTime", duration); | 115 UMA_HISTOGRAM_TIMES("appcache.TaskRunTime", duration); |
64 } | 116 } |
65 | 117 |
(...skipping 27 matching lines...) Expand all Loading... |
93 } | 145 } |
94 | 146 |
95 void AppCacheHistograms::AddMissingManifestDetectedAtCallsite( | 147 void AppCacheHistograms::AddMissingManifestDetectedAtCallsite( |
96 MissingManifestCallsiteType callsite) { | 148 MissingManifestCallsiteType callsite) { |
97 UMA_HISTOGRAM_ENUMERATION( | 149 UMA_HISTOGRAM_ENUMERATION( |
98 "appcache.MissingManifestDetectedAtCallsite", | 150 "appcache.MissingManifestDetectedAtCallsite", |
99 callsite, NUM_MISSING_MANIFEST_CALLSITE_TYPES); | 151 callsite, NUM_MISSING_MANIFEST_CALLSITE_TYPES); |
100 } | 152 } |
101 | 153 |
102 } // namespace appcache | 154 } // namespace appcache |
OLD | NEW |