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

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: Polish on histogram naming. 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 mutually exclusive.
152 // Used in histogram "Download.ParallelDownload.CreationEvent".
Ilya Sherman 2017/04/10 21:54:15 nit: Please also document that "and therefore, sho
xingliu 2017/04/10 22:07:12 Done, sorry I probably forgot this one.
153 enum class ParallelDownloadCreationEvent {
154 // The total number of downloads started as parallel download.
155 STARTED_PARALLEL_DOWNLOAD = 0,
156
157 // The total number of downloads fell back to normal download when parallel
158 // download is enabled.
159 FELL_BACK_TO_NORMAL_DOWNLOAD,
160
161 // No ETag or Last-Modified response header.
162 FALLBACK_REASON_STRONG_VALIDATORS,
163
164 // No Accept-Range response header.
165 FALLBACK_REASON_ACCEPT_RANGE_HEADER,
166
167 // No Content-Length response header.
168 FALLBACK_REASON_CONTENT_LENGTH_HEADER,
169
170 // File size is not complied to finch configuration.
171 FALLBACK_REASON_FILE_SIZE,
172
173 // The HTTP connection type does not meet the requirement.
174 FALLBACK_REASON_CONNECTION_TYPE,
175
176 // Last entry of the enum.
177 COUNT,
178 };
179
148 // Increment one of the above counts. 180 // Increment one of the above counts.
149 void RecordDownloadCount(DownloadCountTypes type); 181 void RecordDownloadCount(DownloadCountTypes type);
150 182
151 // Record initiation of a download from a specific source. 183 // Record initiation of a download from a specific source.
152 void RecordDownloadSource(DownloadSource source); 184 void RecordDownloadSource(DownloadSource source);
153 185
154 // Record COMPLETED_COUNT and how long the download took. 186 // Record COMPLETED_COUNT and how long the download took.
155 void RecordDownloadCompleted(const base::TimeTicks& start, 187 void RecordDownloadCompleted(const base::TimeTicks& start,
156 int64_t download_len); 188 int64_t download_len);
157 189
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 void RecordParallelDownloadAddStreamSuccess(bool success); 261 void RecordParallelDownloadAddStreamSuccess(bool success);
230 262
231 // Records the bandwidth for parallel download and estimates the saved time at 263 // 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. 264 // the file end. Does not count in any hash computation or file open/close time.
233 void RecordParallelDownloadStats( 265 void RecordParallelDownloadStats(
234 size_t bytes_downloaded_with_parallel_streams, 266 size_t bytes_downloaded_with_parallel_streams,
235 base::TimeDelta time_with_parallel_streams, 267 base::TimeDelta time_with_parallel_streams,
236 size_t bytes_downloaded_without_parallel_streams, 268 size_t bytes_downloaded_without_parallel_streams,
237 base::TimeDelta time_without_parallel_streams); 269 base::TimeDelta time_without_parallel_streams);
238 270
271 // Records the parallel download creation counts and the reasons why the
272 // download falls back to non-parallel download.
273 void RecordParallelDownloadCreationEvent(ParallelDownloadCreationEvent event);
274
239 // Record the result of a download file rename. 275 // Record the result of a download file rename.
240 void RecordDownloadFileRenameResultAfterRetry( 276 void RecordDownloadFileRenameResultAfterRetry(
241 base::TimeDelta time_since_first_failure, 277 base::TimeDelta time_since_first_failure,
242 DownloadInterruptReason interrupt_reason); 278 DownloadInterruptReason interrupt_reason);
243 279
244 enum SavePackageEvent { 280 enum SavePackageEvent {
245 // The user has started to save a page as a package. 281 // The user has started to save a page as a package.
246 SAVE_PACKAGE_STARTED, 282 SAVE_PACKAGE_STARTED,
247 283
248 // The save package operation was cancelled. 284 // The save package operation was cancelled.
(...skipping 28 matching lines...) Expand all
277 313
278 void RecordDownloadConnectionSecurity(const GURL& download_url, 314 void RecordDownloadConnectionSecurity(const GURL& download_url,
279 const std::vector<GURL>& url_chain); 315 const std::vector<GURL>& url_chain);
280 316
281 void RecordDownloadSourcePageTransitionType( 317 void RecordDownloadSourcePageTransitionType(
282 const base::Optional<ui::PageTransition>& transition); 318 const base::Optional<ui::PageTransition>& transition);
283 319
284 } // namespace content 320 } // namespace content
285 321
286 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ 322 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_job_factory.cc ('k') | content/browser/download/download_stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698