summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorahendrickson@chromium.org <ahendrickson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-07 19:45:21 +0000
committerahendrickson@chromium.org <ahendrickson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-07 19:45:21 +0000
commit4615795e995dea0c7925288929fef3d945ec7b9f (patch)
treeb41f32714c64d8f06d2bc5dff4d50d8a75f33723 /content
parent54c9b70f6946559b9dd7588ecd8ab786c189f7dd (diff)
downloadchromium_src-4615795e995dea0c7925288929fef3d945ec7b9f.zip
chromium_src-4615795e995dea0c7925288929fef3d945ec7b9f.tar.gz
chromium_src-4615795e995dea0c7925288929fef3d945ec7b9f.tar.bz2
Added more UMA statistics for downloads.
Split from CL 7134019. BUG=None TEST=None Review URL: http://codereview.chromium.org/7778038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/download/download_item.cc2
-rw-r--r--content/browser/download/download_stats.cc20
-rw-r--r--content/browser/download/download_stats.h14
3 files changed, 33 insertions, 3 deletions
diff --git a/content/browser/download/download_item.cc b/content/browser/download/download_item.cc
index 6d9dc303..0809872 100644
--- a/content/browser/download/download_item.cc
+++ b/content/browser/download/download_item.cc
@@ -409,7 +409,7 @@ void DownloadItem::Completed() {
DCHECK(all_data_saved_);
TransitionTo(COMPLETE);
download_manager_->DownloadCompleted(id());
- download_stats::RecordDownloadCompleted(start_tick_);
+ download_stats::RecordDownloadCompleted(start_tick_, received_bytes_);
if (auto_opened_) {
// If it was already handled by the delegate, do nothing.
diff --git a/content/browser/download/download_stats.cc b/content/browser/download/download_stats.cc
index c51f68a..90d943a 100644
--- a/content/browser/download/download_stats.cc
+++ b/content/browser/download/download_stats.cc
@@ -22,9 +22,16 @@ void RecordDownloadCount(DownloadCountTypes type) {
"Download.Counts", type, DOWNLOAD_COUNT_TYPES_LAST_ENTRY);
}
-void RecordDownloadCompleted(const base::TimeTicks& start) {
+void RecordDownloadCompleted(const base::TimeTicks& start, int64 download_len) {
RecordDownloadCount(COMPLETED_COUNT);
UMA_HISTOGRAM_LONG_TIMES("Download.Time", (base::TimeTicks::Now() - start));
+ int64 max = 1024 * 1024 * 1024; // One Terabyte.
+ download_len /= 1024; // In Kilobytes
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Download.DownloadSize",
+ download_len,
+ 1,
+ max,
+ 256);
}
void RecordDownloadInterrupted(int error, int64 received, int64 total) {
@@ -72,6 +79,17 @@ void RecordDownloadInterrupted(int error, int64 received, int64 total) {
UMA_HISTOGRAM_BOOLEAN("Download.InterruptedUnknownSize", unknown_size);
}
+void RecordDownloadWriteSize(size_t data_len) {
+ RecordDownloadCount(WRITE_SIZE_COUNT);
+ int max = 1024 * 1024; // One Megabyte.
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Download.WriteSize", data_len, 1, max, 256);
+}
+
+void RecordDownloadWriteLoopCount(int count) {
+ RecordDownloadCount(WRITE_LOOP_COUNT);
+ UMA_HISTOGRAM_ENUMERATION("Download.WriteLoopCount", count, 20);
+}
+
namespace {
enum DownloadContent {
diff --git a/content/browser/download/download_stats.h b/content/browser/download/download_stats.h
index b1e7624..0007bcf 100644
--- a/content/browser/download/download_stats.h
+++ b/content/browser/download/download_stats.h
@@ -57,6 +57,12 @@ enum DownloadCountTypes {
// Downloads that were interrupted by the OS.
INTERRUPTED_COUNT,
+ // Write sizes for downloads.
+ WRITE_SIZE_COUNT,
+
+ // Counts iterations of the BaseFile::AppendDataToFile() loop.
+ WRITE_LOOP_COUNT,
+
DOWNLOAD_COUNT_TYPES_LAST_ENTRY
};
@@ -64,7 +70,7 @@ enum DownloadCountTypes {
void RecordDownloadCount(DownloadCountTypes type);
// Record COMPLETED_COUNT and how long the download took.
-void RecordDownloadCompleted(const base::TimeTicks& start);
+void RecordDownloadCompleted(const base::TimeTicks& start, int64 download_len);
// Record INTERRUPTED_COUNT, |error|, |received| and |total| bytes.
void RecordDownloadInterrupted(int error, int64 received, int64 total);
@@ -72,6 +78,12 @@ void RecordDownloadInterrupted(int error, int64 received, int64 total);
// Records the mime type of the download.
void RecordDownloadMimeType(const std::string& mime_type);
+// Record WRITE_SIZE_COUNT and data_len.
+void RecordDownloadWriteSize(size_t data_len);
+
+// Record WRITE_LOOP_COUNT and number of loops.
+void RecordDownloadWriteLoopCount(int count);
+
} // namespace download_stats
#endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_