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

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

Issue 2769933003: Add more UMA to record whether parallel download is completed/interrupted/cancelled (Closed)
Patch Set: report interrupted UMA for all downloads Created 3 years, 9 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
Index: content/browser/download/download_stats.cc
diff --git a/content/browser/download/download_stats.cc b/content/browser/download/download_stats.cc
index 0bfb00271b99a6cbb6acbab0414b2799a665f378..6c940968453db20eca34b661c3758fff3d862aaa 100644
--- a/content/browser/download/download_stats.cc
+++ b/content/browser/download/download_stats.cc
@@ -389,13 +389,21 @@ void RecordDownloadCompleted(const base::TimeTicks& start,
void RecordDownloadInterrupted(DownloadInterruptReason reason,
int64_t received,
- int64_t total) {
+ int64_t total,
+ bool uses_parallel_requests) {
RecordDownloadCount(INTERRUPTED_COUNT);
- UMA_HISTOGRAM_CUSTOM_ENUMERATION(
- "Download.InterruptedReason",
- reason,
+ if (uses_parallel_requests)
+ RecordParallelDownloadCount(PARALLEL_DOWNLOAD_INTERRUPTED_COUNT);
+
+ std::vector<base::HistogramBase::Sample> samples =
base::CustomHistogram::ArrayToCustomRanges(
- kAllInterruptReasonCodes, arraysize(kAllInterruptReasonCodes)));
+ kAllInterruptReasonCodes, arraysize(kAllInterruptReasonCodes));
+ UMA_HISTOGRAM_CUSTOM_ENUMERATION("Download.InterruptedReason", reason,
+ samples);
+ if (uses_parallel_requests) {
+ UMA_HISTOGRAM_CUSTOM_ENUMERATION(
+ "Download.ParallelDownloadInterruptedReason", reason, samples);
+ }
// The maximum should be 2^kBuckets, to have the logarithmic bucket
// boundaries fall on powers of 2.
@@ -410,32 +418,55 @@ void RecordDownloadInterrupted(DownloadInterruptReason reason,
1,
kMaxKb,
kBuckets);
+ if (uses_parallel_requests) {
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Download.ParallelDownloadInterruptedReceivedSizeK", received_kb, 1,
Ilya Sherman 2017/03/24 00:52:59 Optional: You might want to move "ParallelDownload
Ilya Sherman 2017/03/24 00:52:59 nit: I'd use an extra dot to separate "ParallelDow
qinmin 2017/03/24 19:54:39 uses .ParallelDownload suffix now
qinmin 2017/03/24 19:54:40 Done.
+ kMaxKb, kBuckets);
+ }
+
if (!unknown_size) {
UMA_HISTOGRAM_CUSTOM_COUNTS("Download.InterruptedTotalSizeK",
total_kb,
1,
kMaxKb,
kBuckets);
+ if (uses_parallel_requests) {
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Download.ParallelDownloadInterruptedTotalSizeK", total_kb, 1, kMaxKb,
+ kBuckets);
+ }
if (delta_bytes == 0) {
RecordDownloadCount(INTERRUPTED_AT_END_COUNT);
UMA_HISTOGRAM_CUSTOM_ENUMERATION(
- "Download.InterruptedAtEndReason",
- reason,
- base::CustomHistogram::ArrayToCustomRanges(
- kAllInterruptReasonCodes,
- arraysize(kAllInterruptReasonCodes)));
+ "Download.InterruptedAtEndReason", reason, samples);
+
+ if (uses_parallel_requests) {
+ RecordParallelDownloadCount(PARALLEL_DOWNLOAD_INTERRUPTED_AT_END_COUNT);
+ UMA_HISTOGRAM_CUSTOM_ENUMERATION(
+ "Download.ParallelDownloadInterruptedAtEndReason", reason, samples);
+ }
} else if (delta_bytes > 0) {
UMA_HISTOGRAM_CUSTOM_COUNTS("Download.InterruptedOverrunBytes",
delta_bytes,
1,
kMaxKb,
kBuckets);
+ if (uses_parallel_requests) {
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Download.ParallelDownloadInterruptedOverrunBytes", delta_bytes, 1,
+ kMaxKb, kBuckets);
+ }
} else {
UMA_HISTOGRAM_CUSTOM_COUNTS("Download.InterruptedUnderrunBytes",
-delta_bytes,
1,
kMaxKb,
kBuckets);
+ if (uses_parallel_requests) {
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Download.ParallelDownloadInterruptedUnderrunBytes", -delta_bytes,
+ 1, kMaxKb, kBuckets);
+ }
}
}
@@ -726,6 +757,11 @@ void RecordFileBandwidth(size_t length,
CalculateBandwidthBytesPerSecond(length, disk_write_time));
}
+void RecordParallelDownloadCount(ParallelDownloadCountTypes type) {
+ UMA_HISTOGRAM_ENUMERATION("Download.ParallelDownloadCounts", type,
+ PARALLEL_DOWNLOAD_COUNT_TYPES_LAST_ENTRY);
+}
+
void RecordParallelDownloadStats(
size_t bytes_downloaded_with_parallel_streams,
base::TimeDelta time_with_parallel_streams,

Powered by Google App Engine
This is Rietveld 408576698