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