Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1139)

Side by Side Diff: content/browser/download/download_stats.cc

Issue 2598773002: [Downloads] Deprecate incorrect metrics. (Closed)
Patch Set: . Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/download/download_stats.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/macros.h" 7 #include "base/macros.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/metrics/sparse_histogram.h" 9 #include "base/metrics/sparse_histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 if (danger_type == DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE) { 462 if (danger_type == DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE) {
463 UMA_HISTOGRAM_SPARSE_SLOWLY("Download.DangerousFile.Discard", 463 UMA_HISTOGRAM_SPARSE_SLOWLY("Download.DangerousFile.Discard",
464 GetDangerousFileType(file_path)); 464 GetDangerousFileType(file_path));
465 } 465 }
466 break; 466 break;
467 default: 467 default:
468 NOTREACHED(); 468 NOTREACHED();
469 } 469 }
470 } 470 }
471 471
472 void RecordDownloadWriteSize(size_t data_len) {
473 int max = 1024 * 1024; // One Megabyte.
474 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.WriteSize", data_len, 1, max, 256);
475 }
476
477 void RecordDownloadWriteLoopCount(int count) {
478 UMA_HISTOGRAM_ENUMERATION("Download.WriteLoopCount", count, 20);
479 }
480
481 void RecordAcceptsRanges(const std::string& accepts_ranges, 472 void RecordAcceptsRanges(const std::string& accepts_ranges,
482 int64_t download_len, 473 int64_t download_len,
483 bool has_strong_validator) { 474 bool has_strong_validator) {
484 int64_t max = 1024 * 1024 * 1024; // One Terabyte. 475 int64_t max = 1024 * 1024 * 1024; // One Terabyte.
485 download_len /= 1024; // In Kilobytes 476 download_len /= 1024; // In Kilobytes
486 static const int kBuckets = 50; 477 static const int kBuckets = 50;
487 478
488 if (base::LowerCaseEqualsASCII(accepts_ranges, "none")) { 479 if (base::LowerCaseEqualsASCII(accepts_ranges, "none")) {
489 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesNone.KBytes", 480 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesNone.KBytes",
490 download_len, 481 download_len,
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 CONTENT_DISPOSITION_HAS_RFC2047_ENCODED_STRINGS, result, 657 CONTENT_DISPOSITION_HAS_RFC2047_ENCODED_STRINGS, result,
667 net::HttpContentDisposition::HAS_RFC2047_ENCODED_STRINGS); 658 net::HttpContentDisposition::HAS_RFC2047_ENCODED_STRINGS);
668 } 659 }
669 660
670 void RecordFileThreadReceiveBuffers(size_t num_buffers) { 661 void RecordFileThreadReceiveBuffers(size_t num_buffers) {
671 UMA_HISTOGRAM_CUSTOM_COUNTS( 662 UMA_HISTOGRAM_CUSTOM_COUNTS(
672 "Download.FileThreadReceiveBuffers", num_buffers, 1, 663 "Download.FileThreadReceiveBuffers", num_buffers, 1,
673 100, 100); 664 100, 100);
674 } 665 }
675 666
676 void RecordBandwidth(double actual_bandwidth, double potential_bandwidth) {
677 UMA_HISTOGRAM_CUSTOM_COUNTS(
678 "Download.ActualBandwidth", actual_bandwidth, 1, 1000000000, 50);
679 UMA_HISTOGRAM_CUSTOM_COUNTS(
680 "Download.PotentialBandwidth", potential_bandwidth, 1, 1000000000, 50);
681 UMA_HISTOGRAM_PERCENTAGE(
682 "Download.BandwidthUsed",
683 (int) ((actual_bandwidth * 100)/ potential_bandwidth));
684 }
685
686 void RecordOpen(const base::Time& end, bool first) { 667 void RecordOpen(const base::Time& end, bool first) {
687 if (!end.is_null()) { 668 if (!end.is_null()) {
688 UMA_HISTOGRAM_LONG_TIMES("Download.OpenTime", (base::Time::Now() - end)); 669 UMA_HISTOGRAM_LONG_TIMES("Download.OpenTime", (base::Time::Now() - end));
689 if (first) { 670 if (first) {
690 UMA_HISTOGRAM_LONG_TIMES("Download.FirstOpenTime", 671 UMA_HISTOGRAM_LONG_TIMES("Download.FirstOpenTime",
691 (base::Time::Now() - end)); 672 (base::Time::Now() - end));
692 } 673 }
693 } 674 }
694 } 675 }
695 676
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 size_t disk_write_time_ms = disk_write_time.InMilliseconds(); 717 size_t disk_write_time_ms = disk_write_time.InMilliseconds();
737 if (0u == disk_write_time_ms) 718 if (0u == disk_write_time_ms)
738 disk_write_time_ms = 1; 719 disk_write_time_ms = 1;
739 720
740 UMA_HISTOGRAM_CUSTOM_COUNTS( 721 UMA_HISTOGRAM_CUSTOM_COUNTS(
741 "Download.BandwidthOverallBytesPerSecond", 722 "Download.BandwidthOverallBytesPerSecond",
742 (1000 * length / elapsed_time_ms), 1, 50000000, 50); 723 (1000 * length / elapsed_time_ms), 1, 50000000, 50);
743 UMA_HISTOGRAM_CUSTOM_COUNTS( 724 UMA_HISTOGRAM_CUSTOM_COUNTS(
744 "Download.BandwidthDiskBytesPerSecond", 725 "Download.BandwidthDiskBytesPerSecond",
745 (1000 * length / disk_write_time_ms), 1, 50000000, 50); 726 (1000 * length / disk_write_time_ms), 1, 50000000, 50);
746 UMA_HISTOGRAM_COUNTS_100("Download.DiskBandwidthUsedPercentage",
747 disk_write_time_ms * 100 / elapsed_time_ms);
748 } 727 }
749 728
750 void RecordDownloadFileRenameResultAfterRetry( 729 void RecordDownloadFileRenameResultAfterRetry(
751 base::TimeDelta time_since_first_failure, 730 base::TimeDelta time_since_first_failure,
752 DownloadInterruptReason interrupt_reason) { 731 DownloadInterruptReason interrupt_reason) {
753 if (interrupt_reason == DOWNLOAD_INTERRUPT_REASON_NONE) { 732 if (interrupt_reason == DOWNLOAD_INTERRUPT_REASON_NONE) {
754 UMA_HISTOGRAM_TIMES("Download.TimeToRenameSuccessAfterInitialFailure", 733 UMA_HISTOGRAM_TIMES("Download.TimeToRenameSuccessAfterInitialFailure",
755 time_since_first_failure); 734 time_since_first_failure);
756 } else { 735 } else {
757 UMA_HISTOGRAM_TIMES("Download.TimeToRenameFailureAfterInitialFailure", 736 UMA_HISTOGRAM_TIMES("Download.TimeToRenameFailureAfterInitialFailure",
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 : DOWNLOAD_REDIRECT_INSECURE 792 : DOWNLOAD_REDIRECT_INSECURE
814 : is_redirect_chain_secure ? DOWNLOAD_TARGET_INSECURE 793 : is_redirect_chain_secure ? DOWNLOAD_TARGET_INSECURE
815 : DOWNLOAD_REDIRECT_TARGET_INSECURE; 794 : DOWNLOAD_REDIRECT_TARGET_INSECURE;
816 } 795 }
817 796
818 UMA_HISTOGRAM_ENUMERATION("Download.TargetConnectionSecurity", state, 797 UMA_HISTOGRAM_ENUMERATION("Download.TargetConnectionSecurity", state,
819 DOWNLOAD_CONNECTION_SECURITY_MAX); 798 DOWNLOAD_CONNECTION_SECURITY_MAX);
820 } 799 }
821 800
822 } // namespace content 801 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_stats.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698