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

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

Issue 2806653002: Add UMA to track why a download is non-parallel when enabled parallel (Closed)
Patch Set: Minor comment polish. 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 unified diff | Download patch
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 // Holds helpers for gathering UMA stats about downloads. 5 // Holds helpers for gathering UMA stats about downloads.
6 6
7 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ 7 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_
8 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ 8 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 }; 138 };
139 139
140 enum DownloadDiscardReason { 140 enum DownloadDiscardReason {
141 // The download is being discarded due to a user action. 141 // The download is being discarded due to a user action.
142 DOWNLOAD_DISCARD_DUE_TO_USER_ACTION, 142 DOWNLOAD_DISCARD_DUE_TO_USER_ACTION,
143 143
144 // The download is being discarded due to the browser being shut down. 144 // The download is being discarded due to the browser being shut down.
145 DOWNLOAD_DISCARD_DUE_TO_SHUTDOWN 145 DOWNLOAD_DISCARD_DUE_TO_SHUTDOWN
146 }; 146 };
147 147
148 // When parallel download is enabled, the download may fall back to a normal
149 // download for various reasons. This enum counts the number of parallel
150 // download and fallbacks. Also records the reasons why the download falls back
151 // to a normal download. The reasons are not mutual exclusive.
152 enum class ParallelDownloadCreationEvent {
Ilya Sherman 2017/04/08 01:22:46 nit: Please document that this enum is used to bac
xingliu 2017/04/10 18:56:30 Done.
153 // The total number of downloads created as parallel download.
154 PARALLEL_DOWNLOAD_COUNT = 0,
Ilya Sherman 2017/04/08 01:22:46 Optional nit: I still think it's weird to use "COU
xingliu 2017/04/10 18:56:30 Done.
155
156 // The total number of downloads fall back to normal download when parallel
157 // download is enabled.
158 FALLBACK_TO_NORMAL_DOWNLOAD_COUNT,
159
160 // No ETag or Last-Modified response header.
161 FALLBACK_REASON_STRONG_VALIDATORS,
162
163 // No Accept-Range response header.
164 FALLBACK_REASON_ACCEPT_RANGE_HEADER,
165
166 // No Content-Length response header.
167 FALLBACK_REASON_CONTENT_LENGTH_HEADER,
168
169 // File size is not complied to finch configuration.
170 FALLBACK_REASON_FILE_SIZE,
171
172 // The HTTP connection type does not meet the requirement.
173 FALLBACK_REASON_CONNECTION_TYPE,
174
175 // Last entry of the enum.
176 MAX,
Ilya Sherman 2017/04/08 01:22:46 Optional nit: IMO "max" makes sense to use as an a
xingliu 2017/04/10 18:56:30 Done.
177 };
178
148 // Increment one of the above counts. 179 // Increment one of the above counts.
149 void RecordDownloadCount(DownloadCountTypes type); 180 void RecordDownloadCount(DownloadCountTypes type);
150 181
151 // Record initiation of a download from a specific source. 182 // Record initiation of a download from a specific source.
152 void RecordDownloadSource(DownloadSource source); 183 void RecordDownloadSource(DownloadSource source);
153 184
154 // Record COMPLETED_COUNT and how long the download took. 185 // Record COMPLETED_COUNT and how long the download took.
155 void RecordDownloadCompleted(const base::TimeTicks& start, 186 void RecordDownloadCompleted(const base::TimeTicks& start,
156 int64_t download_len); 187 int64_t download_len);
157 188
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 void RecordParallelDownloadAddStreamSuccess(bool success); 260 void RecordParallelDownloadAddStreamSuccess(bool success);
230 261
231 // Records the bandwidth for parallel download and estimates the saved time at 262 // Records the bandwidth for parallel download and estimates the saved time at
232 // the file end. Does not count in any hash computation or file open/close time. 263 // the file end. Does not count in any hash computation or file open/close time.
233 void RecordParallelDownloadStats( 264 void RecordParallelDownloadStats(
234 size_t bytes_downloaded_with_parallel_streams, 265 size_t bytes_downloaded_with_parallel_streams,
235 base::TimeDelta time_with_parallel_streams, 266 base::TimeDelta time_with_parallel_streams,
236 size_t bytes_downloaded_without_parallel_streams, 267 size_t bytes_downloaded_without_parallel_streams,
237 base::TimeDelta time_without_parallel_streams); 268 base::TimeDelta time_without_parallel_streams);
238 269
270 // Records the parallel download creation counts and the reasons why the
271 // download falls back to non-parallel download.
272 void RecordParallelDownloadCreationEvent(ParallelDownloadCreationEvent event);
273
239 // Record the result of a download file rename. 274 // Record the result of a download file rename.
240 void RecordDownloadFileRenameResultAfterRetry( 275 void RecordDownloadFileRenameResultAfterRetry(
241 base::TimeDelta time_since_first_failure, 276 base::TimeDelta time_since_first_failure,
242 DownloadInterruptReason interrupt_reason); 277 DownloadInterruptReason interrupt_reason);
243 278
244 enum SavePackageEvent { 279 enum SavePackageEvent {
245 // The user has started to save a page as a package. 280 // The user has started to save a page as a package.
246 SAVE_PACKAGE_STARTED, 281 SAVE_PACKAGE_STARTED,
247 282
248 // The save package operation was cancelled. 283 // The save package operation was cancelled.
(...skipping 28 matching lines...) Expand all
277 312
278 void RecordDownloadConnectionSecurity(const GURL& download_url, 313 void RecordDownloadConnectionSecurity(const GURL& download_url,
279 const std::vector<GURL>& url_chain); 314 const std::vector<GURL>& url_chain);
280 315
281 void RecordDownloadSourcePageTransitionType( 316 void RecordDownloadSourcePageTransitionType(
282 const base::Optional<ui::PageTransition>& transition); 317 const base::Optional<ui::PageTransition>& transition);
283 318
284 } // namespace content 319 } // namespace content
285 320
286 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ 321 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698