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

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

Issue 2823273004: Add new UMA stats for parallelizable download (Closed)
Patch Set: Created 3 years, 8 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 72135e29961bb7eec5104228af86ccddaef3d062..62f5f25d2914a57855fbd792a55413363e227932 100644
--- a/content/browser/download/download_stats.cc
+++ b/content/browser/download/download_stats.cc
@@ -389,10 +389,13 @@ void RecordDownloadCompleted(const base::TimeTicks& start,
void RecordDownloadInterrupted(DownloadInterruptReason reason,
int64_t received,
int64_t total,
+ bool is_parallelizable,
bool uses_parallel_requests) {
RecordDownloadCount(INTERRUPTED_COUNT);
- if (uses_parallel_requests)
- RecordParallelDownloadCount(INTERRUPTED_COUNT);
+ if (is_parallelizable) {
+ RecordParallelizableDownloadCount(INTERRUPTED_COUNT,
+ uses_parallel_requests);
+ }
std::vector<base::HistogramBase::Sample> samples =
base::CustomHistogram::ArrayToCustomRanges(
@@ -439,8 +442,9 @@ void RecordDownloadInterrupted(DownloadInterruptReason reason,
UMA_HISTOGRAM_CUSTOM_ENUMERATION("Download.InterruptedAtEndReason",
reason, samples);
- if (uses_parallel_requests) {
- RecordParallelDownloadCount(INTERRUPTED_AT_END_COUNT);
+ if (is_parallelizable) {
+ RecordParallelizableDownloadCount(INTERRUPTED_AT_END_COUNT,
+ uses_parallel_requests);
UMA_HISTOGRAM_CUSTOM_ENUMERATION(
"Download.InterruptedAtEndReason.ParallelDownload", reason,
samples);
@@ -767,8 +771,12 @@ void RecordFileBandwidth(size_t length,
CalculateBandwidthBytesPerSecond(length, disk_write_time));
}
-void RecordParallelDownloadCount(DownloadCountTypes type) {
- UMA_HISTOGRAM_ENUMERATION("Download.Counts.ParallelDownload", type,
+void RecordParallelizableDownloadCount(DownloadCountTypes type,
+ bool uses_parallel_requests) {
+ std::string histogram_name = uses_parallel_requests
+ ? "Download.Counts.ParallelDownload"
+ : "Download.Counts.ParallelizableDownload";
+ UMA_HISTOGRAM_ENUMERATION(histogram_name, type,
Ilya Sherman 2017/04/19 00:29:41 UMA_HISTOGRAM macros require a runtime-constant na
qinmin 2017/04/19 22:42:33 Done.
DOWNLOAD_COUNT_TYPES_LAST_ENTRY);
}
@@ -781,20 +789,40 @@ void RecordParallelDownloadAddStreamSuccess(bool success) {
UMA_HISTOGRAM_BOOLEAN("Download.ParallelDownloadAddStreamSuccess", success);
}
-void RecordParallelDownloadStats(
+void RecordParallelizableDownloadStats(
size_t bytes_downloaded_with_parallel_streams,
base::TimeDelta time_with_parallel_streams,
size_t bytes_downloaded_without_parallel_streams,
- base::TimeDelta time_without_parallel_streams) {
- int64_t bandwidth_without_parallel_streams = CalculateBandwidthBytesPerSecond(
- bytes_downloaded_without_parallel_streams, time_without_parallel_streams);
- RecordBandwidthMetric(
- "Download.BandwidthWithoutParallelStreamsBytesPerSecond",
- bandwidth_without_parallel_streams);
- RecordBandwidthMetric(
- "Download.BandwidthWithParallelStreamsBytesPerSecond",
- CalculateBandwidthBytesPerSecond(bytes_downloaded_with_parallel_streams,
- time_with_parallel_streams));
+ base::TimeDelta time_without_parallel_streams,
+ bool uses_parallel_requests) {
+ int64_t bandwidth_without_parallel_streams = 0;
+ if (bytes_downloaded_without_parallel_streams > 0) {
+ bandwidth_without_parallel_streams = CalculateBandwidthBytesPerSecond(
+ bytes_downloaded_without_parallel_streams,
+ time_without_parallel_streams);
+ if (uses_parallel_requests) {
+ RecordBandwidthMetric(
+ "Download.ParallelizableDownloadBandwidth."
+ "WithParallelRequestsSingleStream",
+ bandwidth_without_parallel_streams);
+ } else {
+ RecordBandwidthMetric(
+ "Download.ParallelizableDownloadBandwidth."
+ "WithoutParallelRequests",
+ bandwidth_without_parallel_streams);
+ }
+ }
+
+ if (!uses_parallel_requests)
+ return;
+
+ if (bytes_downloaded_with_parallel_streams > 0) {
+ RecordBandwidthMetric(
+ "Download.ParallelizableDownloadBandwidth."
+ "WithParallelRequestsMultipleStreams",
+ CalculateBandwidthBytesPerSecond(bytes_downloaded_with_parallel_streams,
+ time_with_parallel_streams));
+ }
base::TimeDelta time_saved;
if (bandwidth_without_parallel_streams > 0) {

Powered by Google App Engine
This is Rietveld 408576698