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

Unified Diff: content/browser/download/download_stats.cc

Issue 2885793004: Parallelizable download metrics. (Closed)
Patch Set: Some change according to meeting. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/download_stats.h ('k') | content/browser/download/download_stats_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_stats.cc
diff --git a/content/browser/download/download_stats.cc b/content/browser/download/download_stats.cc
index 708615419d511191b4d563bd5c0584f514c90476..ea49d2da425ca54d2bf1a2ebee2c2b918853b4ef 100644
--- a/content/browser/download/download_stats.cc
+++ b/content/browser/download/download_stats.cc
@@ -339,6 +339,10 @@ const base::FilePath::CharType* kDangerousFileTypes[] = {
FILE_PATH_LITERAL(".udif"),
};
+// The maximum size in KB for the file size metric, file size larger than this
+// will be kept in overflow bucket.
+const int64_t kMaxFileSizeKb = 4 * 1024 * 1024; /* 4GB. */
+
// Maps extensions to their matching UMA histogram int value.
int GetDangerousFileType(const base::FilePath& file_path) {
for (size_t i = 0; i < arraysize(kDangerousFileTypes); ++i) {
@@ -796,6 +800,11 @@ void RecordParallelizableDownloadStats(
size_t bytes_downloaded_without_parallel_streams,
base::TimeDelta time_without_parallel_streams,
bool uses_parallel_requests) {
+ RecordParallelizableDownloadAverageStats(
+ bytes_downloaded_with_parallel_streams +
+ bytes_downloaded_without_parallel_streams,
+ time_with_parallel_streams + time_without_parallel_streams);
+
int64_t bandwidth_without_parallel_streams = 0;
if (bytes_downloaded_without_parallel_streams > 0) {
bandwidth_without_parallel_streams = CalculateBandwidthBytesPerSecond(
@@ -863,6 +872,22 @@ void RecordParallelizableDownloadStats(
}
}
+void RecordParallelizableDownloadAverageStats(
+ int64_t bytes_downloaded,
+ const base::TimeDelta& time_span) {
+ if (time_span.is_zero() || bytes_downloaded <= 0)
+ return;
+
+ int64_t average_bandwidth =
+ CalculateBandwidthBytesPerSecond(bytes_downloaded, time_span);
+ int64_t file_size_kb = bytes_downloaded / 1024;
+ RecordBandwidthMetric("Download.ParallelizableDownloadBandwidth",
+ average_bandwidth);
+ UMA_HISTOGRAM_LONG_TIMES("Download.Parallelizable.DownloadTime", time_span);
+ UMA_HISTOGRAM_CUSTOM_COUNTS("Download.Parallelizable.FileSize", file_size_kb,
+ 1, kMaxFileSizeKb, 50);
+}
+
void RecordParallelDownloadCreationEvent(ParallelDownloadCreationEvent event) {
UMA_HISTOGRAM_ENUMERATION("Download.ParallelDownload.CreationEvent", event,
ParallelDownloadCreationEvent::COUNT);
« no previous file with comments | « content/browser/download/download_stats.h ('k') | content/browser/download/download_stats_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698