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 "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/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/browser/download/download_resource_handler.h" | 10 #include "content/browser/download/download_resource_handler.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 UMA_HISTOGRAM_ENUMERATION("Download.WriteLoopCount", count, 20); | 336 UMA_HISTOGRAM_ENUMERATION("Download.WriteLoopCount", count, 20); |
337 } | 337 } |
338 | 338 |
339 void RecordAcceptsRanges(const std::string& accepts_ranges, | 339 void RecordAcceptsRanges(const std::string& accepts_ranges, |
340 int64 download_len, | 340 int64 download_len, |
341 bool has_strong_validator) { | 341 bool has_strong_validator) { |
342 int64 max = 1024 * 1024 * 1024; // One Terabyte. | 342 int64 max = 1024 * 1024 * 1024; // One Terabyte. |
343 download_len /= 1024; // In Kilobytes | 343 download_len /= 1024; // In Kilobytes |
344 static const int kBuckets = 50; | 344 static const int kBuckets = 50; |
345 | 345 |
346 if (LowerCaseEqualsASCII(accepts_ranges, "none")) { | 346 if (base::LowerCaseEqualsASCII(accepts_ranges, "none")) { |
347 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesNone.KBytes", | 347 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesNone.KBytes", |
348 download_len, | 348 download_len, |
349 1, | 349 1, |
350 max, | 350 max, |
351 kBuckets); | 351 kBuckets); |
352 } else if (LowerCaseEqualsASCII(accepts_ranges, "bytes")) { | 352 } else if (base::LowerCaseEqualsASCII(accepts_ranges, "bytes")) { |
353 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesBytes.KBytes", | 353 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesBytes.KBytes", |
354 download_len, | 354 download_len, |
355 1, | 355 1, |
356 max, | 356 max, |
357 kBuckets); | 357 kBuckets); |
358 if (has_strong_validator) | 358 if (has_strong_validator) |
359 RecordDownloadCount(STRONG_VALIDATOR_AND_ACCEPTS_RANGES); | 359 RecordDownloadCount(STRONG_VALIDATOR_AND_ACCEPTS_RANGES); |
360 } else { | 360 } else { |
361 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesMissingOrInvalid.KBytes", | 361 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesMissingOrInvalid.KBytes", |
362 download_len, | 362 download_len, |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 int state) { | 621 int state) { |
622 if (is_partial) | 622 if (is_partial) |
623 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnPartialResumption", state, | 623 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnPartialResumption", state, |
624 ORIGIN_STATE_ON_RESUMPTION_MAX); | 624 ORIGIN_STATE_ON_RESUMPTION_MAX); |
625 else | 625 else |
626 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnFullResumption", state, | 626 UMA_HISTOGRAM_ENUMERATION("Download.OriginStateOnFullResumption", state, |
627 ORIGIN_STATE_ON_RESUMPTION_MAX); | 627 ORIGIN_STATE_ON_RESUMPTION_MAX); |
628 } | 628 } |
629 | 629 |
630 } // namespace content | 630 } // namespace content |
OLD | NEW |