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 |
11 static std::string OriginToCustomHistogramSuffix(const GURL& origin_url) { | |
12 if (origin_url.host() == "docs.google.com") | |
13 return ".Docs"; | |
14 return std::string(); | |
15 } | |
16 | |
11 void AppCacheHistograms::CountInitResult(InitResultType init_result) { | 17 void AppCacheHistograms::CountInitResult(InitResultType init_result) { |
12 UMA_HISTOGRAM_ENUMERATION( | 18 UMA_HISTOGRAM_ENUMERATION( |
13 "appcache.InitResult", | 19 "appcache.InitResult", |
14 init_result, NUM_INIT_RESULT_TYPES); | 20 init_result, NUM_INIT_RESULT_TYPES); |
15 } | 21 } |
16 | 22 |
17 void AppCacheHistograms::CountReinitAttempt(bool repeated_attempt) { | 23 void AppCacheHistograms::CountReinitAttempt(bool repeated_attempt) { |
18 UMA_HISTOGRAM_BOOLEAN("appcache.ReinitAttempt", repeated_attempt); | 24 UMA_HISTOGRAM_BOOLEAN("appcache.ReinitAttempt", repeated_attempt); |
19 } | 25 } |
20 | 26 |
21 void AppCacheHistograms::CountCorruptionDetected() { | 27 void AppCacheHistograms::CountCorruptionDetected() { |
22 UMA_HISTOGRAM_BOOLEAN("appcache.CorruptionDetected", true); | 28 UMA_HISTOGRAM_BOOLEAN("appcache.CorruptionDetected", true); |
23 } | 29 } |
24 | 30 |
31 void AppCacheHistograms::CountUpdateJobResult( | |
32 AppCacheUpdateJob::ResultType result, | |
33 const GURL& origin_url) { | |
34 UMA_HISTOGRAM_ENUMERATION( | |
35 "appcache.UpdateJobResult", | |
36 result, AppCacheUpdateJob::NUM_UPDATE_JOB_RESULT_TYPES); | |
37 | |
38 const std::string suffix = OriginToCustomHistogramSuffix(origin_url); | |
michaeln
2014/02/15 00:03:56
This is copy/pasted from what idb does for open re
jsbell
2014/02/15 00:23:54
... which we swiped from HostToCustomHistogramSuff
| |
39 if (!suffix.empty()) { | |
40 base::LinearHistogram::FactoryGet( | |
41 "appcache.UpdateJobResult" + suffix, | |
42 1, | |
43 AppCacheUpdateJob::NUM_UPDATE_JOB_RESULT_TYPES, | |
44 AppCacheUpdateJob::NUM_UPDATE_JOB_RESULT_TYPES + 1, | |
45 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(result); | |
46 } | |
47 } | |
48 | |
25 void AppCacheHistograms::CountCheckResponseResult( | 49 void AppCacheHistograms::CountCheckResponseResult( |
26 CheckResponseResultType result) { | 50 CheckResponseResultType result) { |
27 UMA_HISTOGRAM_ENUMERATION( | 51 UMA_HISTOGRAM_ENUMERATION( |
28 "appcache.CheckResponseResult", | 52 "appcache.CheckResponseResult", |
29 result, NUM_CHECK_RESPONSE_RESULT_TYPES); | 53 result, NUM_CHECK_RESPONSE_RESULT_TYPES); |
30 } | 54 } |
31 | 55 |
56 | |
jsbell
2014/02/15 00:23:54
Delete extra blank line
| |
32 void AppCacheHistograms::AddTaskQueueTimeSample( | 57 void AppCacheHistograms::AddTaskQueueTimeSample( |
33 const base::TimeDelta& duration) { | 58 const base::TimeDelta& duration) { |
34 UMA_HISTOGRAM_TIMES("appcache.TaskQueueTime", duration); | 59 UMA_HISTOGRAM_TIMES("appcache.TaskQueueTime", duration); |
35 } | 60 } |
36 | 61 |
37 void AppCacheHistograms::AddTaskRunTimeSample( | 62 void AppCacheHistograms::AddTaskRunTimeSample( |
38 const base::TimeDelta& duration) { | 63 const base::TimeDelta& duration) { |
39 UMA_HISTOGRAM_TIMES("appcache.TaskRunTime", duration); | 64 UMA_HISTOGRAM_TIMES("appcache.TaskRunTime", duration); |
40 } | 65 } |
41 | 66 |
(...skipping 27 matching lines...) Expand all Loading... | |
69 } | 94 } |
70 | 95 |
71 void AppCacheHistograms::AddMissingManifestDetectedAtCallsite( | 96 void AppCacheHistograms::AddMissingManifestDetectedAtCallsite( |
72 MissingManifestCallsiteType callsite) { | 97 MissingManifestCallsiteType callsite) { |
73 UMA_HISTOGRAM_ENUMERATION( | 98 UMA_HISTOGRAM_ENUMERATION( |
74 "appcache.MissingManifestDetectedAtCallsite", | 99 "appcache.MissingManifestDetectedAtCallsite", |
75 callsite, NUM_MISSING_MANIFEST_CALLSITE_TYPES); | 100 callsite, NUM_MISSING_MANIFEST_CALLSITE_TYPES); |
76 } | 101 } |
77 | 102 |
78 } // namespace appcache | 103 } // namespace appcache |
OLD | NEW |