| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/download/download_stats.h" | 5 #include "content/browser/download/download_stats.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "content/browser/download/download_resource_handler.h" | 9 #include "content/browser/download/download_resource_handler.h" |
| 10 #include "content/browser/download/interrupt_reasons.h" | 10 #include "content/browser/download/interrupt_reasons.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 UMA_HISTOGRAM_ENUMERATION("Download.WriteLoopCount", count, 20); | 102 UMA_HISTOGRAM_ENUMERATION("Download.WriteLoopCount", count, 20); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void RecordAcceptsRanges(const std::string& accepts_ranges, | 105 void RecordAcceptsRanges(const std::string& accepts_ranges, |
| 106 int64 download_len) { | 106 int64 download_len) { |
| 107 int64 max = 1024 * 1024 * 1024; // One Terabyte. | 107 int64 max = 1024 * 1024 * 1024; // One Terabyte. |
| 108 download_len /= 1024; // In Kilobytes | 108 download_len /= 1024; // In Kilobytes |
| 109 static const int kBuckets = 50; | 109 static const int kBuckets = 50; |
| 110 | 110 |
| 111 if (LowerCaseEqualsASCII(accepts_ranges, "none")) { | 111 if (LowerCaseEqualsASCII(accepts_ranges, "none")) { |
| 112 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.KBytes.AcceptRangesNone", | 112 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesNone.KBytes", |
| 113 download_len, | 113 download_len, |
| 114 1, | 114 1, |
| 115 max, | 115 max, |
| 116 kBuckets); | 116 kBuckets); |
| 117 } else if (LowerCaseEqualsASCII(accepts_ranges, "bytes")) { | 117 } else if (LowerCaseEqualsASCII(accepts_ranges, "bytes")) { |
| 118 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.KBytes.AcceptRangesBytes", | 118 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesBytes.KBytes", |
| 119 download_len, | 119 download_len, |
| 120 1, | 120 1, |
| 121 max, | 121 max, |
| 122 kBuckets); | 122 kBuckets); |
| 123 } else { | 123 } else { |
| 124 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.KBytes.AcceptRangesMissingOrInvalid", | 124 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesMissingOrInvalid.KBytes", |
| 125 download_len, | 125 download_len, |
| 126 1, | 126 1, |
| 127 max, | 127 max, |
| 128 kBuckets); | 128 kBuckets); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 namespace { | 132 namespace { |
| 133 | 133 |
| 134 enum DownloadContent { | 134 enum DownloadContent { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 void RecordOpensOutstanding(int size) { | 270 void RecordOpensOutstanding(int size) { |
| 271 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.OpensOutstanding", | 271 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.OpensOutstanding", |
| 272 size, | 272 size, |
| 273 0/*min*/, | 273 0/*min*/, |
| 274 (1 << 10)/*max*/, | 274 (1 << 10)/*max*/, |
| 275 64/*num_buckets*/); | 275 64/*num_buckets*/); |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace download_stats | 278 } // namespace download_stats |
| OLD | NEW |